public GMDataReader(Stream stream, string path) : base(stream) { Data = new GMData(); // Get hash for comparing later using (SHA1Managed sha1 = new SHA1Managed()) Data.Hash = sha1.ComputeHash(Buffer); Data.Length = Buffer.Length; // Get directory of the data file for later usage if (path != null) { Data.Directory = Path.GetDirectoryName(path); } Warnings = new List <GMWarning>(); PointerOffsets = new Dictionary <int, GMSerializable>(); Instructions = new Dictionary <int, GMCode.Bytecode.Instruction>(); // Parse the root chunk of the file, FORM if (ReadChars(4) != "FORM") { throw new GMException("Root chunk is not \"FORM\"; invalid file."); } Data.FORM = new GMChunkFORM(); Data.FORM.Unserialize(this); }
public GMDataWriter(GMData data, Stream stream, string path, int baseSize = 1024 * 1024 * 32) : base(stream, baseSize) { Data = data; Warnings = new List <GMWarning>(); // Get directory of the data file for later usage if (path != null) { Data.Directory = Path.GetDirectoryName(path); } }
public GMDataReader(Stream stream, string path) : base(stream) { Data = new GMData(); Data.WorkingBuffer = Buffer; // Get hash for comparing later using (SHA1Managed sha1 = new SHA1Managed()) Data.Hash = sha1.ComputeHash(Buffer); Data.Length = Buffer.Length; // Get directory of the data file for later usage if (path != null) { Data.Directory = Path.GetDirectoryName(path); Data.Filename = Path.GetFileName(path); } Warnings = new List <GMWarning>(); PointerOffsets = new Dictionary <int, GMSerializable>(65536); Instructions = new Dictionary <int, GMCode.Bytecode.Instruction>(1024 * 1024); }