Example #1
0
        private void LoadArchives()
        {
            Console.WriteLine("Indexing files...");
            _archiveTable = new Dictionary <string, Archive>();
            _fileTable    = new Dictionary <string, List <Archive> >();
            var files = Directory.EnumerateFiles(LeagueLocations.GetArchivePath(_leaguePath), "*.raf", SearchOption.AllDirectories).ToArray();

            for (int i = 0; i < files.Length; i++)
            {
                var archive = _reader.ReadArchive(files[i]);
                _archiveTable[archive.FilePath] = archive;
                foreach (var kvp in archive.Files)
                {
                    if (!_fileTable.ContainsKey(kvp.Key))
                    {
                        _fileTable[kvp.Key] = new List <Archive>();
                        _fileTable[kvp.Key].Add(archive);
                    }
                    else if (_indexTable.ContainsKey(kvp.Key) && _indexTable[kvp.Key].ArchiveId == archive.GetManagerIndex())
                    {
                        _fileTable[kvp.Key].Add(archive);
                    }
                }
            }
        }
 public BackupManager(string leaguePath)
 {
     _leaguePath   = leaguePath;
     _archivePath  = LeagueLocations.GetArchivePath(leaguePath);
     _backupPath   = LeagueLocations.GetBackupPath(leaguePath);
     _manifestPath = LeagueLocations.GetManifestPath(leaguePath);
 }