Exemplo n.º 1
0
        private async Task LoadArchiveAsync()
        {
            Logger.Verbose("ManagerController.LoadArchiveAsync:Start");
            _managerService.ClearArchive();

            if (_shellService.Settings.LoadArchive || _shellService.Settings.Collections.Any(x => x.OfflineDuplicateCheck && !x.IsOnline.Value))
            {
                foreach (var collection in _shellService.Settings.Collections)
                {
                    if (!_shellService.Settings.LoadArchive && collection.Id != 0)
                    {
                        continue;
                    }

                    string path = GetIndexFolderPath(collection.Id);
                    if (!Directory.Exists(path))
                    {
                        continue;
                    }

                    path = Path.Combine(path, "Archive");
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }

                    List <string> folders = new List <string>(Directory.GetDirectories(path, "*", SearchOption.AllDirectories));
                    folders.Insert(0, path);

                    foreach (var folder in folders)
                    {
                        if (SkipFolder(collection.Id, folder, _shellService.Settings.LoadArchive))
                        {
                            continue;
                        }

                        IReadOnlyList <IFiles> archiveDatabases = await GetIFilesAsync(folder);

                        foreach (IFiles archiveDB in archiveDatabases)
                        {
                            _managerService.AddArchive(archiveDB);
                        }
                    }
                }
            }

            BlogManagerFinishedLoadingArchive?.Invoke(this, EventArgs.Empty);
            Logger.Verbose("ManagerController.LoadArchiveAsync:End");
        }
Exemplo n.º 2
0
        private async Task LoadArchiveAsync()
        {
            Logger.Verbose("ManagerController.LoadArchiveAsync:Start");
            _managerService.ClearArchive();

            if (_shellService.Settings.LoadArchive)
            {
                string path = Path.Combine(_shellService.Settings.DownloadLocation, "Index", "Archive");
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                IReadOnlyList <IFiles> archiveDatabases = await GetIFilesAsync(path);

                foreach (IFiles archiveDB in archiveDatabases)
                {
                    _managerService.AddArchive(archiveDB);
                }
            }

            BlogManagerFinishedLoadingArchive?.Invoke(this, EventArgs.Empty);
            Logger.Verbose("ManagerController.LoadArchiveAsync:End");
        }