public GPakReader(string filename) { PackagePath = GPakUtil.GetPackageFileName(filename); PackageName = Path.GetFileName(PackagePath); if (File.Exists(PackagePath)) { PackageFileSize = (int)new FileInfo(PackagePath).Length; _packageFileReader = new BinaryReader(File.Open(PackagePath, System.IO.FileMode.Open)); if (IsHeaderValid()) { _entryTable = new Dictionary <string, GPakEntry>(); ReadEntries(); } else { throw new Exception("Invalid Header"); } } else { throw new FileNotFoundException(PackagePath + " does not found."); } }
public GPakWriter(string filename) { _packageFilename = GPakUtil.GetPackageFileName(filename); bool doesFileExist = File.Exists(_packageFilename); StartWriting(); if (!doesFileExist) { WriteHeader(); } EndWriting(); }