Ejemplo n.º 1
0
        public BinFileProperty NewProp(string Prop, uint Hash)
        {
            BinFileProperty binFileProperty = new BinFileProperty(Prop, Hash);

            this.Props.Add(binFileProperty);
            return(binFileProperty);
        }
Ejemplo n.º 2
0
        public void ReadEntry(ref BinaryReader br)
        {
            this.Length = br.ReadUInt32();
            this.Prop   = this.PropertiesTable.GetProp(br.ReadUInt32());
            ushort num = br.ReadUInt16();

            checked
            {
                int num2 = (int)(num - 1);
                for (int i = 0; i <= num2; i++)
                {
                    List <BinFileValue> arg_50_0 = this.Values;
                    BinFileValueType    arg_4B_1 = (BinFileValueType)255;
                    object obj = this;
                    arg_50_0.Add(new BinFileValue(ref br, arg_4B_1, ref obj, ref this.PropertiesTable));
                }
            }
        }
Ejemplo n.º 3
0
        public BinFileProperty GetProp(uint Hash)
        {
            BinFileProperty result;

            try
            {
                List <BinFileProperty> .Enumerator enumerator = this.Props.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    BinFileProperty current = enumerator.Current;
                    if (current.Hash == Hash)
                    {
                        return(current);
                    }
                }
            }
            finally
            {
            }
            result = this.NewProp(null, Hash);
            return(result);
        }
Ejemplo n.º 4
0
 public BinFileValue(ref BinaryReader br, BinFileValueType readType, ref object parent, ref BinFilePropertiesTable propertiesTable)
 {
     this.PropertiesTable = propertiesTable;
     this.Parent          = RuntimeHelpers.GetObjectValue(parent);
     if (readType == (BinFileValueType)255)
     {
         this.bool_0    = true;
         this.Prop      = this.PropertiesTable.GetProp(br.ReadUInt32());
         this.ValueType = (BinFileValueType)br.ReadByte();
     }
     else
     {
         this.bool_0    = false;
         this.ValueType = readType;
     }
     if (this.ValueType == BinFileValueType.StringValue)
     {
         ushort count = br.ReadUInt16();
         this.Value = new string(br.ReadChars((int)count));
     }
     else if (this.ValueType == BinFileValueType.SameTypeValuesList1)
     {
         this.Value = new BinFileValueList(ref br, this.ValueType, ref this.PropertiesTable);
     }
     else if (this.ValueType == BinFileValueType.SameTypeValuesList2)
     {
         this.Value = new BinFileValueList(ref br, this.ValueType, ref this.PropertiesTable);
     }
     else if (this.ValueType == BinFileValueType.ValuesList)
     {
         this.Value = new BinFileValueList(ref br, this.ValueType, ref this.PropertiesTable);
     }
     else if (this.ValueType == BinFileValueType.ValuesList2)
     {
         this.Value = new BinFileValueList(ref br, this.ValueType, ref this.PropertiesTable);
     }
     else if (this.ValueType == BinFileValueType.DoubleTypesValuesList)
     {
         this.Value = new BinFileValueList(ref br, this.ValueType, ref this.PropertiesTable);
     }
     else if (this.ValueType == BinFileValueType.FloatValue2)
     {
         this.Value = br.ReadSingle();
     }
     else if (this.ValueType == BinFileValueType.const_4)
     {
         this.Value = br.ReadUInt32();
     }
     else if (this.ValueType == BinFileValueType.const_3)
     {
         this.Value = br.ReadUInt32();
     }
     else if (this.ValueType == BinFileValueType.const_11)
     {
         this.Value = br.ReadUInt32();
     }
     else if (this.ValueType == BinFileValueType.BooleanValue)
     {
         this.Value = br.ReadBoolean();
     }
     else if (this.ValueType == BinFileValueType.ByteVector4_2)
     {
         this.Value = br.ReadBytes(4);
     }
     else if (this.ValueType == BinFileValueType.ByteVector4_1)
     {
         this.Value = br.ReadBytes(4);
     }
     else if (this.ValueType == BinFileValueType.ByteValue2)
     {
         this.Value = br.ReadByte();
     }
     else if (this.ValueType == BinFileValueType.FloatsVector2)
     {
         this.Value = new float[]
         {
             br.ReadSingle(),
                 br.ReadSingle()
         };
     }
     else if (this.ValueType == BinFileValueType.FloatsVector4)
     {
         this.Value = new float[]
         {
             br.ReadSingle(),
                 br.ReadSingle(),
                 br.ReadSingle(),
                 br.ReadSingle()
         };
     }
     else if (this.ValueType == BinFileValueType.FloatsVector3)
     {
         this.Value = new float[]
         {
             br.ReadSingle(),
                 br.ReadSingle(),
                 br.ReadSingle()
         };
     }
     else if (this.ValueType == BinFileValueType.UShortsVector3)
     {
         this.Value = new ushort[]
         {
             br.ReadUInt16(),
                 br.ReadUInt16(),
                 br.ReadUInt16()
         };
     }
     else
     {
         br = br;
     }
 }
