Exemple #1
0
        public VPXY(EventHandler handler,
                    uint version, IEnumerable <Entry> entryList, byte tc02, BoundingBox bounds, byte[] unused, byte modular,
                    int ftptIndex,
                    IEnumerable <TGIBlock> tgiBlockList)
            : base(handler, null)
        {
            this.version = version;
            if (version != 4)
            {
                throw new ArgumentException(String.Format("Invalid Version: 0x{0:X8}; expected 0x00000004", version));
            }
            this.entryList = entryList == null ? null : new EntryList(OnRCOLChanged, entryList);
            this.tc02      = tc02;
            if (tc02 != 0x02)
            {
                throw new ArgumentException(String.Format("Invalid TC02: 0x{0:X2}; expected 0x02", tc02));
            }
            this.bounds = new BoundingBox(handler, bounds);
            this.unused = (byte[])unused.Clone();
            if (unused.Length != 4)
            {
                throw new ArgumentLengthException("Unused", 4);
            }
            this.modular = modular;
            if (modular != 0)
            {
                this.ftptIndex = ftptIndex;
            }
            this.tgiBlockList = tgiBlockList == null ? null : new TGIBlockList(OnRCOLChanged, tgiBlockList);

            if (this.entryList != null)
            {
                this.entryList.ParentTGIBlocks = this.tgiBlockList;
            }
        }
        protected override Stream UnParse()
        {
            MemoryStream s = new MemoryStream();
            BinaryWriter w = new BinaryWriter(s);

            w.Write(version);

            long pos = s.Position;

            w.Write((uint)0); // tgiOffset
            w.Write((uint)0); // tgiSize

            w.Write(nameHash);
            if (tgiBlocks == null)
            {
                tgiBlocks = new TGIBlockList(OnResourceChanged);
            }
            if (tgiIndexes == null)
            {
                tgiIndexes = new Int32IndexList(OnResourceChanged, tgiBlocks);
            }
            tgiIndexes.UnParse(s);
            w.Write(bidirectional);
            w.Write((uint)casPanelGroup);
            w.Write((uint)sort);
            w.Write(unknown1);

            tgiBlocks.UnParse(s, pos);

            return(s);
        }
Exemple #3
0
            public TypedValue Data(ComponentDataList list, TGIBlockList tgiBlocks)
            {
                if (!ComponentDataMap.ContainsKey(element))
                {
                    return(null);
                }
                if (!list.ContainsKey(ComponentDataMap[element]))
                {
                    return(null);
                }
                ComponentDataType cd = list[ComponentDataMap[element]];

                System.Reflection.PropertyInfo pi = cd.GetType().GetProperty("Data");
                if (pi == null || !pi.CanRead)
                {
                    return(null);
                }
                if (element == Component.Footprint || element == Component.Model || element == Component.Tree)
                {
                    return(new TypedValue(typeof(TGIBlock), tgiBlocks[(int)pi.GetValue(cd, null)], "X"));
                }
                else
                {
                    return(new TypedValue(pi.PropertyType, pi.GetValue(cd, null), "X"));
                }
            }
        private TGIBlockList ReadTGIBlock(BinaryReader r, EventHandler handler, TGIBlock.Order order = TGIBlock.Order.ITG)
        {
            int             count        = r.ReadInt32() / 4;
            List <TGIBlock> tgiblockList = new List <TGIBlock>(count);

            for (int i = 0; i < count; i++)
            {
                ulong instance = 0;
                uint  type     = 0;
                uint  group    = 0;
                if (order == TGIBlock.Order.ITG)
                {
                    instance = r.ReadUInt64();
                    instance = (instance << 32) | (instance >> 32); // swap instance
                    type     = r.ReadUInt32();
                    group    = r.ReadUInt32();
                }
                else if (order == TGIBlock.Order.TGI)
                {
                    type     = r.ReadUInt32();
                    group    = r.ReadUInt32();
                    instance = r.ReadUInt64();
                    instance = (instance << 32) | (instance >> 32); // swap instance
                }
                tgiblockList.Add(new TGIBlock(recommendedApiVersion, handler, type, group, instance));
            }
            TGIBlockList result = new TGIBlockList(handler, tgiblockList);

            return(result);
        }
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);

            base.Parse(s);

            this.materialList      = new WallFloorPatternMaterialList(OnResourceChanged, s);
            this.common            = new Common(requestedApiVersion, OnResourceChanged, s);
            this.patternType       = (Pattern)r.ReadUInt32();
            this.materialVPXYIndex = r.ReadUInt32();
            this.sortFlags         = (SortFlagsType)r.ReadUInt32();
            this.surfaceType       = BigEndianUnicodeString.Read(s);
            this.terrainType       = (Terrain)r.ReadUInt32();
            this.argb = r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking)
            {
                if (this.GetType().Equals(typeof(WallFloorPatternCatalogResource)) && s.Position != s.Length)
                {
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                                                                 s.Length, s.Length - s.Position, s.Position));
                }
            }
        }
Exemple #6
0
        void Parse(Stream s)
        {
            var br = new BinaryReader(s);

            this.unk01 = br.ReadUInt32();
            this.unk02 = br.ReadUInt32();
            this.unk03 = br.ReadUInt32();
            uint count1 = br.ReadUInt32();

            this.unk04 = br.ReadUInt32();
            this.self  = new TGIBlock(recommendedApiVersion, null, TGIBlock.Order.ITG, s);
            unkITGList = new TGIBlockList(null);
            for (int i = 0; i < count1; i++)
            {
                unkITGList.Add(new TGIBlock(recommendedApiVersion, null, TGIBlock.Order.ITG, s));
            }
            this.unk05     = br.ReadUInt32();
            this.unk06     = br.ReadUInt32();
            this.unk07     = br.ReadUInt32();
            this.unk08     = br.ReadUInt32();
            this.unk09     = br.ReadUInt32();
            this.unk10     = br.ReadUInt32();
            this.unkITG_01 = new TGIBlock(recommendedApiVersion, null, TGIBlock.Order.ITG, s);
            this.unkITG_02 = new TGIBlock(recommendedApiVersion, null, TGIBlock.Order.ITG, s);
            this.unkITG_03 = new TGIBlock(recommendedApiVersion, null, TGIBlock.Order.ITG, s);
            this.unk11     = br.ReadUInt32();
        }
