mirror of
https://github.com/2dust/v2rayN.git
synced 2026-02-28 05:03:02 +00:00
Update Utils.cs
This commit is contained in:
parent
0f3a3eac02
commit
5e9da4ef40
1 changed files with 2 additions and 2 deletions
|
|
@ -339,13 +339,13 @@ public class Utils
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
var userHostsMap = hostsContent
|
var userHostsMap = hostsContent
|
||||||
.Split(['\r', '\n'], StringSplitOptions.RemoveEmptyEntries)
|
.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
|
||||||
.Select(line => line.Trim())
|
.Select(line => line.Trim())
|
||||||
// skip full-line comments
|
// skip full-line comments
|
||||||
.Where(line => !string.IsNullOrWhiteSpace(line) && !line.StartsWith('#'))
|
.Where(line => !string.IsNullOrWhiteSpace(line) && !line.StartsWith('#'))
|
||||||
// ensure line still contains valid parts
|
// ensure line still contains valid parts
|
||||||
.Where(line => !string.IsNullOrWhiteSpace(line) && line.Contains(' '))
|
.Where(line => !string.IsNullOrWhiteSpace(line) && line.Contains(' '))
|
||||||
.Select(line => line.Split([' ', '\t'], StringSplitOptions.RemoveEmptyEntries))
|
.Select(line => line.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries))
|
||||||
.Where(parts => parts.Length >= 2)
|
.Where(parts => parts.Length >= 2)
|
||||||
.GroupBy(parts => parts[0])
|
.GroupBy(parts => parts[0])
|
||||||
.ToDictionary(
|
.ToDictionary(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue