public GgpkFile(FileRecord fileRecord, GgpkDirectory parent, GgpkFileSystem root) { Parent = parent; Name = fileRecord.Name; Size = fileRecord.DataLength; _offset = fileRecord.DataOffset; _root = root; }
internal GgpkDirectory(DirectoryRecord record, IDirectory parent, GgpkFileSystem root) { Parent = parent; Root = root; Name = record.Name; var records = record.Entries.ToRecords(root.Records).ToArray(); _directories = records.OfType <DirectoryRecord>() .Select(c => new GgpkDirectory(c, this, root)).ToList <IDirectory>(); _files = records.OfType <FileRecord>().Select(c => new GgpkFile(c, this, root)) .ToList <IFile>(); _indexDict = new Lazy <Dictionary <string, IFileSystemEntry> >(() => { return(_directories.Union(_files.Cast <IFileSystemEntry>()) .ToDictionary(c => c.Name)); }); }