/// <summary> /// Reading ctor /// </summary> internal Value(ResReader reader) { var size = reader.ReadUInt16(); reader.Skip(1); // res0 type = (Types)reader.ReadByte(); data = reader.ReadInt32(); }
/// <summary> /// Read ctor /// </summary> internal Type(TypeSpec parent, ResReader reader) : base(reader, ChunkTypes.RES_TABLE_TYPE_TYPE) { this.parent = parent; var id = reader.ReadByte(); reader.Skip(3); // reserved if (id != parent.Id) { throw new IOException("Type id (" + id + ") " + "doesn't match parent id (" + parent.Id + ")."); } var entryCount = reader.ReadInt32(); if (entryCount != parent.EntryCount) { throw new IOException(string.Format("Type entry count ({0}) doesn't match parent entry count ({1})", entryCount, parent.EntryCount)); } var entriesStart = reader.ReadInt32(); configuration = new Configuration(reader); // Data var offsets = reader.ReadIntArray(entryCount); var dataSize = (Size - entriesStart); if ((dataSize % 4) != 0) { throw new IOException("Type data size (" + dataSize + ") is not multiple of 4."); } for (var i = 0; i < entryCount; i++ ) { if (offsets[i] != NO_ENTRY) { var actualOffset = reader.Position; var instance = EntryInstance.Read(this, reader); parent.GetEntry(i).Add(instance); } } }
/// <summary> /// Reading ctor /// </summary> internal Value(ResReader reader) { var size = reader.ReadUInt16(); reader.Skip(1); // res0 type = (Types)reader.ReadByte(); data = reader.ReadInt32(); }
/// <summary> /// Reader ctor /// </summary> internal TypeSpec(Package parent, ResReader reader) : base(reader, ChunkTypes.RES_TABLE_TYPE_SPEC_TYPE) { this.parent = parent; id = reader.ReadByte(); reader.Skip(3); // reserved var entryCount = reader.ReadInt32(); var flags = reader.ReadIntArray(entryCount).ToList(); entries.AddRange(flags.Select(x => new Entry(this, x))); }
/// <summary> /// Reader ctor /// </summary> internal TypeSpec(Package parent, ResReader reader) : base(reader, ChunkTypes.RES_TABLE_TYPE_SPEC_TYPE) { this.parent = parent; id = reader.ReadByte(); reader.Skip(3); // reserved var entryCount = reader.ReadInt32(); var flags = reader.ReadIntArray(entryCount).ToList(); entries.AddRange(flags.Select(x => new Entry(this, x))); }
/// <summary> /// Read ctor /// </summary> internal Type(TypeSpec parent, ResReader reader) : base(reader, ChunkTypes.RES_TABLE_TYPE_TYPE) { this.parent = parent; var id = reader.ReadByte(); reader.Skip(3); // reserved if (id != parent.Id) { throw new IOException("Type id (" + id + ") " + "doesn't match parent id (" + parent.Id + ")."); } var entryCount = reader.ReadInt32(); if (entryCount != parent.EntryCount) { throw new IOException(string.Format("Type entry count ({0}) doesn't match parent entry count ({1})", entryCount, parent.EntryCount)); } var entriesStart = reader.ReadInt32(); configuration = new Configuration(reader); // Data var offsets = reader.ReadIntArray(entryCount); var dataSize = (Size - entriesStart); if ((dataSize % 4) != 0) { throw new IOException("Type data size (" + dataSize + ") is not multiple of 4."); } for (var i = 0; i < entryCount; i++) { if (offsets[i] != NO_ENTRY) { var actualOffset = reader.Position; var instance = EntryInstance.Read(this, reader); parent.GetEntry(i).Add(instance); } } }