/// <summary> /// Reads the tables info to the archive. /// </summary> private void ReadTables() { using var mmf = MemoryMappedFile.CreateFromFile(_filepath, FileMode.Open, Mmfhash, 0, MemoryMappedFileAccess.Read); using (var vs = mmf.CreateViewStream(0, ArHeader.SIZE, MemoryMappedFileAccess.Read)) { using var br = new BinaryReader(vs); _header = new ArHeader(br); } using (var vs = mmf.CreateViewStream((long)_header.Tableoffset, (long)_header.Tablesize, MemoryMappedFileAccess.Read)) { using var br = new BinaryReader(vs); _table = new ArTable(br); } foreach (var(key, value) in _table.FileInfo) { if (!HashDictionary.ContainsKey(value.NameHash64)) { HashDictionary.Add(value.NameHash64, key); } else { Console.WriteLine($"File already added in Archive {this._filepath}: hash {value.NameHash64}, idx {key}"); } } _filesCount = _table.Table1count; }
/// <summary> /// Reads the tables info to the archive. /// </summary> private void ReadTables() { using var mmf = MemoryMappedFile.CreateFromFile(Filepath, FileMode.Open, Mmfhash, 0, MemoryMappedFileAccess.Read); using (var vs = mmf.CreateViewStream(0, ArHeader.SIZE, MemoryMappedFileAccess.Read)) { _header = new ArHeader(new BinaryReader(vs)); } using (var vs = mmf.CreateViewStream((long)_header.Tableoffset, (long)_header.Tablesize, MemoryMappedFileAccess.Read)) { _table = new ArTable(new BinaryReader(vs)); } }