Source Generated Regex

This commit is contained in:
Enner Pérez 2024-03-16 04:09:27 -05:00
parent f93dec5e6a
commit c0a079de41
19 changed files with 101 additions and 64 deletions

View file

@ -6,7 +6,7 @@ using System.Text;
using System.Text.RegularExpressions;
namespace SourceGit.Commands {
public class Command {
public partial class Command {
public class CancelToken {
public bool Requested { get; set; } = false;
}
@ -70,7 +70,7 @@ namespace SourceGit.Commands {
if (e.Data.StartsWith("remote: Counting objects:", StringComparison.Ordinal)) return;
if (e.Data.StartsWith("remote: Compressing objects:", StringComparison.Ordinal)) return;
if (e.Data.StartsWith("Filtering content:", StringComparison.Ordinal)) return;
if (_progressRegex.IsMatch(e.Data)) return;
if (_progressRegex().IsMatch(e.Data)) return;
errs.Add(e.Data);
};
@ -142,6 +142,7 @@ namespace SourceGit.Commands {
protected virtual void OnReadline(string line) { }
private static readonly Regex _progressRegex = new Regex(@"\d+%");
[GeneratedRegex(@"\d+%")]
private static partial Regex _progressRegex();
}
}