public void AddFile(string filePath, string fileDestinationLocation) { ModulePackageFile file = CreatePackageFile(filePath, fileDestinationLocation); _otherFiles.Add(file); _directory.AddFile(file); }
// Assumes reader is positioned at that file. private ModulePackageFile ReadFile(ModulePackageDirectoryEntry entry) { ModulePackageFile file; byte[] fileBytes; fileBytes = new byte[entry.FileSize]; _reader.Read(fileBytes, 0, (int)entry.FileSize); file = new ModulePackageFile(); file.FileName = entry.FileName; file.FileLocation = _directory.LocationTable[entry.FileLocationIndex]; file.FileContents = fileBytes; return(file); }
private ModulePackageDirectoryEntry CreateEntry(ModulePackageFile file) { ModulePackageDirectoryEntry entry = new ModulePackageDirectoryEntry(); int fileLocationIndex = LocationTable.IndexOf(file.FileLocation); if (fileLocationIndex == -1) { fileLocationIndex = LocationTable.Count; LocationTable.Add(file.FileLocation); } entry.FileLocationIndex = (byte)fileLocationIndex; entry.FileName = file.FileName; entry.FileSize = (uint)file.FileContents.Length; return(entry); }
public void AddFile(ModulePackageFile file) { OtherEntries.Add(CreateEntry(file)); }
public void SetModuleEntry(ModulePackageFile file) { ModuleEntry = CreateEntry(file); }
public void SetModuleFile(string filePath, string fileDestinationLocation) { _moduleFile = CreatePackageFile(filePath, fileDestinationLocation); _directory.SetModuleEntry(_moduleFile); }