using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.IO;
|
using System.Diagnostics;
|
using System.Xml.Linq;
|
|
namespace CY_DocumentSynchroWCFService
|
{
|
/// <summary>
|
/// 公告帮助类
|
/// </summary>
|
public class CommonHelper
|
{
|
public CommonHelper()
|
{
|
}
|
|
/// <summary>
|
/// 删除文件
|
/// </summary>
|
/// <param name="filePath"></param>
|
/// <returns></returns>
|
public static bool DeleteFile(string filePath)
|
{
|
bool isSuccess = true;
|
try
|
{
|
if (File.Exists(filePath))
|
{
|
FileInfo fi = new FileInfo(filePath);
|
if (fi.Attributes.ToString().IndexOf("ReadOnly") != -1)
|
fi.Attributes = FileAttributes.Normal;
|
File.Delete(filePath);
|
}
|
}
|
catch (Exception ex)
|
{
|
isSuccess = false;
|
}
|
return isSuccess;
|
}
|
}
|
}
|