public void Load(ProjectReader reader) { int magic = reader.ReadInt32(); if (magic != GMProject.GMMagic) { throw new Exception("Invalid GEX magic, got " + magic); } Version = reader.ReadInt32(); if (Version != 701) { throw new Exception("Invalid GEX version, got " + Version); } Seed = reader.ReadInt32(); Lookup(Seed); // Decrypt GED/DAT var gedStream = new MemoryStream(); gedStream.WriteByte((byte)reader.ReadByte()); // first byte is never encrypted. while (true) { int bb = reader.ReadByte(); if (bb < 0) { break; } // non-additive mode. gedStream.WriteByte(GMKrypt[1][(byte)bb]); } gedStream.Seek(0, SeekOrigin.Begin); var gedReader = new ProjectReader(gedStream); Package = new GED(); Package.Load(gedReader); RawDATs = new List <byte[]>(Package.Files.Count); for (int i = 0; i < Package.Files.Count; i++) { //if (Package.Files[i].Kind != GEDFile.GEDFileKind.ActionLib) // ??????????????????????????? RawDATs.Add(gedReader.ReadCompressedStream()); } gedStream.Dispose(); gedReader.Dispose(); }
public GMFont(ProjectReader reader) { Name = reader.ReadString(); LastChanged = reader.ReadDate(); Version = reader.ReadInt32(); if (Version != 800) { throw new InvalidDataException("This library only supports GM8 files."); } FontName = reader.ReadString(); Size = reader.ReadInt32(); Bold = reader.ReadBoolean(); Italic = reader.ReadBoolean(); RangeMin = reader.ReadInt16(); GDICharset = reader.ReadByte(); AA = reader.ReadByte(); RangeMax = reader.ReadInt32(); }