示例#1
0
        private async Task <IReadOnlyList <LapTimeEntry> > ReadAcNewEntriesAsync()
        {
            await TracksManager.Instance.EnsureLoadedAsync();

            InitializeAcNew();
            return(await Task.Run(() => {
                using (var reader = new AcLapTimesNewReader(FileUtils.GetDocumentsDirectory(), this)) {
                    return _acStorageNew.GetLapTimesList(reader);
                }
            }));
        }
示例#2
0
        public async Task ExportAsync(string key)
        {
            ILapTimesReader reader;

            if (key == SourceId)
            {
                InitializeCm();
                await Task.Run(() => {
                    foreach (var entry in Entries.ToList())
                    {
                        _cmStorage.Set(entry);
                    }
                });

                return;
            }
            else if (key == AcLapTimesNewReader.SourceId)
            {
                reader = new AcLapTimesNewReader(FileUtils.GetDocumentsDirectory(), this);
            }
            else if (key == SidekickLapTimesReader.SourceId)
            {
                var sidekickDirectory = Path.Combine(FileUtils.GetPythonAppsDirectory(AcRootDirectory.Instance.RequireValue), "Sidekick");
                reader = new SidekickLapTimesReader(sidekickDirectory, this);
            }
            else if (key == RaceEssentialsLapTimesReader.SourceId)
            {
                var sidekickDirectory = Path.Combine(FileUtils.GetPythonAppsDirectory(AcRootDirectory.Instance.RequireValue), "RaceEssentials");
                reader = new RaceEssentialsLapTimesReader(sidekickDirectory, this);
            }
            else
            {
                throw new NotSupportedException();
            }

            await Task.Run(() => reader.Export(Entries));
        }