/// <summary>
/// 获取文件大小
/// </summary>
/// <param name="sFullName"></param>
/// <returns></returns>
public static long TGetFileSize(string sFullName)
{
long lSize = 0;
if (File.Exists(sFullName))
lSize = new FileInfo(sFullName).Length;
return lSize;
}
public string GetFileSize(string sFileFullName)
{
FileInfo fiInput = new FileInfo(sFileFullName);
double len = fiInput.Length;
string[] sizes = { "B", "KB", "MB", "GB" };
int order = 0;
while (len >= 1024 && order + 1 < sizes.Length)
{
order++;
len = len / 1024;
}
string filesize = String.Format("{0:0.##} {1}", len, sizes[order]);
return filesize;
}
public static bool FileIsLargerThan1KB(string sFileFullName)
{
FileInfo fiInput = new FileInfo(sFileFullName);
double len = fiInput.Length;
len = len / 1024 / 1024;
return len > 1;
}