@@ -47,9 +47,9 @@ public FileHistoriesSingleRevision(Repository repo, string file, Models.Commit r
4747 RefreshViewContent ( ) ;
4848 }
4949
50- public void ResetToSelectedRevision ( )
50+ public Task < bool > ResetToSelectedRevision ( )
5151 {
52- new Commands . Checkout ( _repo . FullPath ) . FileWithRevision ( _file , $ "{ _revision . SHA } ") ;
52+ return Task . Run ( ( ) => new Commands . Checkout ( _repo . FullPath ) . FileWithRevision ( _file , $ "{ _revision . SHA } ") ) ;
5353 }
5454
5555 private void RefreshViewContent ( )
@@ -84,7 +84,7 @@ private void SetViewContentAsRevisionFile()
8484 var stream = Commands . QueryFileContent . Run ( _repo . FullPath , _revision . SHA , _file ) ;
8585 var fileSize = stream . Length ;
8686 var bitmap = fileSize > 0 ? new Bitmap ( stream ) : null ;
87- var imageType = Path . GetExtension ( _file ) . TrimStart ( '.' ) . ToUpper ( CultureInfo . CurrentCulture ) ;
87+ var imageType = Path . GetExtension ( _file ) ! . TrimStart ( '.' ) . ToUpper ( CultureInfo . CurrentCulture ) ;
8888 var image = new Models . RevisionImageFile ( ) { Image = bitmap , FileSize = fileSize , ImageType = imageType } ;
8989 Dispatcher . UIThread . Invoke ( ( ) => ViewContent = new FileHistoriesRevisionFile ( _file , image ) ) ;
9090 }
@@ -103,7 +103,7 @@ private void SetViewContentAsRevisionFile()
103103 var matchLFS = REG_LFS_FORMAT ( ) . Match ( content ) ;
104104 if ( matchLFS . Success )
105105 {
106- var lfs = new Models . RevisionLFSObject ( ) { Object = new Models . LFSObject ( ) } ;
106+ var lfs = new Models . RevisionLFSObject ( ) { Object = new ( ) } ;
107107 lfs . Object . Oid = matchLFS . Groups [ 1 ] . Value ;
108108 lfs . Object . Size = long . Parse ( matchLFS . Groups [ 2 ] . Value ) ;
109109 Dispatcher . UIThread . Invoke ( ( ) => ViewContent = new FileHistoriesRevisionFile ( _file , lfs ) ) ;
@@ -156,15 +156,12 @@ private void SetViewContentAsDiff()
156156 [ GeneratedRegex ( @"^version https://git-lfs.github.com/spec/v\d+\r?\noid sha256:([0-9a-f]+)\r?\nsize (\d+)[\r\n]*$" ) ]
157157 private static partial Regex REG_LFS_FORMAT ( ) ;
158158
159- private static readonly HashSet < string > IMG_EXTS = new HashSet < string > ( )
160- {
161- ".ico" , ".bmp" , ".jpg" , ".png" , ".jpeg" , ".webp"
162- } ;
159+ private static readonly HashSet < string > IMG_EXTS = [ ".ico" , ".bmp" , ".jpg" , ".png" , ".jpeg" , ".webp" ] ;
163160
164161 private Repository _repo = null ;
165162 private string _file = null ;
166163 private Models . Commit _revision = null ;
167- private bool _isDiffMode = true ;
164+ private bool _isDiffMode = false ;
168165 private object _viewContent = null ;
169166 }
170167
@@ -265,7 +262,6 @@ public object ViewContent
265262 public FileHistories ( Repository repo , string file , string commit = null )
266263 {
267264 _repo = repo ;
268- _file = file ;
269265
270266 Task . Run ( ( ) =>
271267 {
@@ -288,10 +284,10 @@ public FileHistories(Repository repo, string file, string commit = null)
288284 switch ( SelectedCommits . Count )
289285 {
290286 case 1 :
291- ViewContent = new FileHistoriesSingleRevision ( _repo , _file , SelectedCommits [ 0 ] , _prevIsDiffMode ) ;
287+ ViewContent = new FileHistoriesSingleRevision ( _repo , file , SelectedCommits [ 0 ] , _prevIsDiffMode ) ;
292288 break ;
293289 case 2 :
294- ViewContent = new FileHistoriesCompareRevisions ( _repo , _file , SelectedCommits [ 0 ] , SelectedCommits [ 1 ] ) ;
290+ ViewContent = new FileHistoriesCompareRevisions ( _repo , file , SelectedCommits [ 0 ] , SelectedCommits [ 1 ] ) ;
295291 break ;
296292 default :
297293 ViewContent = SelectedCommits . Count ;
@@ -317,11 +313,10 @@ public string GetCommitFullMessage(Models.Commit commit)
317313 }
318314
319315 private readonly Repository _repo = null ;
320- private readonly string _file = null ;
321316 private bool _isLoading = true ;
322317 private bool _prevIsDiffMode = true ;
323318 private List < Models . Commit > _commits = null ;
324- private Dictionary < string , string > _fullCommitMessages = new Dictionary < string , string > ( ) ;
319+ private Dictionary < string , string > _fullCommitMessages = new ( ) ;
325320 private object _viewContent = null ;
326321 }
327322}
0 commit comments