📄 utils.cs
字号:
namespace PowerEasy.Controls.ExtendedUploadFile
{
using PowerEasy.Common;
using System;
using System.Web;
public sealed class Utils
{
private Utils()
{
}
public static HttpContext Context()
{
HttpContext current = HttpContext.Current;
if (current == null)
{
throw new HttpException("HttpContext not found");
}
return current;
}
public static string GetFormatString(double size)
{
if (size >= 1048576.0)
{
return (Math.Round((double) (size / 1048576.0), 2) + " m");
}
if (size >= 1024.0)
{
return (Math.Round((double) (size / 1024.0), 2) + " k");
}
return (size + " bytes");
}
public static string GetFormatString(TimeSpan span)
{
string str = string.Empty;
if ((span.Days > 0) || (span.Hours > 0))
{
int num = (0x18 * span.Days) + span.Hours;
str = str + num + " 小时 ";
}
if (span.Minutes > 0)
{
str = str + span.Minutes + " 分 ";
}
if (span.Seconds > 0)
{
str = str + span.Seconds + " 秒 ";
}
return str;
}
public static bool IsAccordantBrowser()
{
HttpBrowserCapabilities browser = Context().Request.Browser;
return (!(browser.Browser != "IE") && (float.Parse(browser.Version) >= 5.5));
}
public static double UpLoadFileLength()
{
int num = 0x3e8;
return (double) (num * 0x400);
}
public static string UploadFolder()
{
return FileSystemObject.CreateFileFolder("Temp");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -