net8, language features, bugfixes

This commit is contained in:
kkb 2023-12-18 16:31:00 +01:00
parent 1591618c2c
commit ce99053a10
353 changed files with 3245 additions and 3944 deletions

View file

@ -21,10 +21,9 @@ public partial class CollectorService
output = stream.ReadToEnd();
// clean output
var clean = Regex
.Replace(output
var clean = CleanRegex().Replace(output
.Trim()
.Replace("\t", " "), @"[ ]{2,}", " ");
.Replace("\t", " "), " ");
var elements = clean.Split(Array.Empty<char>(), StringSplitOptions.RemoveEmptyEntries);
@ -36,13 +35,12 @@ public partial class CollectorService
// linebreak list conversion
var lines = new List<string>(output
.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries))
.Split(separator, StringSplitOptions.RemoveEmptyEntries))
.Select(l =>
{
return Regex
.Replace(l
return CleanRegex().Replace(l
.Trim()
.Replace("\t", " "), @"[ ]{2,}", " ");
.Replace("\t", " "), " ");
})
.ToList();
@ -62,13 +60,12 @@ public partial class CollectorService
// linebreak list conversion
lines = new List<string>(output
.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries))
.Split(separator, StringSplitOptions.RemoveEmptyEntries))
.Select(l =>
{
return Regex
.Replace(l
return CleanRegex().Replace(l
.Trim()
.Replace("\t", " "), @"[ ]{2,}", " ");
.Replace("\t", " "), " ");
})
.ToList();
@ -102,4 +99,9 @@ public partial class CollectorService
return os;
}
private static readonly string[] separator = ["\n", "\r\n"];
[GeneratedRegex(@"[ ]{2,}")]
private static partial Regex CleanRegex();
}