Example #1
0
        private void RunPopulate(CancellationToken ct)
        {
            while (m_populateQueue !.TryDequeue(out var info))
            {
                if (ct.IsCancellationRequested)
                {
                    ct.ThrowIfCancellationRequested();
                }

                Logger.Log($"Adding { info.FilePath } to the database");
                //if (ChartDatabaseService.ContainsSet(info)) continue;
                ChartDatabaseService.AddSet(info);
            }
        }
Example #2
0
        private void AddSetFileRelative(string relPath)
        {
            if (PathL.IsFullPath(relPath))
            {
                throw new ArgumentException($"{ nameof(AddSetFileRelative) } expects a relative path.");
            }

            string setDir  = Directory.GetParent(relPath).FullName;
            string setFile = Path.GetFileName(relPath);

            Debug.Assert(Path.Combine(setDir, setFile) == relPath);

            var setSerializer = new ChartSetSerializer(ChartDatabaseService.ChartsDirectory);
            var setInfo       = setSerializer.LoadFromFile(setDir, setFile);

            ChartDatabaseService.AddSet(setInfo);
        }