diff --git a/src/App.JsonCodeGen.cs b/src/App.JsonCodeGen.cs index 9b96d415..82a80c46 100644 --- a/src/App.JsonCodeGen.cs +++ b/src/App.JsonCodeGen.cs @@ -50,9 +50,9 @@ namespace SourceGit } [JsonSourceGenerationOptions( - WriteIndented = true, - IgnoreReadOnlyFields = true, - IgnoreReadOnlyProperties = true, + WriteIndented = true, + IgnoreReadOnlyFields = true, + IgnoreReadOnlyProperties = true, Converters = [ typeof(ColorConverter), typeof(FontFamilyConverter), diff --git a/src/App.axaml.cs b/src/App.axaml.cs index d3f9203d..c3c679b6 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -458,7 +458,7 @@ namespace SourceGit var args = desktop.Args; if (args.Length != 1 || !args[0].StartsWith("Enter passphrase", StringComparison.Ordinal)) return false; - + desktop.MainWindow = new Views.Askpass(args[0]); return true; } diff --git a/src/Commands/LFS.cs b/src/Commands/LFS.cs index f8f42ae2..62254d42 100644 --- a/src/Commands/LFS.cs +++ b/src/Commands/LFS.cs @@ -82,7 +82,7 @@ namespace SourceGit.Commands var rs = cmd.ReadToEnd(); if (rs.IsSuccess) { - var lines = rs.StdOut.Split(new char[] {'\n', '\r'}, StringSplitOptions.RemoveEmptyEntries); + var lines = rs.StdOut.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); foreach (var line in lines) { var match = REG_LOCK().Match(line); diff --git a/src/Converters/IntConverters.cs b/src/Converters/IntConverters.cs index 137f6c9b..765ff6ef 100644 --- a/src/Converters/IntConverters.cs +++ b/src/Converters/IntConverters.cs @@ -22,7 +22,7 @@ namespace SourceGit.Converters public static readonly FuncValueConverter IsSubjectLengthBad = new FuncValueConverter(v => v > ViewModels.Preference.Instance.SubjectGuideLength); - + public static readonly FuncValueConverter IsSubjectLengthGood = new FuncValueConverter(v => v <= ViewModels.Preference.Instance.SubjectGuideLength); diff --git a/src/Models/Commit.cs b/src/Models/Commit.cs index 0a95eac3..10ccebfb 100644 --- a/src/Models/Commit.cs +++ b/src/Models/Commit.cs @@ -19,7 +19,6 @@ namespace SourceGit.Models public bool IsMerged { get; set; } = false; public Thickness Margin { get; set; } = new Thickness(0); - public string AuthorTimeStr => DateTime.UnixEpoch.AddSeconds(AuthorTime).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss"); public string CommitterTimeStr => DateTime.UnixEpoch.AddSeconds(CommitterTime).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss"); public string AuthorTimeShortStr => DateTime.UnixEpoch.AddSeconds(AuthorTime).ToLocalTime().ToString("yyyy/MM/dd"); diff --git a/src/Models/Worktree.cs b/src/Models/Worktree.cs index 5fbd4436..11525387 100644 --- a/src/Models/Worktree.cs +++ b/src/Models/Worktree.cs @@ -26,7 +26,7 @@ namespace SourceGit.Models if (Branch.StartsWith("refs/heads/", System.StringComparison.Ordinal)) return $"({Branch.Substring(11)})"; - + if (Branch.StartsWith("refs/remotes/", System.StringComparison.Ordinal)) return $"({Branch.Substring(13)})"; diff --git a/src/ViewModels/BranchTreeNode.cs b/src/ViewModels/BranchTreeNode.cs index a29e6a2c..e1ec134f 100644 --- a/src/ViewModels/BranchTreeNode.cs +++ b/src/ViewModels/BranchTreeNode.cs @@ -18,19 +18,19 @@ namespace SourceGit.ViewModels public bool IsFiltered { get; set; } = false; public bool IsSelected { get; set; } = false; public List Children { get; private set; } = new List(); - + public bool IsExpanded { get => _isExpanded; set => SetProperty(ref _isExpanded, value); } - + public CornerRadius CornerRadius { get => _cornerRadius; set => SetProperty(ref _cornerRadius, value); } - + public bool IsBranch { get => Backend is Models.Branch; @@ -55,7 +55,7 @@ namespace SourceGit.ViewModels { get => Backend is Models.Branch b ? b.FriendlyName : null; } - + private bool _isExpanded = false; private CornerRadius _cornerRadius = new CornerRadius(4); @@ -118,11 +118,11 @@ namespace SourceGit.ViewModels { if (node.Backend is Models.Branch) continue; - + var path = prefix + "/" + node.Name; if (node.IsExpanded) _expanded.Add(path); - + CollectExpandedNodes(node.Children, path); } } @@ -197,7 +197,7 @@ namespace SourceGit.ViewModels if (l.Backend is Models.Branch) return r.Backend is Models.Branch ? string.Compare(l.Name, r.Name, StringComparison.Ordinal) : 1; - + return r.Backend is Models.Branch ? -1 : string.Compare(l.Name, r.Name, StringComparison.Ordinal); }); diff --git a/src/ViewModels/Launcher.cs b/src/ViewModels/Launcher.cs index b097c7a5..394e6c71 100644 --- a/src/ViewModels/Launcher.cs +++ b/src/ViewModels/Launcher.cs @@ -32,7 +32,7 @@ namespace SourceGit.ViewModels { Pages = new AvaloniaList(); AddNewTab(); - + if (!string.IsNullOrEmpty(startupRepo)) { var root = new Commands.QueryRepositoryRootPath(startupRepo).Result(); @@ -272,8 +272,9 @@ namespace SourceGit.ViewModels public void DispatchNotification(string pageId, string message, bool isError) { - var notification = new Notification() { - IsError = isError, + var notification = new Notification() + { + IsError = isError, Message = message, }; diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index 00808a48..5ab93abc 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -496,7 +496,7 @@ namespace SourceGit.ViewModels private bool _restoreTabs = false; private bool _useFixedTabWidth = true; private bool _check4UpdatesOnStartup = true; - + private bool _useTwoColumnsLayoutInHistories = false; private bool _useSideBySideDiff = false; private bool _useSyntaxHighlighting = false; diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index a4d8b84e..ef4032a3 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -644,7 +644,7 @@ namespace SourceGit.ViewModels } lfs.Items.Add(new MenuItem() { Header = "-" }); - } + } var lfsLock = new MenuItem(); lfsLock.Header = App.Text("GitLFS.Locks.Lock"); @@ -678,7 +678,7 @@ namespace SourceGit.ViewModels }; lfsLock.Items.Add(lockRemote); } - } + } lfs.Items.Add(lfsLock); var lfsUnlock = new MenuItem(); @@ -713,7 +713,7 @@ namespace SourceGit.ViewModels }; lfsUnlock.Items.Add(unlockRemote); } - } + } lfs.Items.Add(lfsUnlock); menu.Items.Add(lfs); @@ -1005,7 +1005,7 @@ namespace SourceGit.ViewModels }; lfsLock.Items.Add(lockRemote); } - } + } lfs.Items.Add(lfsLock); var lfsUnlock = new MenuItem(); @@ -1040,7 +1040,7 @@ namespace SourceGit.ViewModels }; lfsUnlock.Items.Add(unlockRemote); } - } + } lfs.Items.Add(lfsUnlock); menu.Items.Add(lfs); diff --git a/src/Views/BranchTree.axaml.cs b/src/Views/BranchTree.axaml.cs index 95e70f48..1374a62f 100644 --- a/src/Views/BranchTree.axaml.cs +++ b/src/Views/BranchTree.axaml.cs @@ -24,7 +24,7 @@ namespace SourceGit.Views get => GetValue(NodeProperty); set => SetValue(NodeProperty, value); } - + public static readonly StyledProperty IsExpandedProperty = AvaloniaProperty.Register(nameof(IsExpanded)); @@ -51,21 +51,21 @@ namespace SourceGit.Views if (node.Backend is Models.Remote) { - CreateContent(12, new Thickness(0,2,0,0), "Icons.Remote"); + CreateContent(12, new Thickness(0, 2, 0, 0), "Icons.Remote"); } else if (node.Backend is Models.Branch branch) { if (branch.IsCurrent) - CreateContent(12, new Thickness(0,2,0,0), "Icons.Check"); + CreateContent(12, new Thickness(0, 2, 0, 0), "Icons.Check"); else - CreateContent(12, new Thickness(2,0,0,0), "Icons.Branch"); + CreateContent(12, new Thickness(2, 0, 0, 0), "Icons.Branch"); } else { if (node.IsExpanded) - CreateContent(10, new Thickness(0,2,0,0), "Icons.Folder.Open"); + CreateContent(10, new Thickness(0, 2, 0, 0), "Icons.Folder.Open"); else - CreateContent(10, new Thickness(0,2,0,0), "Icons.Folder.Fill"); + CreateContent(10, new Thickness(0, 2, 0, 0), "Icons.Folder.Fill"); } } @@ -74,7 +74,7 @@ namespace SourceGit.Views var geo = this.FindResource(iconKey) as StreamGeometry; if (geo == null) return; - + Content = new Path() { Width = size, @@ -86,7 +86,7 @@ namespace SourceGit.Views }; } } - + public partial class BranchTree : UserControl { public static readonly StyledProperty> NodesProperty = @@ -103,7 +103,7 @@ namespace SourceGit.Views get; private set; } = new AvaloniaList(); - + public static readonly RoutedEvent SelectionChangedEvent = RoutedEvent.Register(nameof(SelectionChanged), RoutingStrategies.Tunnel | RoutingStrategies.Bubble); @@ -180,7 +180,7 @@ namespace SourceGit.Views if (item is ViewModels.BranchTreeNode node) node.IsSelected = false; } - + var selected = BranchesPresenter.SelectedItems; if (selected == null || selected.Count == 0) return; @@ -207,16 +207,16 @@ namespace SourceGit.Views prev = row; } - + RaiseEvent(new RoutedEventArgs(SelectionChangedEvent)); } - + private void OnTreeContextRequested(object _1, ContextRequestedEventArgs _2) { var repo = DataContext as ViewModels.Repository; if (repo?.Settings == null) return; - + var selected = BranchesPresenter.SelectedItems; if (selected == null || selected.Count == 0) return; @@ -280,7 +280,7 @@ namespace SourceGit.Views var idx = rows.IndexOf(node); if (idx == -1) return; - + if (node.IsExpanded) { var subtree = new List(); @@ -305,7 +305,7 @@ namespace SourceGit.Views } } } - + private void OnToggleFilter(object sender, RoutedEventArgs e) { if (sender is ToggleButton toggle && DataContext is ViewModels.Repository repo) @@ -316,7 +316,7 @@ namespace SourceGit.Views e.Handled = true; } - + private void MakeRows(List rows, List nodes, int depth) { foreach (var node in nodes) @@ -326,7 +326,7 @@ namespace SourceGit.Views if (!node.IsExpanded || node.Backend is Models.Branch) continue; - + MakeRows(rows, node.Children, depth + 1); } } @@ -338,7 +338,7 @@ namespace SourceGit.Views outs.Add(branch); return; } - + foreach (var sub in node.Children) CollectBranchesInNode(outs, sub); } diff --git a/src/Views/ImageDiffView.axaml.cs b/src/Views/ImageDiffView.axaml.cs index bdeda323..0d2fac1c 100644 --- a/src/Views/ImageDiffView.axaml.cs +++ b/src/Views/ImageDiffView.axaml.cs @@ -127,7 +127,7 @@ namespace SourceGit.Views Cursor = new Cursor(StandardCursorType.SizeWestEast); e.Pointer.Capture(this); e.Handled = true; - } + } } protected override void OnPointerReleased(PointerReleasedEventArgs e) @@ -163,7 +163,7 @@ namespace SourceGit.Views _lastInSlider = false; Cursor = null; } - } + } } } diff --git a/src/Views/InteractiveRebase.axaml.cs b/src/Views/InteractiveRebase.axaml.cs index 491d4bab..2daf29fc 100644 --- a/src/Views/InteractiveRebase.axaml.cs +++ b/src/Views/InteractiveRebase.axaml.cs @@ -21,7 +21,7 @@ namespace SourceGit.Views Close(); } - private void OnMoveItemUp(object sender, RoutedEventArgs e) + private void OnMoveItemUp(object sender, RoutedEventArgs e) { if (sender is Control control && DataContext is ViewModels.InteractiveRebase vm) { @@ -39,7 +39,7 @@ namespace SourceGit.Views } } - private void OnDataGridKeyDown(object sender, KeyEventArgs e) + private void OnDataGridKeyDown(object sender, KeyEventArgs e) { var datagrid = sender as DataGrid; var item = datagrid.SelectedItem as ViewModels.InteractiveRebaseItem; diff --git a/src/Views/Launcher.axaml.cs b/src/Views/Launcher.axaml.cs index fd67ecda..39f38c97 100644 --- a/src/Views/Launcher.axaml.cs +++ b/src/Views/Launcher.axaml.cs @@ -182,7 +182,7 @@ namespace SourceGit.Views private void EndMoveWindow(object sender, PointerReleasedEventArgs e) { _pressedTitleBar = false; - } + } private void OnPopupSure(object sender, RoutedEventArgs e) { diff --git a/src/Views/Repository.axaml.cs b/src/Views/Repository.axaml.cs index 0e3d7a19..3a05d517 100644 --- a/src/Views/Repository.axaml.cs +++ b/src/Views/Repository.axaml.cs @@ -65,7 +65,7 @@ namespace SourceGit.Views private void OnSearchCommitPanelPropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e) { - if (e.Property == IsVisibleProperty && sender is Grid { IsVisible: true}) + if (e.Property == IsVisibleProperty && sender is Grid { IsVisible: true }) txtSearchCommitsBox.Focus(); } @@ -86,7 +86,7 @@ namespace SourceGit.Views { repo.NavigateToCommit(commit.SHA); } - + e.Handled = true; } @@ -101,7 +101,7 @@ namespace SourceGit.Views remoteBranchTree.UnselectAll(); tagsList.SelectedItem = null; } - + private void OnRemoteBranchTreeSelectionChanged(object _1, RoutedEventArgs _2) { localBranchTree.UnselectAll();