Exemple #7
0
 public WallCatalogResource(int APIversion,
                            uint version,
                            uint unknown2,
                            Common common,
                            Wall wallType,
                            Partition partitionType,
                            PartitionFlagsType partitionFlags,
                            VerticalSpan verticalSpanType,
                            PartitionsBlockedFlagsType partitionsBlockedFlags,
                            PartitionsBlockedFlagsType adjacentPartitionsBlockedFlags,
                            PartitionTool partitionToolMode,
                            ToolUsageFlagsType toolUsageFlags,
                            uint defaultPatternIndex,
                            WallThickness wallThicknessType,
                            TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.unknown2                       = unknown2;
     this.wallType                       = wallType;
     this.partitionType                  = partitionType;
     this.partitionFlags                 = partitionFlags;
     this.verticalSpanType               = verticalSpanType;
     this.partitionsBlockedFlags         = partitionsBlockedFlags;
     this.adjacentPartitionsBlockedFlags = adjacentPartitionsBlockedFlags;
     this.partitionToolMode              = partitionToolMode;
     this.toolUsageFlags                 = toolUsageFlags;
     this.defaultPatternIndex            = defaultPatternIndex;
     this.wallThicknessType              = wallThicknessType;
 }
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);

            base.Parse(s);

            this.materialList            = (this.version >= 0x00000003) ? new MaterialList(OnResourceChanged, s) : null;
            this.common                  = new Common(requestedApiVersion, OnResourceChanged, s);
            this.steps4xModelVPXYIndex   = r.ReadUInt32();
            this.steps1xModelVPXYIndex   = r.ReadUInt32();
            this.wallCapModelVPXYIndex   = r.ReadUInt32();
            this.catalogRailing          = r.ReadUInt32();
            this.catalogWall             = r.ReadUInt32();
            this.catalogWallFloorPattern = r.ReadUInt32();
            this.catalogFence            = r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking)
            {
                if (this.GetType().Equals(typeof(RoofStyleCatalogResource)) && s.Position != s.Length)
                {
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                                                                 s.Length, s.Length - s.Position, s.Position));
                }
            }
        }
 //Current
 public FoundationCatalogResource(uint version,
                                  FoundationType foundation,
                                  MaterialList materials,
                                  Common common,
                                  uint wallCatalogIndex,
                                  uint floorCatalogIndex,
                                  uint vpxyIndex,
                                  uint index3,
                                  uint index4,
                                  uint unknown5,
                                  uint unknown6,
                                  ShapeType shape,
                                  TGIBlockList ltgib)
     : this(version,
            foundation,
            common,
            wallCatalogIndex,
            floorCatalogIndex,
            index3,
            index4,
            unknown5,
            unknown6,
            shape,
            ltgib)
 {
     if (version < 0x00000004)
     {
         throw new InvalidOperationException(String.Format("Version {0} invalid with these arguments", version));
     }
     this.materials = new MaterialList(OnResourceChanged, materials);
     this.vpxyIndex = vpxyIndex;
 }
Exemple #10
0
 // Current version
 public FenceCatalogResource(
     uint version,
     MaterialList materialList, //Version>=0x07
     Common common, uint modelVPXYIndex, uint diagonalVPXYIndex, uint postVPXYIndex, uint tileSpacing,
     bool canWalkOver,
     bool shouldNotGetThickSnow, bool snowPostShapeIsCircle,                                     //Version>=0x0A
     float snowThicknessPostScaleFactor, float snowThicknessRailScaleFactor,                     //Version>=0x0A
     float snowThicknessPostVerticalOffset, float snowThicknessRailVerticalOffset, bool hasWall, //Version>=0x0A
     bool risesAboveWall, uint wallIndex,                                                        //Version>=0x08
     TGIBlockList ltgib)
     : base(version, common, ltgib)
 {
     this.materialList                    = materialList != null ? new MaterialList(OnResourceChanged, materialList) : null;
     this.common                          = new Common(OnResourceChanged, common);
     this.modelVPXYIndex                  = modelVPXYIndex;
     this.diagonalVPXYIndex               = diagonalVPXYIndex;
     this.postVPXYIndex                   = postVPXYIndex;
     this.tileSpacing                     = tileSpacing;
     this.canWalkOver                     = canWalkOver;
     this.shouldNotGetThickSnow           = shouldNotGetThickSnow;
     this.snowPostShapeIsCircle           = snowPostShapeIsCircle;
     this.snowThicknessPostScaleFactor    = snowThicknessPostScaleFactor;
     this.snowThicknessRailScaleFactor    = snowThicknessRailScaleFactor;
     this.snowThicknessPostVerticalOffset = snowThicknessPostVerticalOffset;
     this.snowThicknessRailVerticalOffset = snowThicknessRailVerticalOffset;
     this.hasWall                         = hasWall;
     this.risesAboveWall                  = risesAboveWall;
     this.wallIndex                       = wallIndex;
 }
Exemple #11
0
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);

            base.Parse(s);

            this.common               = new Common(requestedApiVersion, OnResourceChanged, s);
            this.shape                = (ShapeType)r.ReadUInt32();
            this.cwstIndex            = r.ReadUInt32();
            this.cwalFloorIndex       = r.ReadUInt32();
            this.cwalWallIndex        = r.ReadUInt32();
            this.cfndIndex            = r.ReadUInt32();
            this.groundCutoutDDSIndex = r.ReadUInt32();
            this.xScale               = r.ReadUInt32();
            this.yScale               = r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking)
            {
                if (this.GetType().Equals(typeof(WallCatalogResource)) && s.Position != s.Length)
                {
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                                                                 s.Length, s.Length - s.Position, s.Position));
                }
            }
        }
Exemple #12
0
        protected override Stream UnParse()
        {
            long         pos;
            MemoryStream ms = new MemoryStream();
            BinaryWriter w  = new BinaryWriter(ms);

            w.Write(unknown1);
            pos = ms.Position;
            w.Write((uint)0); //tgiOffset
            w.Write((uint)0); //tgiSize
            w.Write(unknown2);
            if (tgiBlocks == null)
            {
                tgiBlocks = new TGIBlockList(OnResourceChanged);
            }
            if (tgiIndexes == null)
            {
                tgiIndexes = new Int32IndexList(OnResourceChanged, Int16.MaxValue, ReadInt16, WriteInt16, tgiBlocks);
            }
            tgiIndexes.UnParse(ms);
            tgiBlocks.UnParse(ms, pos);

            tgiIndexes.ParentTGIBlocks = tgiBlocks;

            return(ms);
        }
