protected override void Parse(Stream s) { BinaryReader r = new BinaryReader(s); tag = r.ReadUInt32(); if (checking) { if (tag != (uint)FOURCC("FTPT")) { throw new InvalidDataException(String.Format("Invalid Tag read: '{0}'; expected: 'FTPT'; at 0x{1:X8}", FOURCC(tag), s.Position)); } } version = r.ReadUInt32(); instance = r.ReadUInt64(); type = r.ReadUInt32(); group = r.ReadUInt32(); if (type != 0) { minHeightOverrides = new PolygonHeightOverrideList(OnRCOLChanged, s); maxHeightOverrides = new PolygonHeightOverrideList(OnRCOLChanged, s); footprintAreas = new AreaList(OnRCOLChanged, version); slotAreas = new AreaList(OnRCOLChanged, version); } else { minHeightOverrides = new PolygonHeightOverrideList(OnRCOLChanged); maxHeightOverrides = new PolygonHeightOverrideList(OnRCOLChanged); footprintAreas = new AreaList(OnRCOLChanged, s, version); slotAreas = new AreaList(OnRCOLChanged, s, version); maxHeight = r.ReadSingle(); minHeight = r.ReadSingle(); } }
public FTPT(int APIversion, EventHandler handler, FTPT basis) : base(APIversion, handler, null) { this.version = basis.version; this.instance = basis.instance; this.type = basis.type; this.group = basis.group; this.minHeightOverrides = basis.minHeightOverrides == null ? null : new PolygonHeightOverrideList(OnRCOLChanged, basis.minHeightOverrides); this.maxHeightOverrides = basis.maxHeightOverrides == null ? null : new PolygonHeightOverrideList(OnRCOLChanged, basis.maxHeightOverrides); this.footprintAreas = basis.footprintAreas == null ? null : new AreaList(OnRCOLChanged, basis.footprintAreas, version); this.slotAreas = basis.slotAreas == null ? null : new AreaList(OnRCOLChanged, basis.slotAreas, version); this.maxHeight = basis.maxHeight; this.minHeight = basis.minHeight; }
public override Stream UnParse() { MemoryStream ms = new MemoryStream(); BinaryWriter w = new BinaryWriter(ms); w.Write(tag); w.Write(version); w.Write(instance); w.Write(type); w.Write(group); if (type != 0) { if (minHeightOverrides == null) { minHeightOverrides = new PolygonHeightOverrideList(OnRCOLChanged); } minHeightOverrides.UnParse(ms); if (maxHeightOverrides == null) { maxHeightOverrides = new PolygonHeightOverrideList(OnRCOLChanged); } maxHeightOverrides.UnParse(ms); } else { if (footprintAreas == null) { footprintAreas = new AreaList(OnRCOLChanged, version); } footprintAreas.UnParse(ms); if (slotAreas == null) { slotAreas = new AreaList(OnRCOLChanged, version); } slotAreas.UnParse(ms); w.Write(maxHeight); w.Write(minHeight); } return(ms); }