code_style: remove Rider warnings
Some checks are pending
Continuous Integration / Build (push) Waiting to run
Continuous Integration / Prepare version string (push) Waiting to run
Continuous Integration / Package (push) Blocked by required conditions
Localization Check / localization-check (push) Waiting to run

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2024-11-10 13:19:25 +08:00
parent daba8e5064
commit 8de37720fa
No known key found for this signature in database
2 changed files with 3 additions and 6 deletions

View file

@ -196,7 +196,7 @@ namespace SourceGit.ViewModels
var stream = Commands.QueryFileContent.Run(_repo.FullPath, _commit.SHA, file.Path); var stream = Commands.QueryFileContent.Run(_repo.FullPath, _commit.SHA, file.Path);
var fileSize = stream.Length; var fileSize = stream.Length;
var bitmap = fileSize > 0 ? new Bitmap(stream) : null; var bitmap = fileSize > 0 ? new Bitmap(stream) : null;
var imageType = Path.GetExtension(file.Path).TrimStart('.').ToUpper(CultureInfo.CurrentCulture); var imageType = ext!.Substring(1).ToUpper(CultureInfo.CurrentCulture);
var image = new Models.RevisionImageFile() { Image = bitmap, FileSize = fileSize, ImageType = imageType }; var image = new Models.RevisionImageFile() { Image = bitmap, FileSize = fileSize, ImageType = imageType };
Dispatcher.UIThread.Invoke(() => ViewRevisionFileContent = image); Dispatcher.UIThread.Invoke(() => ViewRevisionFileContent = image);
} }

View file

@ -153,12 +153,9 @@ namespace SourceGit.ViewModels
} }
else if (commits.Count == 1) else if (commits.Count == 1)
{ {
var commit = commits[0] as Models.Commit; var commit = (commits[0] as Models.Commit)!;
if (_repo.SearchResultSelectedCommit == null || _repo.SearchResultSelectedCommit.SHA != commit.SHA) if (_repo.SearchResultSelectedCommit == null || _repo.SearchResultSelectedCommit.SHA != commit.SHA)
{
_repo.SearchResultSelectedCommit = _repo.SearchedCommits.Find(x => x.SHA == commit.SHA); _repo.SearchResultSelectedCommit = _repo.SearchedCommits.Find(x => x.SHA == commit.SHA);
}
AutoSelectedCommit = commit; AutoSelectedCommit = commit;
NavigationId = _navigationId + 1; NavigationId = _navigationId + 1;
@ -224,7 +221,7 @@ namespace SourceGit.ViewModels
public ContextMenu MakeContextMenu(ListBox list) public ContextMenu MakeContextMenu(ListBox list)
{ {
var current = _repo.CurrentBranch; var current = _repo.CurrentBranch;
if (current == null) if (current == null || list.SelectedItems == null)
return null; return null;
if (list.SelectedItems.Count > 1) if (list.SelectedItems.Count > 1)