Exemple #13
0
 public WallCatalogResource(int APIversion,
     uint version,
     uint unknown2,
     Common common,
     Wall wallType,
     Partition partitionType,
     PartitionFlagsType partitionFlags,
     VerticalSpan verticalSpanType,
     PartitionsBlockedFlagsType partitionsBlockedFlags,
     PartitionsBlockedFlagsType adjacentPartitionsBlockedFlags,
     PartitionTool partitionToolMode,
     ToolUsageFlagsType toolUsageFlags,
     uint defaultPatternIndex,
     WallThickness wallThicknessType,
     TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.unknown2 = unknown2;
     this.wallType = wallType;
     this.partitionType = partitionType;
     this.partitionFlags = partitionFlags;
     this.verticalSpanType = verticalSpanType;
     this.partitionsBlockedFlags = partitionsBlockedFlags;
     this.adjacentPartitionsBlockedFlags = adjacentPartitionsBlockedFlags;
     this.partitionToolMode = partitionToolMode;
     this.toolUsageFlags = toolUsageFlags;
     this.defaultPatternIndex = defaultPatternIndex;
     this.wallThicknessType = wallThicknessType;
 }
 //Version<0x04
 public FoundationCatalogResource(int APIversion,
                                  uint version,
                                  Common common,
                                  FoundationType foundation,
                                  uint wallCatalogIndex,
                                  uint floorCatalogIndex,
                                  uint index3,
                                  uint index4,
                                  uint unknown5,
                                  uint unknown6,
                                  ShapeType shape,
                                  TGIBlockList ltgib)
     : this(APIversion,
            version,
            foundation,
            common,
            wallCatalogIndex,
            floorCatalogIndex,
            index3,
            index4,
            unknown5,
            unknown6,
            shape,
            ltgib)
 {
     if (checking)
     {
         if (version >= 0x00000004)
         {
             throw new InvalidOperationException(String.Format("Version {0} invalid with these arguments", version));
         }
     }
 }
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);

            base.Parse(s);
            this.common             = new Common(requestedApiVersion, OnResourceChanged, s);
            this.fireplaceWidth     = r.ReadByte();
            this.mantle             = r.ReadUInt32();
            this.chimneyMantle      = r.ReadUInt32();
            this.chimneyFullLevel   = r.ReadUInt32();
            this.chimneyGroundLevel = r.ReadUInt32();
            this.chimneyBody        = r.ReadUInt32();
            this.chimneyTop         = r.ReadUInt32();
            this.chimneyCap         = r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking)
            {
                if (this.GetType().Equals(typeof(FireplaceCatalogResource)) && s.Position != s.Length)
                {
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                                                                 s.Length, s.Length - s.Position, s.Position));
                }
            }
        }
 //Current
 public FoundationCatalogResource(int APIversion,
     uint version,
     FoundationType foundation,
     MaterialList materials,
     Common common,
     uint wallCatalogIndex,
     uint floorCatalogIndex,
     uint vpxyIndex,
     uint index3,
     uint index4,
     uint unknown5,
     uint unknown6,
     ShapeType shape,
     TGIBlockList ltgib)
     : this(APIversion,
     version,
     foundation,
     common,
     wallCatalogIndex,
     floorCatalogIndex,
     index3,
     index4,
     unknown5,
     unknown6,
     shape,
     ltgib)
 {
     if (checking) if (version < 0x00000004)
             throw new InvalidOperationException(String.Format("Version {0} invalid with these arguments", version));
     this.materials = new MaterialList(OnResourceChanged, materials);
     this.vpxyIndex = vpxyIndex;
 }
Exemple #17
0
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);

            base.Parse(s);

            this.unknown2                       = r.ReadUInt32();
            this.common                         = new Common(requestedApiVersion, OnResourceChanged, s);
            this.wallType                       = (Wall)r.ReadUInt32();
            this.partitionType                  = (Partition)r.ReadUInt32();
            this.partitionFlags                 = (PartitionFlagsType)r.ReadUInt32();
            this.verticalSpanType               = (VerticalSpan)r.ReadUInt32();
            this.partitionsBlockedFlags         = (PartitionsBlockedFlagsType)r.ReadUInt32();
            this.adjacentPartitionsBlockedFlags = (PartitionsBlockedFlagsType)r.ReadUInt32();
            this.partitionToolMode              = (PartitionTool)r.ReadUInt32();
            this.toolUsageFlags                 = (ToolUsageFlagsType)r.ReadUInt32();
            this.defaultPatternIndex            = r.ReadUInt32();
            this.wallThicknessType              = (WallThickness)r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking)
            {
                if (this.GetType().Equals(typeof(WallCatalogResource)) && s.Position != s.Length)
                {
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                                                                 s.Length, s.Length - s.Position, s.Position));
                }
            }
        }
