private static void Main(string[] args)
    {
        string path = @"pathToJsonr.json";
        var    d    = new DeserializeClass <List <Person> >().Deserialize <List <Person> >(path);

        System.Console.WriteLine(d[0].Name);
    }
예제 #2
0
        public override void Deserialize(PackedStream_2 stream)
        {
            base.hasValue  = true;
            this.Variables = new VariableList();
            DeserializeClass class2 = new DeserializeClass(stream, 1);

            for (uint i = 0; i < class2.Count; i++)
            {
                ulong        num2;
                int          num5;
                HeroFieldDef definition;
                HeroAnyValue value2;
                uint         num3       = 0;
                int          variableId = 0;
                class2.ReadFieldData(out num2, ref num3, ref variableId, out num5);
                if (num5 == 2)
                {
                    continue;
                }
                HeroType     type  = new HeroType((HeroTypes)num3);
                DefinitionId field = new DefinitionId(num2);
                if (field.Definition != null)
                {
                    definition = field.Definition as HeroFieldDef;
                    HeroTypes types = definition.FieldType.Type;
                    if (types != HeroTypes.Enum)
                    {
                        if (types == HeroTypes.LookupList)
                        {
                            goto Label_0096;
                        }
                        if (types != HeroTypes.ScriptRef)
                        {
                            goto Label_009F;
                        }
                    }
                    type.Id = definition.FieldType.Id;
                }
                goto Label_009F;
Label_0096:
                type = definition.FieldType;
Label_009F:
                value2 = HeroAnyValue.Create(type);
                value2.Deserialize(stream);
                this.Variables.Add(new Variable(field, variableId, value2));
            }
        }
예제 #3
0
        public override void Deserialize(PackedStream_2 stream)
        {
            this.hasValue  = true;
            this.Variables = new VariableList();
            DeserializeClass deserializeClass = new DeserializeClass(stream, 1);

            for (uint index = 0U; index < deserializeClass.Count; ++index)
            {
                uint  type1      = 0U;
                int   variableId = 0;
                ulong fieldId;
                int   d;
                deserializeClass.ReadFieldData(out fieldId, ref type1, ref variableId, out d);
                if (d != 2)
                {
                    HeroType     type2 = new HeroType((HeroTypes)type1);
                    DefinitionId field = new DefinitionId(fieldId);
                    if (field.Definition != null)
                    {
                        HeroFieldDef heroFieldDef = field.Definition as HeroFieldDef;
                        switch (heroFieldDef.FieldType.Type)
                        {
                        case HeroTypes.Enum:
                        case HeroTypes.ScriptRef:
                            type2.Id = heroFieldDef.FieldType.Id;
                            break;

                        case HeroTypes.LookupList:
                            type2 = heroFieldDef.FieldType;
                            break;
                        }
                    }
                    HeroAnyValue heroAnyValue = HeroAnyValue.Create(type2);
                    heroAnyValue.Deserialize(stream);
                    this.Variables.Add(new Variable(field, variableId, heroAnyValue));
                }
            }
        }
예제 #4
0
 public void Serialize()
 {
     this.variables = new VariableList();
     if (!this.isProto)
     {
         int num;
         base.Decompress();
         if (base.version == 1)
         {
             num = 0x24;
         }
         else
         {
             num = 40;
         }
         uint   num2 = BitConverter.ToUInt32(base.Data, num);
         ushort num3 = BitConverter.ToUInt16(base.Data, num + 4);
         this.serializedData = new byte[num2];
         Array.Copy(base.Data, (long)num3, this.serializedData, 0L, (long)num2);
         this._2A         = BitConverter.ToUInt16(base.Data, num + 6);
         this.streamStyle = base.Data[num + 8];
         this._2D         = (byte)(base.Data[num + 9] & 3);
     }
     if (this.serializedData.Length != 0)
     {
         byte[] bytes = Encoding.ASCII.GetBytes("azalie");
         byte   index = 0;
         for (int i = 0; i < this.serializedData.Length; i++)
         {
             if ((bytes[index] == this.serializedData[i]) || (bytes[index] == ((this.serializedData[i] + 0x61) - 0x41)))
             {
                 index = (byte)(index + 1);
                 if (index != bytes.Length)
                 {
                     continue;
                 }
                 Console.WriteLine(base.Name);
                 break;
             }
             index = 0;
         }
         PackedStream_2   stream = new PackedStream_2(this.streamStyle, this.serializedData);
         DeserializeClass class2 = new DeserializeClass(stream, 1);
         for (uint j = 0; j < class2.Count; j++)
         {
             ulong num7;
             int   num10;
             uint  num8       = 0;
             int   variableId = 0;
             class2.ReadFieldData(out num7, ref num8, ref variableId, out num10);
             if (num10 != 2)
             {
                 HeroType     fieldType = new HeroType((HeroTypes)num8);
                 DefinitionId field     = new DefinitionId(num7);
                 if (field.Definition != null)
                 {
                     HeroFieldDef definition = field.Definition as HeroFieldDef;
                     fieldType = definition.FieldType;
                 }
                 HeroAnyValue value2 = HeroAnyValue.Create(fieldType);
                 value2.Deserialize(stream);
                 this.Variables.Add(new Variable(field, variableId, value2));
             }
         }
     }
 }
예제 #5
0
        public void Serialize()
        {
            variables = new VariableList();
            if (!isProto)
            {
                Decompress();
                int    startIndex = version != 1 ? 40 : 36;
                uint   num1       = BitConverter.ToUInt32(Data, startIndex);
                ushort num2       = BitConverter.ToUInt16(Data, startIndex + 4);
                serializedData = new byte[num1];
                Array.Copy(Data, num2, serializedData, 0L, num1);
                _2A         = BitConverter.ToUInt16(Data, startIndex + 6);
                streamStyle = Data[startIndex + 8];
                _2D         = (byte)(Data[startIndex + 9] & 3U);
            }
            if (serializedData.Length == 0)
            {
                return;
            }
            byte[] bytes = Encoding.ASCII.GetBytes("azalie");
            byte   num   = 0;

            for (int index = 0; index < serializedData.Length; ++index)
            {
                if (bytes[num] == serializedData[index] || bytes[num] == serializedData[index] + 97 - 65)
                {
                    ++num;
                    if (num == bytes.Length)
                    {
                        Console.WriteLine(Name);
                        break;
                    }
                }
                else
                {
                    num = 0;
                }
            }
            var stream           = new PackedStream2(streamStyle, serializedData);
            var deserializeClass = new DeserializeClass(stream, 1);

            for (uint index = 0U; index < deserializeClass.Count; ++index)
            {
                uint  type1      = 0U;
                int   variableId = 0;
                ulong fieldId;
                int   d;
                deserializeClass.ReadFieldData(out fieldId, ref type1, ref variableId, out d);
                if (d != 2)
                {
                    var type2 = new HeroType((HeroTypes)type1);
                    var field = new DefinitionId(fieldId);
                    if (field.Definition != null)
                    {
                        type2 = (field.Definition as HeroFieldDef).FieldType;
                    }
                    HeroAnyValue heroAnyValue = HeroAnyValue.Create(type2);
                    heroAnyValue.Deserialize(stream);
                    Variables.Add(new Variable(field, variableId, heroAnyValue));
                }
            }
        }