mirror of
https://github.com/2dust/v2rayN.git
synced 2026-02-04 17:59:45 +05:00
Accept hosts.ics as a host file on windows. (#8714)
Signed-off-by: 秋雨落 <i@rain.cx>
This commit is contained in:
@@ -719,10 +719,9 @@ public class Utils
|
||||
return Guid.TryParse(strSrc, out _);
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> GetSystemHosts()
|
||||
private static Dictionary<string, string> GetSystemHosts(string hostFile)
|
||||
{
|
||||
var systemHosts = new Dictionary<string, string>();
|
||||
var hostFile = @"C:\Windows\System32\drivers\etc\hosts";
|
||||
try
|
||||
{
|
||||
if (File.Exists(hostFile))
|
||||
@@ -755,6 +754,19 @@ public class Utils
|
||||
return systemHosts;
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> GetSystemHosts()
|
||||
{
|
||||
var hosts = GetSystemHosts(@"C:\Windows\System32\drivers\etc\hosts");
|
||||
var hostsIcs = GetSystemHosts(@"C:\Windows\System32\drivers\etc\hosts.ics");
|
||||
|
||||
foreach (var (key, value) in hostsIcs)
|
||||
{
|
||||
hosts[key] = value;
|
||||
}
|
||||
|
||||
return hosts;
|
||||
}
|
||||
|
||||
public static async Task<string?> GetCliWrapOutput(string filePath, string? arg)
|
||||
{
|
||||
return await GetCliWrapOutput(filePath, arg != null ? new List<string>() { arg } : null);
|
||||
|
||||
Reference in New Issue
Block a user