Exemple #18
0
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);

            tag = r.ReadUInt32();
            if (checking)
            {
                if (tag != (uint)FOURCC("VPXY"))
                {
                    throw new InvalidDataException(String.Format("Invalid Tag read: '{0}'; expected: 'VPXY'; at 0x{1:X8}", FOURCC(tag), s.Position));
                }
            }
            version = r.ReadUInt32();
            if (checking)
            {
                if (version != 4)
                {
                    throw new InvalidDataException(String.Format("Invalid Version read: 0x{0:X8}; expected 0x00000004; at 0x{1:X8}", version, s.Position));
                }
            }

            long tgiPosn = r.ReadUInt32() + s.Position;
            long tgiSize = r.ReadUInt32();

            entryList = new EntryList(OnRCOLChanged, s);
            tc02      = r.ReadByte();
            if (checking)
            {
                if (tc02 != 2)
                {
                    throw new InvalidDataException(String.Format("Invalid TC02 read: 0x{0:X2}; expected 0x02; at 0x{1:X8}", tc02, s.Position));
                }
            }
            bounds = new BoundingBox(requestedApiVersion, handler, s);
            unused = r.ReadBytes(4);
            if (checking)
            {
                if (unused.Length != 4)
                {
                    throw new EndOfStreamException(String.Format("Unused: expected 4 bytes, read {0}.", unused.Length));
                }
            }
            modular = r.ReadByte();
            if (modular != 0)
            {
                ftptIndex = r.ReadInt32();
            }
            else
            {
                ftptIndex = 0;
            }

            tgiBlockList = new TGIBlockList(OnRCOLChanged, s, tgiPosn, tgiSize, ignoreTgiSize: true);

            entryList.ParentTGIBlocks = tgiBlockList;
        }
 public RoofPatternCatalogResource(int APIversion, uint version, Common common,
     uint topMaterialVPXYIndex, uint undersideMaterialVPXYIndex, uint sideStripsMaterialVPXYIndex,
     TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.common = new Common(requestedApiVersion, OnResourceChanged, common);
     this.topMaterialVPXYIndex = topMaterialVPXYIndex;
     this.undersideMaterialVPXYIndex = undersideMaterialVPXYIndex;
     this.sideStripsMaterialVPXYIndex = sideStripsMaterialVPXYIndex;
 }
Exemple #20
0
 public RoofPatternCatalogResource(int APIversion, uint version, Common common,
                                   uint topMaterialVPXYIndex, uint undersideMaterialVPXYIndex, uint sideStripsMaterialVPXYIndex,
                                   TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.common = new Common(requestedApiVersion, OnResourceChanged, common);
     this.topMaterialVPXYIndex        = topMaterialVPXYIndex;
     this.undersideMaterialVPXYIndex  = undersideMaterialVPXYIndex;
     this.sideStripsMaterialVPXYIndex = sideStripsMaterialVPXYIndex;
 }
Exemple #21
0
        void Parse(Stream s)
        {
            s.Position = 0;
            BinaryReader r = new BinaryReader(s);

            version     = r.ReadUInt32();
            tgiOffset   = r.ReadUInt32() + 8;
            presetCount = r.ReadUInt32();
            if (presetCount != 0)
            {
                throw new Exception("Found non-zero one");
            }
            name = BigEndianUnicodeString.Read(s);

            sortPriority = r.ReadSingle();
            colorCode    = r.ReadByte();
            unknown1     = r.ReadByte();
            outfitGroup  = r.ReadUInt32();
            unknown2     = new DataBlobHandler(recommendedApiVersion, OnResourceChanged, r.ReadBytes(17));

            flagList = new FlagList(OnResourceChanged, s);

            this.unknown3    = r.ReadByte();
            this.swatchIndex = r.ReadByte();

            unknown4 = new DataBlobHandler(1, null, r.ReadBytes(2 * 3 * 4 + 1));

            byte count2 = r.ReadByte();

            swatchColorCode = new uint[count2];
            for (byte i = 0; i < count2; i++)
            {
                swatchColorCode[i] = r.ReadUInt32();
            }

            unknown5 = new DataBlobHandler(1, null, r.ReadBytes(2 * 4));

            // TGI block list
            long currentPosition = r.BaseStream.Position;

            r.BaseStream.Position = tgiOffset;
            tgiList = new TGIBlockList(null);
            byte count4 = r.ReadByte();

            for (int i = 0; i < count4; i++)
            {
                tgiList.Add(new TGIBlock(1, null, "IGT", s));
            }
            r.BaseStream.Position = currentPosition;

            unknown6 = new UnknownClassList(null, s, tgiList);

            unknown7 = new DataBlobHandler(1, null, r.ReadBytes(10));
        }
Exemple #22
0
 public RailingCatalogResource(int APIversion, uint version,
     Common common, uint railing4xModelIndex, uint railing1xModelIndex, uint postModelIndex,
     TGIBlockList ltgib)
     : this(APIversion, version,
     null,
     common, railing4xModelIndex, railing1xModelIndex, postModelIndex,
     ltgib)
 {
     if (checking) if (version >= 0x00000003)
             throw new InvalidOperationException(String.Format("Constructor requires MaterialList for version {0}", version));
 }
 public RoofStyleCatalogResource(int APIversion, uint version,
     Common common, Roof roofType, uint catalogRoofStyle, uint catalogWallStyle, float defaultSlope, RoofStyle roofStyleFlags,
     TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.common = new Common(requestedApiVersion, OnResourceChanged, common);
     this.roofType = roofType;
     this.catalogRoofPattern = catalogRoofStyle;
     this.catalogWallStyle = catalogWallStyle;
     this.defaultSlope = defaultSlope;
     this.roofStyleFlags = roofStyleFlags;
 }
Exemple #24
0
 public RoofStyleCatalogResource(int APIversion, uint version,
                                 Common common, Roof roofType, uint catalogRoofStyle, uint catalogWallStyle, float defaultSlope, RoofStyle roofStyleFlags,
                                 TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.common             = new Common(requestedApiVersion, OnResourceChanged, common);
     this.roofType           = roofType;
     this.catalogRoofPattern = catalogRoofStyle;
     this.catalogWallStyle   = catalogWallStyle;
     this.defaultSlope       = defaultSlope;
     this.roofStyleFlags     = roofStyleFlags;
 }
Exemple #25
0
 public RailingCatalogResource(int APIversion, uint version,
     MaterialList materialList,
     Common common, uint railing4xModelIndex, uint railing1xModelIndex, uint postModelIndex,
     TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.materialList = materialList != null ? new MaterialList(OnResourceChanged, materialList) : null;
     this.common = new Common(requestedApiVersion, OnResourceChanged, common);
     this.railing4xModelVPXYIndex = railing4xModelIndex;
     this.railing1xModelVPXYIndex = railing1xModelIndex;
     this.postModelVPXYIndex = postModelIndex;
 }
Exemple #26
0
 public RailingCatalogResource(int APIversion, uint version,
                               MaterialList materialList,
                               Common common, uint railing4xModelIndex, uint railing1xModelIndex, uint postModelIndex,
                               TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.materialList            = materialList != null ? new MaterialList(OnResourceChanged, materialList) : null;
     this.common                  = new Common(requestedApiVersion, OnResourceChanged, common);
     this.railing4xModelVPXYIndex = railing4xModelIndex;
     this.railing1xModelVPXYIndex = railing1xModelIndex;
     this.postModelVPXYIndex      = postModelIndex;
 }
