Пример #1
0
        public void MakeNew()
        {
            this.commonBlockVersion = 0x9;
            this.nameHash           = 0;
            this.descriptionHash    = 0;
            this.price       = 0;
            this.unkCommon01 = 0;
            this.unkCommon02 = 0;
            this.unkCommon03 = 0;
            int tgi_count = 0;

            this.productStyles  = new CountedTGIBlockList(handler, TGIBlock.Order.ITG, tgi_count);
            this.unkCommon04    = 0;
            this.tagList        = new CatalogTagList(handler);
            this.sellingPoints  = new SellingPointList(handler);
            this.unlockByHash   = 0;
            this.unlockedByHash = 0;
            this.unkCommon06    = 0xffff;
            this.unkCommon07    = 0;
        }
Пример #2
0
 public CatalogCommon(int APIversion, EventHandler handler, uint commonBlockVersion, uint nameHash, uint descriptionHash,
                      uint price, uint unkCommon01, uint unkCommon02, uint unkCommon03, CountedTGIBlockList productStyles, UInt16 unkCommon04,
                      CatalogTagList tagList, SellingPointList sellingPoints, uint unlockByHash, uint unlockedByHash, UInt16 unkCommon06, ulong unkCommon07)
     : base(APIversion, handler)
 {
     this.handler            = handler;
     this.commonBlockVersion = commonBlockVersion;
     this.nameHash           = nameHash;
     this.descriptionHash    = descriptionHash;
     this.price          = price;
     this.unkCommon01    = unkCommon01;
     this.unkCommon02    = unkCommon02;
     this.unkCommon03    = unkCommon03;
     this.productStyles  = new CountedTGIBlockList(handler, TGIBlock.Order.ITG, productStyles);
     this.unkCommon04    = unkCommon04;
     this.tagList        = new CatalogTagList(handler, tagList);
     this.sellingPoints  = new SellingPointList(handler, sellingPoints);
     this.unlockByHash   = unlockByHash;
     this.unlockedByHash = unlockedByHash;
     this.unkCommon06    = unkCommon06;
     this.unkCommon07    = unkCommon07;
 }
Пример #3
0
        void Parse(Stream s)
        {
            var br = new BinaryReader(s);

            this.commonBlockVersion = br.ReadUInt32();
            this.nameHash           = br.ReadUInt32();
            this.descriptionHash    = br.ReadUInt32();
            this.price       = br.ReadUInt32();
            this.unkCommon01 = br.ReadUInt32();
            this.unkCommon02 = br.ReadUInt32();
            this.unkCommon03 = br.ReadUInt32();
            int tgi_count = br.ReadByte();

            this.productStyles  = new CountedTGIBlockList(handler, TGIBlock.Order.ITG, tgi_count, s);
            this.unkCommon04    = br.ReadUInt16();
            this.tagList        = new CatalogTagList(handler, s);
            this.sellingPoints  = new SellingPointList(handler, s);
            this.unlockByHash   = br.ReadUInt32();
            this.unlockedByHash = br.ReadUInt32();
            this.unkCommon06    = br.ReadUInt16();
            this.unkCommon07    = br.ReadUInt64();
        }
		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);
		}
        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 uint[count];
                    for (int m = 0; m < count; m++)
                    {
                        // Tags are now 32Bit unsigned, but environment score emotion tags stay 16Bit
                        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);
        }