private void SaveZoneSetTable(IZoneSet set, StructureValueCollection tagValues, string countName, string addressName, TagBlockCache <int> cache, IStream stream) { SaveZoneSetTable(new[] { set }, tagValues, countName, addressName, cache, stream); }
private void SaveZoneSetTable(IZoneSet set, StructureValueCollection tagValues, string countName, string addressName, ReflexiveCache<int> cache, IStream stream) { SaveZoneSetTable(new[] {set}, tagValues, countName, addressName, cache, stream); }
private void SaveZoneSetTable(IZoneSet[] sets, StructureValueCollection tagValues, string countName, string addressName, ReflexiveCache<int> cache, IStream stream) { if (!tagValues.HasInteger(countName) || !tagValues.HasInteger(addressName)) return; var count = (int) tagValues.GetInteger(countName); if (count != sets.Length) throw new InvalidOperationException("Zone set count does not match"); uint address = tagValues.GetInteger(addressName); StructureLayout layout = _buildInfo.Layouts.GetLayout("zone set definition"); List<StructureValueCollection> entries = sets.Select(set => ((FourthGenZoneSet) set).Serialize(stream, _allocator, cache)).ToList(); ReflexiveWriter.WriteReflexive(entries, address, layout, _metaArea, stream); }
private void Load(IReader reader) { StructureValueCollection tagValues = _gestalt.LoadTag(reader); // Global, unattached, disc-forbidden, and disc-always-streaming usually only have one entry GlobalZoneSet = ReadZoneSetTable(tagValues, "number of global zone sets", "global zone set table address", reader).FirstOrDefault(); UnattachedZoneSet = ReadZoneSetTable(tagValues, "number of unattached zone sets", "unattached zone set table address", reader).FirstOrDefault(); DiscForbiddenZoneSet = ReadZoneSetTable(tagValues, "number of disc forbidden zone sets", "disc forbidden zone set table address", reader).FirstOrDefault(); DiscAlwaysStreamingZoneSet = ReadZoneSetTable(tagValues, "number of disc always streaming zone sets", "disc always streaming zone set table address", reader).FirstOrDefault(); // Everything else needs to be an array GeneralZoneSets = ReadZoneSetTable(tagValues, "number of general zone sets", "general zone set table address", reader).ToArray(); BSPZoneSets = ReadZoneSetTable(tagValues, "number of bsp zone sets", "bsp zone set table address", reader).ToArray(); BSPZoneSets2 = ReadZoneSetTable(tagValues, "number of bsp 2 zone sets", "bsp 2 zone set table address", reader).ToArray(); BSPZoneSets3 = ReadZoneSetTable(tagValues, "number of bsp 3 zone sets", "bsp 3 zone set table address", reader).ToArray(); CinematicZoneSets = ReadZoneSetTable(tagValues, "number of cinematic zone sets", "cinematic zone set table address", reader).ToArray(); CustomZoneSets = ReadZoneSetTable(tagValues, "number of custom zone sets", "custom zone set table address", reader).ToArray(); }