Exemple #27
0
 public RailingCatalogResource(uint version,
                               Common common, uint railing4xModelIndex, uint railing1xModelIndex, uint postModelIndex,
                               TGIBlockList ltgib)
     : this(version,
            null,
            common, railing4xModelIndex, railing1xModelIndex, postModelIndex,
            ltgib)
 {
     if (version >= 0x00000003)
     {
         throw new InvalidOperationException(String.Format("Constructor requires MaterialList for version {0}", version));
     }
 }
Exemple #28
0
 public StairsCatalogResource(int APIversion, uint version,
     Common common,
     uint steps4xModelVPXYIndex, uint steps1xModelVPXYIndex, uint wallCapModelVPXYIndex,
     uint catalogRailing, uint catalogWall, uint catalogWallFloorPattern, uint catalogFence,
     TGIBlockList ltgib)
     : this(APIversion, version,
     null,
     common,
     steps4xModelVPXYIndex, steps1xModelVPXYIndex, wallCapModelVPXYIndex, catalogRailing, catalogWall, catalogWallFloorPattern, catalogFence,
     ltgib)
 {
     if (checking) if (version >= 0x00000003)
             throw new InvalidOperationException(String.Format("Constructor requires MaterialList for version {0}", version));
 }
Exemple #29
0
        void Parse(Stream s)
        {
            long tgiPosn, tgiSize;
            BinaryReader r = new BinaryReader(s);

            unknown1 = r.ReadUInt16();
            tgiPosn = r.ReadUInt32() + s.Position;
            tgiSize = r.ReadUInt32();
            unknown2 = r.ReadUInt16();
            tgiIndexes = new Int32IndexList(OnResourceChanged, s, Int16.MaxValue, ReadInt16, WriteInt16);
            tgiBlocks = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            tgiIndexes.ParentTGIBlocks = tgiBlocks;
        }
Exemple #30
0
        void Parse(Stream s)
        {
            long         tgiPosn, tgiSize;
            BinaryReader r = new BinaryReader(s);

            unknown1   = r.ReadUInt16();
            tgiPosn    = r.ReadUInt32() + s.Position;
            tgiSize    = r.ReadUInt32();
            unknown2   = r.ReadUInt16();
            tgiIndexes = new Int32IndexList(OnResourceChanged, s, Int16.MaxValue, ReadInt16, WriteInt16);
            tgiBlocks  = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            tgiIndexes.ParentTGIBlocks = tgiBlocks;
        }
Exemple #31
0
            public ReferenceBlock(int APIversion, EventHandler handler, Stream s) : base(APIversion, handler)
            {
                BinaryReader r = new BinaryReader(s);

                this.unknown1     = r.ReadUInt32();
                this.unknownBytes = new DataBlobHandler(recommendedApiVersion, null, r.ReadBytes(5));

                int count = r.ReadInt32();

                this.tgiList = new TGIBlockList(null);
                for (int i = 0; i < count; i++)
                {
                    this.tgiList.Add(new TGIBlock(recommendedApiVersion, null, "ITG", s));
                }
            }
 public FireplaceCatalogResource(int APIversion, uint version, Common common,
     byte fireplaceType, uint mantle, uint chimneyMantle, uint chimneyFullLevel, uint chimneyGroundLevel, uint chimneyBody, uint chimneyTop, uint chimneyCap,
     TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.common = new Common(requestedApiVersion, OnResourceChanged, common);
     this.fireplaceWidth = fireplaceType;
     this.mantle = mantle;
     this.chimneyMantle = chimneyMantle;
     this.chimneyFullLevel = chimneyFullLevel;
     this.chimneyGroundLevel = chimneyGroundLevel;
     this.chimneyBody = chimneyBody;
     this.chimneyTop = chimneyTop;
     this.chimneyCap = chimneyCap;
 }
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);
            base.Parse(s);
            this.common = new Common(requestedApiVersion, OnResourceChanged, s);
            this.topMaterialVPXYIndex = r.ReadUInt32();
            this.undersideMaterialVPXYIndex = r.ReadUInt32();
            this.sideStripsMaterialVPXYIndex = r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking) if (this.GetType().Equals(typeof(RoofPatternCatalogResource)) && s.Position != s.Length)
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                        s.Length, s.Length - s.Position, s.Position));
        }
 public FireplaceCatalogResource(int APIversion, uint version, Common common,
                                 byte fireplaceType, uint mantle, uint chimneyMantle, uint chimneyFullLevel, uint chimneyGroundLevel, uint chimneyBody, uint chimneyTop, uint chimneyCap,
                                 TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.common             = new Common(requestedApiVersion, OnResourceChanged, common);
     this.fireplaceWidth     = fireplaceType;
     this.mantle             = mantle;
     this.chimneyMantle      = chimneyMantle;
     this.chimneyFullLevel   = chimneyFullLevel;
     this.chimneyGroundLevel = chimneyGroundLevel;
     this.chimneyBody        = chimneyBody;
     this.chimneyTop         = chimneyTop;
     this.chimneyCap         = chimneyCap;
 }
Exemple #35
0
        public override Stream UnParse()
        {
            MemoryStream ms = new MemoryStream();
            BinaryWriter w  = new BinaryWriter(ms);

            w.Write(tag);
            w.Write(version);

            long pos = ms.Position;

            w.Write((uint)0); // tgiOffset
            w.Write((uint)0); // tgiSize

            if (entryList == null)
            {
                entryList = new EntryList(OnRCOLChanged)
                {
                    ParentTGIBlocks = tgiBlockList
                }
            }
            ;
            entryList.UnParse(ms);

            w.Write(tc02);

            if (bounds == null)
            {
                bounds = new BoundingBox(requestedApiVersion, handler);
            }
            bounds.UnParse(ms);

            w.Write(unused);
            w.Write(modular);
            if (modular != 0)
            {
                w.Write(ftptIndex);
            }

            if (tgiBlockList == null)
            {
                tgiBlockList = new TGIBlockList(OnRCOLChanged);
            }
            tgiBlockList.UnParse(ms, pos);

            entryList.ParentTGIBlocks = tgiBlockList;

            return(ms);
        }
Exemple #36
0
            public ReferenceBlock(int APIversion, EventHandler handler, Stream s) : base(APIversion, handler)
            {
                BinaryReader r = new BinaryReader(s);

                this.region        = (CASPartRegion)r.ReadUInt32();
                this.layer         = r.ReadSingle();
                this.isReplacement = r.ReadBoolean();

                int count = r.ReadInt32();

                this.tgiList = new TGIBlockList(null);
                for (int i = 0; i < count; i++)
                {
                    this.tgiList.Add(new TGIBlock(recommendedApiVersion, null, "ITG", s));
                }
            }
Exemple #37
0
 //Version < 0x07
 public FenceCatalogResource(uint version,
                             Common common, uint modelVPXYIndex, uint diagonalVPXYIndex, uint postVPXYIndex, uint tileSpacing,
                             bool canWalkOver,
                             TGIBlockList ltgib)
     : this(version,
            null,
            common, modelVPXYIndex, diagonalVPXYIndex, postVPXYIndex, tileSpacing, canWalkOver,
            false, false, 0f, 0f, 0f, 0f, false,
            false, 0,
            ltgib)
 {
     if (version >= 0x00000007)
     {
         throw new InvalidOperationException(String.Format("Constructor requires materialList for version {0}", version));
     }
 }
Exemple #38
0
 public StairsCatalogResource(uint version,
                              Common common,
                              uint steps4xModelVPXYIndex, uint steps1xModelVPXYIndex, uint wallCapModelVPXYIndex,
                              uint catalogRailing, uint catalogWall, uint catalogWallFloorPattern, uint catalogFence,
                              TGIBlockList ltgib)
     : this(version,
            null,
            common,
            steps4xModelVPXYIndex, steps1xModelVPXYIndex, wallCapModelVPXYIndex, catalogRailing, catalogWall, catalogWallFloorPattern, catalogFence,
            ltgib)
 {
     if (version >= 0x00000003)
     {
         throw new InvalidOperationException(String.Format("Constructor requires MaterialList for version {0}", version));
     }
 }
Exemple #39
0
        void Parse(Stream s)
        {
            long         tgiPosn, tgiSize;
            BinaryReader r = new BinaryReader(s);

            format  = r.ReadUInt32();
            tgiPosn = r.ReadUInt32() + s.Position;
            tgiSize = r.ReadUInt32();

            components    = new ComponentList(OnResourceChanged, s);
            componentData = new ComponentDataList(OnResourceChanged, s);
            unknown1      = r.ReadByte();

            tgiBlocks = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            componentData.ParentTGIBlocks = tgiBlocks;
        }
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);
            base.Parse(s);
            this.common = new Common(requestedApiVersion, OnResourceChanged, s);
            this.roofType = (Roof)r.ReadUInt32();
            this.catalogRoofPattern = r.ReadUInt32();
            this.catalogWallStyle = r.ReadUInt32();
            this.defaultSlope = r.ReadSingle();
            this.roofStyleFlags = (RoofStyle)r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking) if (this.GetType().Equals(typeof(RoofStyleCatalogResource)) && s.Position != s.Length)
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                        s.Length, s.Length - s.Position, s.Position));
        }
Exemple #41
0
            public void UnParse(Stream s)
            {
                BinaryWriter w = new BinaryWriter(s);

                w.Write((uint)this.region);
                w.Write(this.layer);
                w.Write(this.isReplacement);
                if (this.tgiList == null)
                {
                    this.tgiList = new TGIBlockList(handler);
                }
                w.Write(this.tgiList.Count);
                foreach (var tgi in this.tgiList)
                {
                    tgi.UnParse(s);
                }
            }
Exemple #42
0
 public StairsCatalogResource(int APIversion, uint version,
     MaterialList materialList,
     Common common,
     uint steps4xModelVPXYIndex, uint steps1xModelVPXYIndex, uint wallCapModelVPXYIndex,
     uint catalogRailing, uint catalogWall, uint catalogWallFloorPattern, uint catalogFence,
     TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.materialList = materialList != null ? new MaterialList(OnResourceChanged, materialList) : null;
     this.common = new Common(requestedApiVersion, OnResourceChanged, common);
     this.steps4xModelVPXYIndex = steps4xModelVPXYIndex;
     this.steps1xModelVPXYIndex = steps1xModelVPXYIndex;
     this.wallCapModelVPXYIndex = wallCapModelVPXYIndex;
     this.catalogRailing = catalogRailing;
     this.catalogWall = catalogWall;
     this.catalogWallFloorPattern = catalogWallFloorPattern;
     this.catalogFence = catalogFence;
 }
Exemple #43
0
        protected override Stream UnParse()
        {
            long pos;
            MemoryStream ms = new MemoryStream();
            BinaryWriter w = new BinaryWriter(ms);

            w.Write(unknown1);
            pos = ms.Position;
            w.Write((uint)0);//tgiOffset
            w.Write((uint)0);//tgiSize
            w.Write(unknown2);
            if (tgiBlocks == null) tgiBlocks = new TGIBlockList(OnResourceChanged);
            if (tgiIndexes == null) tgiIndexes = new Int32IndexList(OnResourceChanged, Int16.MaxValue, ReadInt16, WriteInt16, tgiBlocks);
            tgiIndexes.UnParse(ms);
            tgiBlocks.UnParse(ms, pos);

            tgiIndexes.ParentTGIBlocks = tgiBlocks;

            return ms;
        }
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);
            base.Parse(s);
            this.common = new Common(requestedApiVersion, OnResourceChanged, s);
            this.fireplaceWidth = r.ReadByte();
            this.mantle = r.ReadUInt32();
            this.chimneyMantle = r.ReadUInt32();
            this.chimneyFullLevel = r.ReadUInt32();
            this.chimneyGroundLevel = r.ReadUInt32();
            this.chimneyBody = r.ReadUInt32();
            this.chimneyTop = r.ReadUInt32();
            this.chimneyCap = r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking) if (this.GetType().Equals(typeof(FireplaceCatalogResource)) && s.Position != s.Length)
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                        s.Length, s.Length - s.Position, s.Position));
        }
        private void Parse(Stream s)
        {
            long tgiPosn, tgiSize;
            BinaryReader r = new BinaryReader(s);

            version = r.ReadUInt32();

            tgiPosn = r.ReadUInt32() + s.Position;
            tgiSize = r.ReadUInt32();

            nameHash = r.ReadUInt64();
            tgiIndexes = new Int32IndexList(OnResourceChanged, s);
            bidirectional = r.ReadByte();
            casPanelGroup = (CASPanelGroupType)r.ReadUInt32();
            sort = (CASPanelSortType)r.ReadUInt32();
            unknown1 = r.ReadUInt32();
            tgiBlocks = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            tgiIndexes.ParentTGIBlocks = tgiBlocks;
        }
 public FountainPoolCatalogResource(int APIversion,
     uint version,
     Common common,
     ShapeType wallType,
     uint cwstIndex,
     uint cwalFloorIndex,
     uint cwalWallIndex,
     uint cfndIndex,
     uint xScale,
     uint yScale,
     TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.shape = wallType;
     this.cwstIndex = cwstIndex;
     this.cwalFloorIndex = cwalFloorIndex;
     this.cwalWallIndex = cwalWallIndex;
     this.cfndIndex = cfndIndex;
     this.xScale = xScale;
     this.yScale = yScale;
 }
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);
            base.Parse(s);

            this.common = new Common(requestedApiVersion, OnResourceChanged, s);
            this.shape = (ShapeType)r.ReadUInt32();
            this.cwstIndex = r.ReadUInt32();
            this.cwalFloorIndex = r.ReadUInt32();
            this.cwalWallIndex = r.ReadUInt32();
            this.cfndIndex = r.ReadUInt32();
            this.groundCutoutDDSIndex = r.ReadUInt32();
            this.xScale = r.ReadUInt32();
            this.yScale = r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking) if (this.GetType().Equals(typeof(WallCatalogResource)) && s.Position != s.Length)
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                        s.Length, s.Length - s.Position, s.Position));
        }
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);
            base.Parse(s);

            this.materialList = (this.version >= 0x00000003) ? new MaterialList(OnResourceChanged, s) : null;
            this.common = new Common(requestedApiVersion, OnResourceChanged, s);
            this.steps4xModelVPXYIndex = r.ReadUInt32();
            this.steps1xModelVPXYIndex = r.ReadUInt32();
            this.wallCapModelVPXYIndex = r.ReadUInt32();
            this.catalogRailing = r.ReadUInt32();
            this.catalogWall = r.ReadUInt32();
            this.catalogWallFloorPattern = r.ReadUInt32();
            this.catalogFence = r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking) if (this.GetType().Equals(typeof(RoofStyleCatalogResource)) && s.Position != s.Length)
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                        s.Length, s.Length - s.Position, s.Position));
        }
        protected override Stream UnParse()
        {
            MemoryStream s = new MemoryStream();
            BinaryWriter w = new BinaryWriter(s);

            w.Write(version);

            long pos = s.Position;
            w.Write((uint)0); // tgiOffset
            w.Write((uint)0); // tgiSize

            w.Write(nameHash);
            if (tgiBlocks == null) tgiBlocks = new TGIBlockList(OnResourceChanged);
            if (tgiIndexes == null) tgiIndexes = new Int32IndexList(OnResourceChanged, tgiBlocks);
            tgiIndexes.UnParse(s);
            w.Write(bidirectional);
            w.Write((uint)casPanelGroup);
            w.Write((uint)sort);
            w.Write(unknown1);

            tgiBlocks.UnParse(s, pos);

            return s;
        }
		private TGIBlockList ReadTGIBlock(BinaryReader r, EventHandler handler, TGIBlock.Order order = TGIBlock.Order.ITG)
		{
			int count = r.ReadInt32() / 4;
			List<TGIBlock> tgiblockList = new List<TGIBlock>(count);
			for (int i = 0; i < count; i++)
			{
				ulong instance = 0;
				uint type = 0;
				uint group = 0;
				if (order == TGIBlock.Order.ITG)
				{
					instance = r.ReadUInt64();
					instance = (instance << 32) | (instance >> 32); // swap instance
					type = r.ReadUInt32();
					group = r.ReadUInt32();

				}
				else if (order == TGIBlock.Order.TGI)
				{
					type = r.ReadUInt32();
					group = r.ReadUInt32();
					instance = r.ReadUInt64();
					instance = (instance << 32) | (instance >> 32); // swap instance
				}
				tgiblockList.Add(new TGIBlock(recommendedApiVersion, handler, type, group, instance));
			}
			TGIBlockList result = new TGIBlockList(handler, tgiblockList);
			return result;
		}
		private void WriteTGIBlock(BinaryWriter w, TGIBlockList value, TGIBlock.Order order = TGIBlock.Order.ITG)
		{
			w.Write(value.Count * 4);
			foreach (var tgi in value)
			{
				ulong instance = (tgi.Instance << 32) | (tgi.Instance >> 32);
				if (order == TGIBlock.Order.ITG)
				{
					w.Write(instance);
					w.Write(tgi.ResourceType);
					w.Write(tgi.ResourceGroup);
				}
				else if (order == TGIBlock.Order.TGI)
				{
					w.Write(tgi.ResourceType);
					w.Write(tgi.ResourceGroup);
					w.Write(instance);
				}
			}
		}
		protected void Parse(Stream s)
		{
			if (s == null) s = this.UnParse();
			s.Position = 0;
			BinaryReader r = new BinaryReader(s);
			this.version = r.ReadUInt16();
			long tablePosition = r.ReadUInt32();

			r.BaseStream.Position = tablePosition;
			ushort entryCount = r.ReadUInt16();
			this.propertyIDList = new List<PropertyID>();
			for (ushort i = 0; i < entryCount; i++)
			{
				uint type = r.ReadUInt32();
				PropertyID id = (PropertyID)type;
				uint offset = r.ReadUInt32();
				long nextPosition = r.BaseStream.Position;
				r.BaseStream.Position = offset;
				int count = 0;
				this.propertyIDList.Add(id);
				switch (id)
				{
					case PropertyID.Name:
						this.name = this.ReadString(r, this.OnResourceChanged);
						break;
					case PropertyID.Tuning:
						count = r.ReadInt32();
						this.tuning = Encoding.ASCII.GetString(r.ReadBytes(count));
						break;
					case PropertyID.TuningID:
						this.tuningID = r.ReadUInt64(); // it might be swapped
						break;
					case PropertyID.Icon:
						this.icon = this.ReadTGIBlock(r, this.OnResourceChanged);
						break;
					case PropertyID.Rig:
						this.rig = this.ReadTGIBlock(r, this.OnResourceChanged);
						break;
					case PropertyID.Slot:
						this.slot = this.ReadTGIBlock(r, this.OnResourceChanged);
						break;
					case PropertyID.Model:
						this.model = this.ReadTGIBlock(r, this.OnResourceChanged);
						break;
					case PropertyID.Footprint:
						this.footprint = this.ReadTGIBlock(r, this.OnResourceChanged);
						break;
					case PropertyID.Components:
						int componentCount = r.ReadInt32();
						this.components = new SimpleList<uint>(this.OnResourceChanged);
						for (int m = 0; m < componentCount; m++) this.components.Add(r.ReadUInt32());
						break;
					case PropertyID.MaterialVariant:
						this.materialVariant = this.ReadString(r, this.OnResourceChanged);
						break;
					case PropertyID.Unknown1:
						this.unknown1 = r.ReadByte();
						break;
					case PropertyID.SimoleonPrice:
						this.simoleonPrice = r.ReadUInt32();
						break;
					case PropertyID.PositiveEnvironmentScore:
						this.positiveEnvironmentScore = r.ReadSingle();
						break;
					case PropertyID.NegativeEnvironmentScore:
						this.negativeEnvironmentScore = r.ReadSingle();
						break;
					case PropertyID.ThumbnailGeometryState:
						this.thumbnailGeometryState = r.ReadUInt32();
						break;
					case PropertyID.Unknown2:
						this.Unknown2 = r.ReadBoolean();
						break;
					case PropertyID.EnvironmentScoreEmotionTags:
						count = r.ReadInt32();

						var tags = new ushort[count];
						for (int m = 0; m < count; m++)
						{
							tags[m] = r.ReadUInt16();
						}

						var catalogTags = tags.Select(CatalogTagRegistry.FetchTag)
											  .Select(t => new CatalogTag(CatalogCommon.kRecommendedApiVersion, this.OnResourceChanged, t));

						this.environmentScoreEmotionTags = new CatalogTagList(this.OnResourceChanged, catalogTags);

						break;
					case PropertyID.EnvironmentScores:
						count = r.ReadInt32();
						this.environmentScores = new float[count];
						for (int m = 0; m < count; m++) this.environmentScores[m] = r.ReadSingle();
						break;
					case PropertyID.Unknown3:
						this.unknown3 = r.ReadUInt64();
						break;
					case PropertyID.IsBaby:
						this.isBaby = r.ReadBoolean();
						break;
					case PropertyID.Unknown4:
						count = r.ReadInt32();
						this.unknown4 = new byte[count];
						for (int m = 0; m < count; m++) this.unknown4[m] = r.ReadByte();
						break;
					default:
						break;
				}

				r.BaseStream.Position = nextPosition;

			}

			s.Position = 0;
			this.data = r.ReadBytes((int)s.Length);
		}
 //Common
 private FoundationCatalogResource(int APIversion,
     uint version,
     FoundationType foundation,//Here to avoid same method signature as Version<0x04
     Common common,
     uint wallCatalogIndex,
     uint floorCatalogIndex,
     uint index3,
     uint index4,
     uint unknown5,
     uint unknown6,
     ShapeType shape,
     TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.foundation = foundation;
     this.wallCatalogIndex = wallCatalogIndex;
     this.floorCatalogIndex = floorCatalogIndex;
     this.index3 = index3;
     this.index4 = index4;
     this.unknown5 = unknown5;
     this.unknown6 = unknown6;
     this.shape = shape;
 }
Exemple #54
0
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);
            base.Parse(s);

            this.unknown2 = r.ReadUInt32();
            this.common = new Common(requestedApiVersion, OnResourceChanged, s);
            this.wallType = (Wall)r.ReadUInt32();
            this.partitionType = (Partition)r.ReadUInt32();
            this.partitionFlags = (PartitionFlagsType)r.ReadUInt32();
            this.verticalSpanType = (VerticalSpan)r.ReadUInt32();
            this.partitionsBlockedFlags = (PartitionsBlockedFlagsType)r.ReadUInt32();
            this.adjacentPartitionsBlockedFlags = (PartitionsBlockedFlagsType)r.ReadUInt32();
            this.partitionToolMode = (PartitionTool)r.ReadUInt32();
            this.toolUsageFlags = (ToolUsageFlagsType)r.ReadUInt32();
            this.defaultPatternIndex = r.ReadUInt32();
            this.wallThicknessType = (WallThickness)r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking) if (this.GetType().Equals(typeof(WallCatalogResource)) && s.Position != s.Length)
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                        s.Length, s.Length - s.Position, s.Position));
        }
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);
            base.Parse(s);
            if (version >= 0x00000004)
            {
                this.foundation = (FoundationType)r.ReadUInt32();
                if ((uint)foundation >= (uint)FoundationType.StiltedConcrete)
                {
                    this.materials = new MaterialList(OnResourceChanged, s);
                }
            }
            this.common = new Common(requestedApiVersion, OnResourceChanged, s);
            if (version < 0x00000004)
                this.foundation = (FoundationType)r.ReadUInt32();
            this.wallCatalogIndex = r.ReadUInt32();
            this.floorCatalogIndex = r.ReadUInt32();
            if (version >= 0x00000004)
                this.vpxyIndex = r.ReadUInt32();
            this.index3 = r.ReadUInt32();
            this.index4 = r.ReadUInt32();
            this.unknown5 = r.ReadUInt32();
            this.unknown6 = r.ReadUInt32();
            this.shape = (ShapeType)r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking) if (this.GetType().Equals(typeof(FoundationCatalogResource)) && s.Position != s.Length)
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                        s.Length, s.Length - s.Position, s.Position));
        }