Ejemplo n.º 5
0
 public BinFileValueList(ref BinaryReader br, ValueType listType, ref BinFilePropertiesTable propertiesTable)
 {
     this.Entries         = new List <BinFileValue>();
     this.PropertiesTable = propertiesTable;
     this.ListType        = ((listType != null) ? ((BinFileValueType)listType) : ((BinFileValueType)0));
     checked
     {
         if (this.ListType == BinFileValueType.SameTypeValuesList1)
         {
             this.EntriesType = (BinFileValueType)br.ReadByte();
             this.EntriesSize = br.ReadUInt32();
             uint num  = br.ReadUInt32();
             long num2 = (long)(unchecked ((ulong)num) - 1uL);
             for (long num3 = 0L; num3 <= num2; num3 += 1L)
             {
                 List <BinFileValue> arg_8E_0 = this.Entries;
                 BinFileValueType    arg_89_1 = this.EntriesType;
                 object obj = this;
                 arg_8E_0.Add(new BinFileValue(ref br, arg_89_1, ref obj, ref propertiesTable));
             }
         }
         else if (this.ListType == BinFileValueType.SameTypeValuesList2)
         {
             this.EntriesType = (BinFileValueType)br.ReadByte();
             byte b    = br.ReadByte();
             int  num4 = (int)(b - 1);
             for (int i = 0; i <= num4; i++)
             {
                 List <BinFileValue> arg_EA_0 = this.Entries;
                 BinFileValueType    arg_E5_1 = this.EntriesType;
                 object obj = this;
                 arg_EA_0.Add(new BinFileValue(ref br, arg_E5_1, ref obj, ref propertiesTable));
             }
         }
         else if (this.ListType == BinFileValueType.ValuesList)
         {
             this.Prop        = this.PropertiesTable.GetProp(br.ReadUInt32());
             this.EntriesSize = br.ReadUInt32();
             this.EntriesType = (BinFileValueType)255;
             ushort num5 = br.ReadUInt16();
             int    num6 = (int)(num5 - 1);
             for (int j = 0; j <= num6; j++)
             {
                 List <BinFileValue> arg_164_0 = this.Entries;
                 BinFileValueType    arg_15F_1 = this.EntriesType;
                 object obj = this;
                 arg_164_0.Add(new BinFileValue(ref br, arg_15F_1, ref obj, ref propertiesTable));
             }
         }
         else if (this.ListType == BinFileValueType.ValuesList2)
         {
             this.Prop        = this.PropertiesTable.GetProp(br.ReadUInt32());
             this.EntriesSize = br.ReadUInt32();
             this.EntriesType = (BinFileValueType)255;
             ushort num7 = br.ReadUInt16();
             int    num8 = (int)(num7 - 1);
             for (int k = 0; k <= num8; k++)
             {
                 List <BinFileValue> arg_1DE_0 = this.Entries;
                 BinFileValueType    arg_1D9_1 = this.EntriesType;
                 object obj = this;
                 arg_1DE_0.Add(new BinFileValue(ref br, arg_1D9_1, ref obj, ref propertiesTable));
             }
         }
         else if (this.ListType == BinFileValueType.DoubleTypesValuesList)
         {
             this.EntriesTypes = new BinFileValueType[]
             {
                 (BinFileValueType)br.ReadByte(),
                 (BinFileValueType)br.ReadByte()
             };
             this.EntriesSize = br.ReadUInt32();
             uint num9  = br.ReadUInt32();
             long num10 = (long)(unchecked ((ulong)num9) - 1uL);
             for (long num11 = 0L; num11 <= num10; num11 += 1L)
             {
                 List <BinFileValue> arg_261_0 = this.Entries;
                 BinFileValueType    arg_25C_1 = this.EntriesTypes[0];
                 object obj = this;
                 arg_261_0.Add(new BinFileValue(ref br, arg_25C_1, ref obj, ref propertiesTable));
                 List <BinFileValue> arg_280_0 = this.Entries;
                 BinFileValueType    arg_27B_1 = this.EntriesTypes[1];
                 obj = this;
                 arg_280_0.Add(new BinFileValue(ref br, arg_27B_1, ref obj, ref propertiesTable));
             }
         }
     }
 }