@@ -47,9 +47,9 @@ public FileHistoriesSingleRevision(Repository repo, string file, Models.Commit r
47
47
RefreshViewContent ( ) ;
48
48
}
49
49
50
- public void ResetToSelectedRevision ( )
50
+ public Task < bool > ResetToSelectedRevision ( )
51
51
{
52
- new Commands . Checkout ( _repo . FullPath ) . FileWithRevision ( _file , $ "{ _revision . SHA } ") ;
52
+ return Task . Run ( ( ) => new Commands . Checkout ( _repo . FullPath ) . FileWithRevision ( _file , $ "{ _revision . SHA } ") ) ;
53
53
}
54
54
55
55
private void RefreshViewContent ( )
@@ -84,7 +84,7 @@ private void SetViewContentAsRevisionFile()
84
84
var stream = Commands . QueryFileContent . Run ( _repo . FullPath , _revision . SHA , _file ) ;
85
85
var fileSize = stream . Length ;
86
86
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 ) ;
88
88
var image = new Models . RevisionImageFile ( ) { Image = bitmap , FileSize = fileSize , ImageType = imageType } ;
89
89
Dispatcher . UIThread . Invoke ( ( ) => ViewContent = new FileHistoriesRevisionFile ( _file , image ) ) ;
90
90
}
@@ -103,7 +103,7 @@ private void SetViewContentAsRevisionFile()
103
103
var matchLFS = REG_LFS_FORMAT ( ) . Match ( content ) ;
104
104
if ( matchLFS . Success )
105
105
{
106
- var lfs = new Models . RevisionLFSObject ( ) { Object = new Models . LFSObject ( ) } ;
106
+ var lfs = new Models . RevisionLFSObject ( ) { Object = new ( ) } ;
107
107
lfs . Object . Oid = matchLFS . Groups [ 1 ] . Value ;
108
108
lfs . Object . Size = long . Parse ( matchLFS . Groups [ 2 ] . Value ) ;
109
109
Dispatcher . UIThread . Invoke ( ( ) => ViewContent = new FileHistoriesRevisionFile ( _file , lfs ) ) ;
@@ -156,15 +156,12 @@ private void SetViewContentAsDiff()
156
156
[ GeneratedRegex ( @"^version https://git-lfs.github.com/spec/v\d+\r?\noid sha256:([0-9a-f]+)\r?\nsize (\d+)[\r\n]*$" ) ]
157
157
private static partial Regex REG_LFS_FORMAT ( ) ;
158
158
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" ] ;
163
160
164
161
private Repository _repo = null ;
165
162
private string _file = null ;
166
163
private Models . Commit _revision = null ;
167
- private bool _isDiffMode = true ;
164
+ private bool _isDiffMode = false ;
168
165
private object _viewContent = null ;
169
166
}
170
167
@@ -265,7 +262,6 @@ public object ViewContent
265
262
public FileHistories ( Repository repo , string file , string commit = null )
266
263
{
267
264
_repo = repo ;
268
- _file = file ;
269
265
270
266
Task . Run ( ( ) =>
271
267
{
@@ -288,10 +284,10 @@ public FileHistories(Repository repo, string file, string commit = null)
288
284
switch ( SelectedCommits . Count )
289
285
{
290
286
case 1 :
291
- ViewContent = new FileHistoriesSingleRevision ( _repo , _file , SelectedCommits [ 0 ] , _prevIsDiffMode ) ;
287
+ ViewContent = new FileHistoriesSingleRevision ( _repo , file , SelectedCommits [ 0 ] , _prevIsDiffMode ) ;
292
288
break ;
293
289
case 2 :
294
- ViewContent = new FileHistoriesCompareRevisions ( _repo , _file , SelectedCommits [ 0 ] , SelectedCommits [ 1 ] ) ;
290
+ ViewContent = new FileHistoriesCompareRevisions ( _repo , file , SelectedCommits [ 0 ] , SelectedCommits [ 1 ] ) ;
295
291
break ;
296
292
default :
297
293
ViewContent = SelectedCommits . Count ;
@@ -317,11 +313,10 @@ public string GetCommitFullMessage(Models.Commit commit)
317
313
}
318
314
319
315
private readonly Repository _repo = null ;
320
- private readonly string _file = null ;
321
316
private bool _isLoading = true ;
322
317
private bool _prevIsDiffMode = true ;
323
318
private List < Models . Commit > _commits = null ;
324
- private Dictionary < string , string > _fullCommitMessages = new Dictionary < string , string > ( ) ;
319
+ private Dictionary < string , string > _fullCommitMessages = new ( ) ;
325
320
private object _viewContent = null ;
326
321
}
327
322
}
0 commit comments