@@ -43,7 +43,7 @@ public static Preference Instance
4343 if ( _instance . MonospaceFont == null )
4444 _instance . MonospaceFont = new FontFamily ( "fonts:SourceGit#JetBrains Mono" ) ;
4545
46- if ( ! _instance . IsGitConfigured )
46+ if ( ! _instance . IsGitConfigured ( ) )
4747 _instance . GitInstallPath = Native . OS . FindGitExecutable ( ) ;
4848
4949 return _instance ;
@@ -213,12 +213,6 @@ public Models.ChangeViewMode CommitChangeViewMode
213213 set => SetProperty ( ref _commitChangeViewMode , value ) ;
214214 }
215215
216- [ JsonIgnore ]
217- public bool IsGitConfigured
218- {
219- get => ! string . IsNullOrEmpty ( GitInstallPath ) && File . Exists ( GitInstallPath ) ;
220- }
221-
222216 public string GitInstallPath
223217 {
224218 get => Native . OS . GitExecutable ;
@@ -326,28 +320,30 @@ public double LastCheckUpdateTime
326320 set ;
327321 } = 0 ;
328322
329- [ JsonIgnore ]
330- public bool ShouldCheck4UpdateOnStartup
323+ public bool IsGitConfigured ( )
331324 {
332- get
333- {
334- if ( ! _check4UpdatesOnStartup )
335- return false ;
325+ var path = GitInstallPath ;
326+ return ! string . IsNullOrEmpty ( path ) && File . Exists ( path ) ;
327+ }
328+
329+ public bool ShouldCheck4UpdateOnStartup ( )
330+ {
331+ if ( ! _check4UpdatesOnStartup )
332+ return false ;
336333
337- var lastCheck = DateTime . UnixEpoch . AddSeconds ( LastCheckUpdateTime ) . ToLocalTime ( ) ;
338- var now = DateTime . Now ;
334+ var lastCheck = DateTime . UnixEpoch . AddSeconds ( LastCheckUpdateTime ) . ToLocalTime ( ) ;
335+ var now = DateTime . Now ;
339336
340- if ( lastCheck . Year == now . Year && lastCheck . Month == now . Month && lastCheck . Day == now . Day )
341- return false ;
337+ if ( lastCheck . Year == now . Year && lastCheck . Month == now . Month && lastCheck . Day == now . Day )
338+ return false ;
342339
343- LastCheckUpdateTime = now . Subtract ( DateTime . UnixEpoch . ToLocalTime ( ) ) . TotalSeconds ;
344- return true ;
345- }
340+ LastCheckUpdateTime = now . Subtract ( DateTime . UnixEpoch . ToLocalTime ( ) ) . TotalSeconds ;
341+ return true ;
346342 }
347343
348- public static void AddNode ( RepositoryNode node , RepositoryNode to = null )
344+ public void AddNode ( RepositoryNode node , RepositoryNode to = null )
349345 {
350- var collection = to == null ? _instance . _repositoryNodes : to . SubNodes ;
346+ var collection = to == null ? _repositoryNodes : to . SubNodes ;
351347 var list = new List < RepositoryNode > ( ) ;
352348 list . AddRange ( collection ) ;
353349 list . Add ( node ) ;
@@ -364,14 +360,14 @@ public static void AddNode(RepositoryNode node, RepositoryNode to = null)
364360 collection . Add ( one ) ;
365361 }
366362
367- public static RepositoryNode FindNode ( string id )
363+ public RepositoryNode FindNode ( string id )
368364 {
369- return FindNodeRecursive ( id , _instance . RepositoryNodes ) ;
365+ return FindNodeRecursive ( id , RepositoryNodes ) ;
370366 }
371367
372- public static RepositoryNode FindOrAddNodeByRepositoryPath ( string repo , RepositoryNode parent , bool shouldMoveNode )
368+ public RepositoryNode FindOrAddNodeByRepositoryPath ( string repo , RepositoryNode parent , bool shouldMoveNode )
373369 {
374- var node = FindNodeRecursive ( repo , _instance . RepositoryNodes ) ;
370+ var node = FindNodeRecursive ( repo , RepositoryNodes ) ;
375371 if ( node == null )
376372 {
377373 node = new RepositoryNode ( )
@@ -392,9 +388,9 @@ public static RepositoryNode FindOrAddNodeByRepositoryPath(string repo, Reposito
392388 return node ;
393389 }
394390
395- public static void MoveNode ( RepositoryNode node , RepositoryNode to = null )
391+ public void MoveNode ( RepositoryNode node , RepositoryNode to = null )
396392 {
397- if ( to == null && _instance . _repositoryNodes . Contains ( node ) )
393+ if ( to == null && _repositoryNodes . Contains ( node ) )
398394 return ;
399395 if ( to != null && to . SubNodes . Contains ( node ) )
400396 return ;
@@ -403,14 +399,14 @@ public static void MoveNode(RepositoryNode node, RepositoryNode to = null)
403399 AddNode ( node , to ) ;
404400 }
405401
406- public static void RemoveNode ( RepositoryNode node )
402+ public void RemoveNode ( RepositoryNode node )
407403 {
408- RemoveNodeRecursive ( node , _instance . _repositoryNodes ) ;
404+ RemoveNodeRecursive ( node , _repositoryNodes ) ;
409405 }
410406
411- public static void SortByRenamedNode ( RepositoryNode node )
407+ public void SortByRenamedNode ( RepositoryNode node )
412408 {
413- var container = FindNodeContainer ( node , _instance . _repositoryNodes ) ;
409+ var container = FindNodeContainer ( node , _repositoryNodes ) ;
414410 if ( container == null )
415411 return ;
416412
@@ -435,7 +431,7 @@ public void Save()
435431 File . WriteAllText ( _savePath , data ) ;
436432 }
437433
438- private static RepositoryNode FindNodeRecursive ( string id , AvaloniaList < RepositoryNode > collection )
434+ private RepositoryNode FindNodeRecursive ( string id , AvaloniaList < RepositoryNode > collection )
439435 {
440436 foreach ( var node in collection )
441437 {
@@ -450,7 +446,7 @@ private static RepositoryNode FindNodeRecursive(string id, AvaloniaList<Reposito
450446 return null ;
451447 }
452448
453- private static AvaloniaList < RepositoryNode > FindNodeContainer ( RepositoryNode node , AvaloniaList < RepositoryNode > collection )
449+ private AvaloniaList < RepositoryNode > FindNodeContainer ( RepositoryNode node , AvaloniaList < RepositoryNode > collection )
454450 {
455451 foreach ( var sub in collection )
456452 {
@@ -465,7 +461,7 @@ private static AvaloniaList<RepositoryNode> FindNodeContainer(RepositoryNode nod
465461 return null ;
466462 }
467463
468- private static bool RemoveNodeRecursive ( RepositoryNode node , AvaloniaList < RepositoryNode > collection )
464+ private bool RemoveNodeRecursive ( RepositoryNode node , AvaloniaList < RepositoryNode > collection )
469465 {
470466 if ( collection . Contains ( node ) )
471467 {
0 commit comments