public override ArchiveFile AddFile(string filePath) { var file = new NTXFile(this, Path.GetFileName(filePath), File.ReadAllBytes(filePath)); Files.Add(file); Archive.FileList.Add(file); return(file); }
public override void Load(string filePath) { RootFolder = new NTXFolder(this); using (var fs = File.OpenRead(filePath)) using (var br = new BinaryReader(fs)) { while (br.PeekChar() >= 0) { string name = Encoding.ASCII.GetString(br.ReadBytes(64)).Split('\0')[0]; int length = br.ReadInt32(); fs.Seek(4, SeekOrigin.Current); byte[] data = br.ReadBytes(length); var newFile = new NTXFile(RootFolder as NTXFolder, name, data); RootFolder.Files.Add(newFile); FileList.Add(newFile); } } }