@@ -131,6 +131,9 @@ public IEnvironment Environment
131
131
132
132
abstract class ManagedCacheBase < T > : ScriptObjectSingleton < T > where T : ScriptableObject , IManagedCache
133
133
{
134
+ [ SerializeField ] private string lastUpdatedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
135
+ [ SerializeField ] private string lastVerifiedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
136
+ [ SerializeField ] private string initializedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
134
137
[ NonSerialized ] private DateTimeOffset ? lastUpdatedAtValue ;
135
138
[ NonSerialized ] private DateTimeOffset ? lastVerifiedAtValue ;
136
139
[ NonSerialized ] private DateTimeOffset ? initializedAtValue ;
@@ -207,15 +210,26 @@ protected void SaveData(DateTimeOffset now, bool isUpdated)
207
210
}
208
211
209
212
public abstract TimeSpan DataTimeout { get ; }
210
- public abstract string LastUpdatedAtString { get ; protected set ; }
211
- public abstract string LastVerifiedAtString { get ; protected set ; }
212
- public abstract string InitializedAtString { get ; protected set ; }
213
+ public string LastUpdatedAtString
214
+ {
215
+ get { return lastUpdatedAtString ; }
216
+ protected set { lastUpdatedAtString = value ; }
217
+ }
218
+
219
+ public string LastVerifiedAtString
220
+ {
221
+ get { return lastVerifiedAtString ; }
222
+ protected set { lastVerifiedAtString = value ; }
223
+ }
213
224
214
- public bool IsInitialized
225
+ public string InitializedAtString
215
226
{
216
- get { return ApplicationCache . Instance . FirstRunAt <= InitializedAt ; }
227
+ get { return initializedAtString ; }
228
+ protected set { initializedAtString = value ; }
217
229
}
218
230
231
+ public bool IsInitialized { get { return ApplicationCache . Instance . FirstRunAt <= InitializedAt ; } }
232
+
219
233
public DateTimeOffset LastUpdatedAt
220
234
{
221
235
get
@@ -323,14 +337,12 @@ public class ArrayContainer<T>
323
337
}
324
338
325
339
[ Serializable ]
326
- public class StringArrayContainer : ArrayContainer < string >
327
- {
328
- }
340
+ public class StringArrayContainer : ArrayContainer < string >
341
+ { }
329
342
330
343
[ Serializable ]
331
344
public class ConfigBranchArrayContainer : ArrayContainer < ConfigBranch >
332
- {
333
- }
345
+ { }
334
346
335
347
[ Serializable ]
336
348
class RemoteConfigBranchDictionary : Dictionary < string , Dictionary < string , ConfigBranch > > , ISerializationCallbackReceiver , IRemoteConfigBranchDictionary
@@ -348,8 +360,8 @@ public RemoteConfigBranchDictionary(Dictionary<string, Dictionary<string, Config
348
360
{
349
361
Add ( pair . Key , pair . Value . ToDictionary ( valuePair => valuePair . Key , valuePair => valuePair . Value ) ) ;
350
362
}
351
- }
352
-
363
+ }
364
+
353
365
// save the dictionary to lists
354
366
public void OnBeforeSerialize ( )
355
367
{
@@ -435,9 +447,6 @@ public ConfigRemoteDictionary(IDictionary<string, ConfigRemote> dictionary)
435
447
[ Location ( "cache/repoinfo.yaml" , LocationAttribute . Location . LibraryFolder ) ]
436
448
sealed class RepositoryInfoCache : ManagedCacheBase < RepositoryInfoCache > , IRepositoryInfoCache
437
449
{
438
- [ SerializeField ] private string lastUpdatedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
439
- [ SerializeField ] private string lastVerifiedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
440
- [ SerializeField ] private string firstInitializedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
441
450
[ SerializeField ] private GitRemote gitRemote ;
442
451
[ SerializeField ] private GitBranch gitBranch ;
443
452
@@ -492,24 +501,6 @@ public GitBranch? CurentGitBranch
492
501
}
493
502
}
494
503
495
- public override string LastUpdatedAtString
496
- {
497
- get { return lastUpdatedAtString ; }
498
- protected set { lastUpdatedAtString = value ; }
499
- }
500
-
501
- public override string LastVerifiedAtString
502
- {
503
- get { return lastVerifiedAtString ; }
504
- protected set { lastVerifiedAtString = value ; }
505
- }
506
-
507
- public override string InitializedAtString
508
- {
509
- get { return firstInitializedAtString ; }
510
- protected set { firstInitializedAtString = value ; }
511
- }
512
-
513
504
public override TimeSpan DataTimeout
514
505
{
515
506
get { return TimeSpan . MaxValue ; }
@@ -519,10 +510,6 @@ public override TimeSpan DataTimeout
519
510
[ Location ( "cache/branches.yaml" , LocationAttribute . Location . LibraryFolder ) ]
520
511
sealed class BranchCache : ManagedCacheBase < BranchCache > , IBranchCache
521
512
{
522
- [ SerializeField ] private string lastUpdatedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
523
- [ SerializeField ] private string lastVerifiedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
524
- [ SerializeField ] private string initializedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
525
-
526
513
[ SerializeField ] private ConfigBranch gitConfigBranch ;
527
514
[ SerializeField ] private ConfigRemote gitConfigRemote ;
528
515
@@ -609,11 +596,6 @@ public GitBranch[] LocalBranches
609
596
}
610
597
}
611
598
612
- public ILocalConfigBranchDictionary LocalConfigBranches
613
- {
614
- get { return localConfigBranches ; }
615
- }
616
-
617
599
public GitBranch [ ] RemoteBranches
618
600
{
619
601
get { return remoteBranches ; }
@@ -638,11 +620,6 @@ public GitBranch[] RemoteBranches
638
620
}
639
621
}
640
622
641
- public IRemoteConfigBranchDictionary RemoteConfigBranches
642
- {
643
- get { return remoteConfigBranches ; }
644
- }
645
-
646
623
public GitRemote [ ] Remotes
647
624
{
648
625
get { return remotes ; }
@@ -667,11 +644,6 @@ public GitRemote[] Remotes
667
644
}
668
645
}
669
646
670
- public IConfigRemoteDictionary ConfigRemotes
671
- {
672
- get { return configRemotes ; }
673
- }
674
-
675
647
public void RemoveLocalBranch ( string branch )
676
648
{
677
649
if ( LocalConfigBranches . ContainsKey ( branch ) )
@@ -710,7 +682,7 @@ public void AddRemoteBranch(string remote, string branch)
710
682
if ( ! branchList . ContainsKey ( branch ) )
711
683
{
712
684
var now = DateTimeOffset . Now ;
713
- branchList . Add ( branch , new ConfigBranch ( branch , ConfigRemotes [ remote ] ) ) ;
685
+ branchList . Add ( branch , new ConfigBranch ( branch , ConfigRemotes [ remote ] ) ) ;
714
686
Logger . Trace ( "AddRemoteBranch {0} remote:{1} branch:{2} " , now , remote , branch ) ;
715
687
SaveData ( now , true ) ;
716
688
}
@@ -765,36 +737,15 @@ public void SetLocals(Dictionary<string, ConfigBranch> branchDictionary)
765
737
SaveData ( now , true ) ;
766
738
}
767
739
768
- public override string LastUpdatedAtString
769
- {
770
- get { return lastUpdatedAtString ; }
771
- protected set { lastUpdatedAtString = value ; }
772
- }
773
-
774
- public override string LastVerifiedAtString
775
- {
776
- get { return lastVerifiedAtString ; }
777
- protected set { lastVerifiedAtString = value ; }
778
- }
779
-
780
- public override string InitializedAtString
781
- {
782
- get { return initializedAtString ; }
783
- protected set { initializedAtString = value ; }
784
- }
785
-
786
- public override TimeSpan DataTimeout
787
- {
788
- get { return TimeSpan . MaxValue ; }
789
- }
740
+ public ILocalConfigBranchDictionary LocalConfigBranches { get { return localConfigBranches ; } }
741
+ public IRemoteConfigBranchDictionary RemoteConfigBranches { get { return remoteConfigBranches ; } }
742
+ public IConfigRemoteDictionary ConfigRemotes { get { return configRemotes ; } }
743
+ public override TimeSpan DataTimeout { get { return TimeSpan . MaxValue ; } }
790
744
}
791
745
792
746
[ Location ( "cache/gitlog.yaml" , LocationAttribute . Location . LibraryFolder ) ]
793
747
sealed class GitLogCache : ManagedCacheBase < GitLogCache > , IGitLogCache
794
748
{
795
- [ SerializeField ] private string lastUpdatedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
796
- [ SerializeField ] private string lastVerifiedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
797
- [ SerializeField ] private string initializedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
798
749
[ SerializeField ] private List < GitLogEntry > log = new List < GitLogEntry > ( ) ;
799
750
800
751
public GitLogCache ( ) : base ( true )
@@ -824,36 +775,12 @@ public List<GitLogEntry> Log
824
775
}
825
776
}
826
777
827
- public override string LastUpdatedAtString
828
- {
829
- get { return lastUpdatedAtString ; }
830
- protected set { lastUpdatedAtString = value ; }
831
- }
832
-
833
- public override string LastVerifiedAtString
834
- {
835
- get { return lastVerifiedAtString ; }
836
- protected set { lastVerifiedAtString = value ; }
837
- }
838
-
839
- public override string InitializedAtString
840
- {
841
- get { return initializedAtString ; }
842
- protected set { initializedAtString = value ; }
843
- }
844
-
845
- public override TimeSpan DataTimeout
846
- {
847
- get { return TimeSpan . FromMinutes ( 1 ) ; }
848
- }
778
+ public override TimeSpan DataTimeout { get { return TimeSpan . FromMinutes ( 1 ) ; } }
849
779
}
850
780
851
781
[ Location ( "cache/gittrackingstatus.yaml" , LocationAttribute . Location . LibraryFolder ) ]
852
782
sealed class GitTrackingStatusCache : ManagedCacheBase < GitTrackingStatusCache > , IGitTrackingStatusCache
853
783
{
854
- [ SerializeField ] private string lastUpdatedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
855
- [ SerializeField ] private string lastVerifiedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
856
- [ SerializeField ] private string initializedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
857
784
[ SerializeField ] private int ahead ;
858
785
[ SerializeField ] private int behind ;
859
786
@@ -908,36 +835,12 @@ public int Behind
908
835
}
909
836
}
910
837
911
- public override string LastUpdatedAtString
912
- {
913
- get { return lastUpdatedAtString ; }
914
- protected set { lastUpdatedAtString = value ; }
915
- }
916
-
917
- public override string LastVerifiedAtString
918
- {
919
- get { return lastVerifiedAtString ; }
920
- protected set { lastVerifiedAtString = value ; }
921
- }
922
-
923
- public override string InitializedAtString
924
- {
925
- get { return initializedAtString ; }
926
- protected set { initializedAtString = value ; }
927
- }
928
-
929
- public override TimeSpan DataTimeout
930
- {
931
- get { return TimeSpan . FromMinutes ( 1 ) ; }
932
- }
838
+ public override TimeSpan DataTimeout { get { return TimeSpan . FromMinutes ( 1 ) ; } }
933
839
}
934
840
935
- [ Location ( "cache/gitstatusentries.yaml" , LocationAttribute . Location . LibraryFolder ) ]
841
+ [ Location ( "cache/gitstatusentries.yaml" , LocationAttribute . Location . LibraryFolder ) ]
936
842
sealed class GitStatusEntriesCache : ManagedCacheBase < GitStatusEntriesCache > , IGitStatusEntriesCache
937
843
{
938
- [ SerializeField ] private string lastUpdatedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
939
- [ SerializeField ] private string lastVerifiedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
940
- [ SerializeField ] private string initializedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
941
844
[ SerializeField ] private List < GitStatusEntry > entries = new List < GitStatusEntry > ( ) ;
942
845
943
846
public GitStatusEntriesCache ( ) : base ( true )
@@ -967,36 +870,12 @@ public List<GitStatusEntry> Entries
967
870
}
968
871
}
969
872
970
- public override string LastUpdatedAtString
971
- {
972
- get { return lastUpdatedAtString ; }
973
- protected set { lastUpdatedAtString = value ; }
974
- }
975
-
976
- public override string LastVerifiedAtString
977
- {
978
- get { return lastVerifiedAtString ; }
979
- protected set { lastVerifiedAtString = value ; }
980
- }
981
-
982
- public override string InitializedAtString
983
- {
984
- get { return initializedAtString ; }
985
- protected set { initializedAtString = value ; }
986
- }
987
-
988
- public override TimeSpan DataTimeout
989
- {
990
- get { return TimeSpan . FromMinutes ( 1 ) ; }
991
- }
873
+ public override TimeSpan DataTimeout { get { return TimeSpan . FromMinutes ( 1 ) ; } }
992
874
}
993
875
994
876
[ Location ( "cache/gitlocks.yaml" , LocationAttribute . Location . LibraryFolder ) ]
995
877
sealed class GitLocksCache : ManagedCacheBase < GitLocksCache > , IGitLocksCache
996
878
{
997
- [ SerializeField ] private string lastUpdatedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
998
- [ SerializeField ] private string lastVerifiedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
999
- [ SerializeField ] private string initializedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
1000
879
[ SerializeField ] private List < GitLock > gitLocks = new List < GitLock > ( ) ;
1001
880
1002
881
public GitLocksCache ( ) : base ( true )
@@ -1026,41 +905,17 @@ public List<GitLock> GitLocks
1026
905
}
1027
906
}
1028
907
1029
- public override string LastUpdatedAtString
1030
- {
1031
- get { return lastUpdatedAtString ; }
1032
- protected set { lastUpdatedAtString = value ; }
1033
- }
1034
-
1035
- public override string LastVerifiedAtString
1036
- {
1037
- get { return lastVerifiedAtString ; }
1038
- protected set { lastVerifiedAtString = value ; }
1039
- }
1040
-
1041
- public override string InitializedAtString
1042
- {
1043
- get { return initializedAtString ; }
1044
- protected set { initializedAtString = value ; }
1045
- }
1046
-
1047
- public override TimeSpan DataTimeout
1048
- {
1049
- get { return TimeSpan . FromMinutes ( 1 ) ; }
1050
- }
908
+ public override TimeSpan DataTimeout { get { return TimeSpan . FromMinutes ( 1 ) ; } }
1051
909
}
1052
910
1053
911
[ Location ( "cache/gituser.yaml" , LocationAttribute . Location . LibraryFolder ) ]
1054
912
sealed class GitUserCache : ManagedCacheBase < GitUserCache > , IGitUserCache
1055
913
{
1056
- [ SerializeField ] private string lastUpdatedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
1057
- [ SerializeField ] private string lastVerifiedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
1058
- [ SerializeField ] private string initializedAtString = DateTimeOffset . MinValue . ToString ( Constants . Iso8601Format ) ;
1059
914
[ SerializeField ] private string gitName ;
1060
915
[ SerializeField ] private string gitEmail ;
1061
916
1062
917
public GitUserCache ( ) : base ( true )
1063
- { }
918
+ { }
1064
919
1065
920
public string Name
1066
921
{
@@ -1110,27 +965,6 @@ public string Email
1110
965
}
1111
966
}
1112
967
1113
- public override string LastUpdatedAtString
1114
- {
1115
- get { return lastUpdatedAtString ; }
1116
- protected set { lastUpdatedAtString = value ; }
1117
- }
1118
-
1119
- public override string LastVerifiedAtString
1120
- {
1121
- get { return lastVerifiedAtString ; }
1122
- protected set { lastVerifiedAtString = value ; }
1123
- }
1124
-
1125
- public override string InitializedAtString
1126
- {
1127
- get { return initializedAtString ; }
1128
- protected set { initializedAtString = value ; }
1129
- }
1130
-
1131
- public override TimeSpan DataTimeout
1132
- {
1133
- get { return TimeSpan . FromMinutes ( 10 ) ; }
1134
- }
968
+ public override TimeSpan DataTimeout { get { return TimeSpan . FromMinutes ( 10 ) ; } }
1135
969
}
1136
970
}
0 commit comments