示例#1
0
 private void InitializeRaceEssentials()
 {
     if (_raceEssentialsStorage != null)
     {
         return;
     }
     _raceEssentialsStorage = new LapTimesStorage(RaceEssentialsLapTimesReader.SourceId);
 }
示例#2
0
 private void InitializeAcNew()
 {
     if (_acStorageNew != null)
     {
         return;
     }
     _acStorageNew = new LapTimesStorage(AcLapTimesNewReader.SourceId);
 }
示例#3
0
 private void InitializeSidekick()
 {
     if (_sidekickStorage != null)
     {
         return;
     }
     _sidekickStorage = new LapTimesStorage(SidekickLapTimesReader.SourceId);
 }
示例#4
0
 private void InitializeAc()
 {
     if (_acDbStorage != null)
     {
         return;
     }
     _acDbStorage = new LapTimesStorage(AcLapTimesReader.SourceId);
 }
示例#5
0
 private void InitializeCm()
 {
     if (_cmStorage != null)
     {
         return;
     }
     _cmStorage = new LapTimesStorage(SourceId);
 }
示例#6
0
        public void ClearCache()
        {
            if (_readerFunc == null)
            {
                return;
            }
            // if reader is null, storage is the only source of lap times — don’t clear it!

            var filename = _storage.Filename;

            _storage.Dispose();
            File.Delete(filename);
            _storage = new LapTimesStorage(DisplayName, Id);
            SetDirty();
        }
示例#7
0
        public LapTimesSource([NotNull] string id, string displayName, string description, string enabledKey, bool enabledByDefault,
                              bool autoAddAllowed, [CanBeNull] Func <ILapTimesReader> readerFunc, Func <Task> preparationFunc)
        {
            _changeId = id.GetHashCode();

            _readerFunc      = readerFunc;
            _preparationFunc = preparationFunc;

            Id             = id;
            DisplayName    = displayName;
            Description    = description;
            AutoAddAllowed = autoAddAllowed;

            _storage = new LapTimesStorage(DisplayName, Id);

            _enabledKey = enabledKey;
            _autoAddKey = _enabledKey + ":autoAdd";
            var enabledByDefault1 = enabledByDefault;

            _isEnabled      = ValuesStorage.GetBool(_enabledKey, enabledByDefault1);
            _autoAddEntries = ValuesStorage.GetBool(_autoAddKey, enabledByDefault1);
        }
示例#8
0
 private void InitializeSidekick() {
     if (_sidekickStorage != null) return;
     _sidekickStorage = new LapTimesStorage(SidekickLapTimesReader.SourceId);
 }
示例#9
0
 private void InitializeAc() {
     if (_acStorage != null) return;
     _acStorage = new LapTimesStorage(AcLapTimesReader.SourceId);
 }
示例#10
0
 private void InitializeCm() {
     if (_cmStorage != null) return;
     _cmStorage = new LapTimesStorage(SourceId);
 }