From 84b8735d6c97365dc0b3f689960e63959f5205ad Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 18 Aug 2024 23:14:44 +0800 Subject: [PATCH] code_style: run `dotnet format` --- src/Commands/Fetch.cs | 3 --- src/Models/AutoFetchManager.cs | 8 ++++---- src/Models/AvatarManager.cs | 8 ++++---- src/Models/ExternalTool.cs | 2 +- src/Models/TextMateHelper.cs | 6 +++--- src/ViewModels/CommitDetail.cs | 4 ++-- src/ViewModels/Preference.cs | 2 +- src/ViewModels/WorkingCopy.cs | 2 +- src/Views/Blame.axaml.cs | 4 ++-- src/Views/CommitBaseInfo.axaml.cs | 4 ++-- src/Views/TextDiffView.axaml.cs | 6 +++--- 11 files changed, 23 insertions(+), 26 deletions(-) diff --git a/src/Commands/Fetch.cs b/src/Commands/Fetch.cs index 2fb013c6..07622821 100644 --- a/src/Commands/Fetch.cs +++ b/src/Commands/Fetch.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; namespace SourceGit.Commands { diff --git a/src/Models/AutoFetchManager.cs b/src/Models/AutoFetchManager.cs index 138a1de2..7f1e4da6 100644 --- a/src/Models/AutoFetchManager.cs +++ b/src/Models/AutoFetchManager.cs @@ -17,13 +17,13 @@ namespace SourceGit.Models return _instance; } } - + public class Job { public Commands.Fetch Cmd = null; public DateTime NextRunTimepoint = DateTime.MinValue; } - + public bool IsEnabled { get; @@ -36,7 +36,7 @@ namespace SourceGit.Models set { _interval = Math.Max(1, value); - + lock (_lock) { foreach (var job in _jobs) @@ -81,7 +81,7 @@ namespace SourceGit.Models Thread.Sleep(2000); } - + // ReSharper disable once FunctionNeverReturns }); } diff --git a/src/Models/AvatarManager.cs b/src/Models/AvatarManager.cs index 8193dda8..313553f9 100644 --- a/src/Models/AvatarManager.cs +++ b/src/Models/AvatarManager.cs @@ -32,9 +32,9 @@ namespace SourceGit.Models return _instance; } } - + private static AvatarManager _instance = null; - + [GeneratedRegex(@"^(?:(\d+)\+)?(.+?)@users\.noreply\.github\.com$")] private static partial Regex REG_GITHUB_USER_EMAIL(); @@ -43,7 +43,7 @@ namespace SourceGit.Models private List _avatars = new List(); private Dictionary _resources = new Dictionary(); private HashSet _requesting = new HashSet(); - + public void Start() { _storePath = Path.Combine(Native.OS.DataDir, "avatars"); @@ -121,7 +121,7 @@ namespace SourceGit.Models NotifyResourceChanged(email); }); } - + // ReSharper disable once FunctionNeverReturns }); } diff --git a/src/Models/ExternalTool.cs b/src/Models/ExternalTool.cs index 27035a5c..45682dab 100644 --- a/src/Models/ExternalTool.cs +++ b/src/Models/ExternalTool.cs @@ -82,7 +82,7 @@ namespace SourceGit.Models public class ExternalToolPaths { [JsonPropertyName("tools")] - public Dictionary Tools { get; set; } = new Dictionary(); + public Dictionary Tools { get; set; } = new Dictionary(); } public class ExternalToolsFinder diff --git a/src/Models/TextMateHelper.cs b/src/Models/TextMateHelper.cs index efc73629..4fb6ad93 100644 --- a/src/Models/TextMateHelper.cs +++ b/src/Models/TextMateHelper.cs @@ -41,7 +41,7 @@ namespace SourceGit.Models } } } - + public IRawTheme GetTheme(string scopeName) { return _backend.GetTheme(scopeName); @@ -74,7 +74,7 @@ namespace SourceGit.Models var grammar = _extraGrammars.Find(x => x.GetScopeName().EndsWith(extension, StringComparison.OrdinalIgnoreCase)); if (grammar != null) return grammar.GetScopeName(); - + if (extension == ".h") extension = ".cpp"; else if (extension == ".resx" || extension == ".plist" || extension == ".manifest") @@ -88,7 +88,7 @@ namespace SourceGit.Models private readonly RegistryOptions _backend; private readonly List _extraGrammars; } - + public static class TextMateHelper { public static TextMate.Installation CreateForEditor(TextEditor editor) diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index 1e511c4f..f6c01259 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -320,7 +320,7 @@ namespace SourceGit.ViewModels var window = new Views.Blame() { DataContext = new Blame(_repo.FullPath, change.Path, _commit.SHA) }; window.Show(); ev.Handled = true; - }; + }; menu.Items.Add(history); menu.Items.Add(blame); @@ -415,7 +415,7 @@ namespace SourceGit.ViewModels window.Show(); ev.Handled = true; }; - + var copyPath = new MenuItem(); copyPath.Header = App.Text("CopyPath"); copyPath.Icon = App.CreateMenuIcon("Icons.Copy"); diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index ba67ec7c..33b5f99c 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -279,7 +279,7 @@ namespace SourceGit.ViewModels { if (value is null || value < 1) return; - + if (Models.AutoFetchManager.Instance.Interval != value) { Models.AutoFetchManager.Instance.Interval = (int)value; diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index e22d015c..e34f06c5 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -1312,7 +1312,7 @@ namespace SourceGit.ViewModels var succ = true; if (autoStage && _unstaged.Count > 0) succ = new Commands.Add(_repo.FullPath).Exec(); - + if (succ) succ = new Commands.Commit(_repo.FullPath, _commitMessage, _useAmend).Exec(); diff --git a/src/Views/Blame.axaml.cs b/src/Views/Blame.axaml.cs index 9666ee68..6e500e8e 100644 --- a/src/Views/Blame.axaml.cs +++ b/src/Views/Blame.axaml.cs @@ -42,7 +42,7 @@ namespace SourceGit.Views { if (line.IsDisposed || line.FirstDocumentLine == null || line.FirstDocumentLine.IsDeleted) continue; - + var lineNumber = line.FirstDocumentLine.LineNumber; if (lineNumber > _editor.BlameData.LineInfos.Count) break; @@ -156,7 +156,7 @@ namespace SourceGit.Views { if (line.IsDisposed || line.FirstDocumentLine == null || line.FirstDocumentLine.IsDeleted) continue; - + var lineNumber = line.FirstDocumentLine.LineNumber; if (lineNumber >= _editor.BlameData.LineInfos.Count) break; diff --git a/src/Views/CommitBaseInfo.axaml.cs b/src/Views/CommitBaseInfo.axaml.cs index 642ae98b..f7c44f17 100644 --- a/src/Views/CommitBaseInfo.axaml.cs +++ b/src/Views/CommitBaseInfo.axaml.cs @@ -48,7 +48,7 @@ namespace SourceGit.Views if (links.Count > 1) { var menu = new ContextMenu(); - + foreach (var link in links) { var url = $"{link.URLPrefix}{detail.Commit.SHA}"; @@ -69,7 +69,7 @@ namespace SourceGit.Views var url = $"{links[0].URLPrefix}{detail.Commit.SHA}"; Native.OS.OpenBrowser(url); } - } + } e.Handled = true; } diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index da939e1e..464339d8 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -94,7 +94,7 @@ namespace SourceGit.Views { if (line.IsDisposed || line.FirstDocumentLine == null || line.FirstDocumentLine.IsDeleted) continue; - + var index = line.FirstDocumentLine.LineNumber; if (index > lines.Count) break; @@ -744,7 +744,7 @@ namespace SourceGit.Views { if (line.IsDisposed || line.FirstDocumentLine == null || line.FirstDocumentLine.IsDeleted) continue; - + var index = line.FirstDocumentLine.LineNumber; if (index > diff.Lines.Count) break; @@ -926,7 +926,7 @@ namespace SourceGit.Views { if (line.IsDisposed || line.FirstDocumentLine == null || line.FirstDocumentLine.IsDeleted) continue; - + var index = line.FirstDocumentLine.LineNumber; if (index > lines.Count) break;