mirror of
https://github.com/2dust/v2rayN.git
synced 2025-12-18 01:10:01 +05:00
Code optimization
This commit is contained in:
@@ -228,12 +228,6 @@ namespace ServiceLib.Common
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// byte 转成 有两位小数点的 方便阅读的数据 比如 2.50 MB
|
||||
/// </summary>
|
||||
/// <param name="amount">bytes</param>
|
||||
/// <param name="result">转换之后的数据</param>
|
||||
/// <param name="unit">单位</param>
|
||||
private static void ToHumanReadable(long amount, out double result, out string unit)
|
||||
{
|
||||
var factor = 1024u;
|
||||
@@ -411,7 +405,6 @@ namespace ServiceLib.Common
|
||||
/// <param name="domain"></param>
|
||||
public static bool IsDomain(string? domain)
|
||||
{
|
||||
//如果为空
|
||||
if (IsNullOrEmpty(domain))
|
||||
{
|
||||
return false;
|
||||
@@ -564,10 +557,6 @@ namespace ServiceLib.Common
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统hosts
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Dictionary<string, string> GetSystemHosts()
|
||||
{
|
||||
var systemHosts = new Dictionary<string, string>();
|
||||
@@ -634,10 +623,6 @@ namespace ServiceLib.Common
|
||||
|
||||
#region TempPath
|
||||
|
||||
/// <summary>
|
||||
/// 获取启动了应用程序的可执行文件的路径
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetPath(string fileName)
|
||||
{
|
||||
var startupPath = StartupPath();
|
||||
@@ -647,11 +632,7 @@ namespace ServiceLib.Common
|
||||
}
|
||||
return Path.Combine(startupPath, fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取启动了应用程序的可执行文件的路径及文件名
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
public static string GetExePath()
|
||||
{
|
||||
return Environment.ProcessPath ?? Process.GetCurrentProcess().MainModule?.FileName ?? string.Empty;
|
||||
|
||||
Reference in New Issue
Block a user