mirror of
https://github.com/2dust/v2rayN.git
synced 2026-02-18 08:13:02 +00:00
Accept hosts.ics as a host file on windows. (#8714)
Some checks are pending
release Linux / build (Release) (push) Waiting to run
release Linux / rpm (push) Blocked by required conditions
release macOS / build (Release) (push) Waiting to run
release Windows desktop (Avalonia UI) / build (Release) (push) Waiting to run
release Windows / build (Release) (push) Waiting to run
Some checks are pending
release Linux / build (Release) (push) Waiting to run
release Linux / rpm (push) Blocked by required conditions
release macOS / build (Release) (push) Waiting to run
release Windows desktop (Avalonia UI) / build (Release) (push) Waiting to run
release Windows / build (Release) (push) Waiting to run
Signed-off-by: 秋雨落 <i@rain.cx>
This commit is contained in:
parent
8774e302b2
commit
ffe401a26d
1 changed files with 14 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue