protected override Stream UnParse()
        {
            Stream       s = base.UnParse();
            BinaryWriter w = new BinaryWriter(s);

            if (materialList == null)
            {
                materialList = new WallFloorPatternMaterialList(OnResourceChanged);
            }
            materialList.UnParse(s);
            if (common == null)
            {
                common = new Common(requestedApiVersion, OnResourceChanged);
            }
            common.UnParse(s);
            w.Write((uint)patternType);
            w.Write(materialVPXYIndex);
            w.Write((uint)sortFlags);
            BigEndianUnicodeString.Write(s, surfaceType);
            w.Write((uint)terrainType);
            w.Write(argb);

            base.UnParse(s);

            w.Flush();

            return(s);
        }
        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));
                }
            }
        }
 public WallFloorPatternCatalogResource(uint version,
                                        IEnumerable <WallFloorPatternMaterial> materialList,
                                        Common common,
                                        Pattern patternType,
                                        uint materialVPXYIndex,
                                        SortFlagsType sortFlags,
                                        string surfaceType,
                                        Terrain terrainType,
                                        uint argb,
                                        TGIBlockList ltgib)
     : base(version, common, ltgib)
 {
     this.materialList      = new WallFloorPatternMaterialList(OnResourceChanged, materialList);
     this.patternType       = patternType;
     this.materialVPXYIndex = materialVPXYIndex;
     this.sortFlags         = sortFlags;
     this.surfaceType       = surfaceType;
     this.terrainType       = terrainType;
     this.argb = argb;
 }