Beispiel #1
0
        public override void Deserialize(PackedStream_2 stream)
        {
            this.hasValue = true;
            this.Data     = new List <HeroVarId>();
            DeserializeList deserializeList = new DeserializeList(stream, 1);

            if (this.Type.Values == null)
            {
                this.Type.SetValuesType(deserializeList.listType);
            }
            for (uint index1 = 0U; index1 < deserializeList.Count; ++index1)
            {
                uint index2;
                bool b;
                int  variableId;
                deserializeList.GetFieldIndex(out index2, out b, out variableId);
                HeroAnyValue heroAnyValue = HeroAnyValue.Create(this.Type.Values);
                heroAnyValue.Deserialize(stream);
                this.Data.Add(new HeroVarId(variableId, heroAnyValue));
                if (variableId > this.nextId)
                {
                    this.nextId = variableId;
                }
            }
        }
Beispiel #2
0
 public override void Deserialize(PackedStream_2 stream)
 {
     base.hasValue = true;
     stream.Read(out this.x);
     stream.Read(out this.y);
     stream.Read(out this.z);
 }
Beispiel #3
0
        public override void Deserialize(PackedStream_2 stream)
        {
            base.hasValue = true;
            this.Data     = new List <HeroVarId>();
            DeserializeList list = new DeserializeList(stream, 1);

            if (base.Type.Values == null)
            {
                base.Type.SetValuesType(list.listType);
            }
            for (uint i = 0; i < list.Count; i++)
            {
                uint num2;
                bool flag;
                int  num3;
                list.GetFieldIndex(out num2, out flag, out num3);
                HeroAnyValue value2 = HeroAnyValue.Create(base.Type.Values);
                value2.Deserialize(stream);
                this.Data.Add(new HeroVarId(num3, value2));
                if (num3 > this.nextId)
                {
                    this.nextId = num3;
                }
            }
        }
Beispiel #4
0
 public override void Serialize(PackedStream_2 stream)
 {
     if (base.Type.Id == null)
     {
         throw new SerializingException("Cannot serialize a non-reference");
     }
     stream.Write(base.Type.Id.Id);
 }
Beispiel #5
0
 public override void Deserialize(PackedStream_2 stream)
 {
     base.hasValue = true;
     stream.Read(out this.Value);
     if (this.Value == 0L)
     {
         this.Value = -2305320741190498156L;
     }
 }
Beispiel #6
0
 public override void Deserialize(PackedStream_2 stream)
 {
     base.hasValue = true;
     if (base.Type.Id == null)
     {
         base.Type.Id = new DefinitionId();
     }
     stream.Read(out base.Type.Id.Id);
 }
 public SerializeStateBase(PackedStream_2 stream, HeroTypes heroType)
 {
     this.HeroType = heroType;
     this.Next     = (SerializeStateBase)null;
     this.Stream   = stream;
     this.m_0C     = 0U;
     this.Count    = 0U;
     this.Next     = stream.State;
     stream.State  = this;
 }
Beispiel #8
0
        public override void Serialize(PackedStream_2 stream)
        {
            int Count = 0;

            if (this.Data != null)
            {
                Count = this.Data.Count;
            }
            SerializeList serializeList = new SerializeList(stream, 1, this.Type.Values.Type, Count);

            for (int index = 0; index < Count; ++index)
            {
                serializeList.SetFieldIndex(index, this.Data[index].VarId);
                this.Data[index].Value.Serialize(stream);
            }
        }
Beispiel #9
0
        public override void Serialize(PackedStream_2 stream)
        {
            int count = 0;

            if (this.Data != null)
            {
                count = this.Data.Count;
            }
            SerializeList list = new SerializeList(stream, 1, base.Type.Values.Type, count);

            for (int i = 0; i < count; i++)
            {
                list.SetFieldIndex(i, this.Data[i].VarId);
                this.Data[i].Value.Serialize(stream);
            }
        }
Beispiel #10
0
        public override void Serialize(PackedStream_2 stream)
        {
            int count = 0;

            if (this.Variables != null)
            {
                count = this.Variables.Count;
            }
            SerializeClass class2 = new SerializeClass(stream, 1, count);

            for (int i = 0; i < count; i++)
            {
                class2.WriteFieldData(this.Variables[i].Field.Id, this.Variables[i].Value.Type.Type, this.Variables[i].VariableId);
                this.Variables[i].Value.Serialize(stream);
            }
        }
Beispiel #11
0
        public override void Serialize(PackedStream_2 stream)
        {
            int count = 0;

            if (this.Variables != null)
            {
                count = this.Variables.Count;
            }
            SerializeClass serializeClass = new SerializeClass(stream, 1, count);

            for (int index = 0; index < count; ++index)
            {
                serializeClass.WriteFieldData(this.Variables[index].Field.Id, this.Variables[index].Value.Type.Type, this.Variables[index].VariableId);
                this.Variables[index].Value.Serialize(stream);
            }
        }
Beispiel #12
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));
            }
        }
Beispiel #13
0
        static void LoadPrototypes(Stream stream)
        {
            ulong          num;
            PackedStream_2 m_ = new PackedStream_2(1, stream);

            m_.CheckResourceHeader(0x464e4950, 1, 1);
            m_.Read(out num);
            for (ulong i = 0L; i < num; i += (ulong)1L)
            {
                ulong num3;
                ulong num4;
                m_.Read(out num3);
                m_.Read(out num4);
                LoadPrototype(num3);
            }
            m_.CheckEnd();
        }
Beispiel #14
0
        public override void Serialize(PackedStream_2 stream)
        {
            int count = 0;

            if (this.Data != null)
            {
                count = this.Data.Count;
            }
            SerializeLookupList list = new SerializeLookupList(stream, 1, base.Type, count);

            if (this.Data != null)
            {
                foreach (KeyValuePair <HeroVarId, HeroAnyValue> pair in this.Data)
                {
                    list.SetKey(pair.Key.Value, pair.Key.VarId);
                    pair.Value.Serialize(stream);
                }
            }
        }
Beispiel #15
0
        public override void Deserialize(PackedStream_2 stream)
        {
            base.hasValue = true;
            this.Data     = new Dictionary <HeroVarId, HeroAnyValue>();
            HeroType defaultIndexerType = new HeroType(HeroTypes.None);

            if (base.Type.Indexer != null)
            {
                defaultIndexerType = base.Type.Indexer;
            }
            DeserializeLookupList list = new DeserializeLookupList(stream, 1, defaultIndexerType);

            if ((base.Type.Indexer == null) || (base.Type.Indexer.Type == HeroTypes.None))
            {
                base.Type.Indexer = list.indexerType;
            }
            else
            {
                list.indexerType = base.Type.Indexer;
            }
            if (base.Type.Values == null)
            {
                base.Type.Values = list.valueType;
            }
            else
            {
                list.valueType = base.Type.Values;
            }
            for (ulong i = 0L; i < list.Count; i += (ulong)1L)
            {
                int          num2;
                HeroAnyValue value2;
                list.GetKey(out value2, out num2);
                HeroAnyValue value3 = HeroAnyValue.Create(base.Type.Values);
                value3.Deserialize(stream);
                this.Data[new HeroVarId(num2, value2)] = value3;
                if (num2 > this.nextId)
                {
                    this.nextId = num2;
                }
            }
        }
Beispiel #16
0
        public override void Deserialize(PackedStream_2 stream)
        {
            this.hasValue = true;
            this.Data     = new Dictionary <HeroVarId, HeroAnyValue>();
            HeroType defaultIndexerType = new HeroType(HeroTypes.None);

            if (this.Type.Indexer != null)
            {
                defaultIndexerType = this.Type.Indexer;
            }
            DeserializeLookupList deserializeLookupList = new DeserializeLookupList(stream, 1, defaultIndexerType);

            if (this.Type.Indexer == null || this.Type.Indexer.Type == HeroTypes.None)
            {
                this.Type.Indexer = deserializeLookupList.indexerType;
            }
            else
            {
                deserializeLookupList.indexerType = this.Type.Indexer;
            }
            if (this.Type.Values == null)
            {
                this.Type.Values = deserializeLookupList.valueType;
            }
            else
            {
                deserializeLookupList.valueType = this.Type.Values;
            }
            for (ulong index = 0UL; index < (ulong)deserializeLookupList.Count; ++index)
            {
                HeroAnyValue key;
                int          variableId;
                deserializeLookupList.GetKey(out key, out variableId);
                HeroAnyValue heroAnyValue = HeroAnyValue.Create(this.Type.Values);
                heroAnyValue.Deserialize(stream);
                this.Data[new HeroVarId(variableId, key)] = heroAnyValue;
                if (variableId > this.nextId)
                {
                    this.nextId = variableId;
                }
            }
        }
Beispiel #17
0
        public override void Serialize(PackedStream_2 stream)
        {
            int Count = 0;

            if (this.Data != null)
            {
                Count = this.Data.Count;
            }
            SerializeLookupList serializeLookupList = new SerializeLookupList(stream, 1, this.Type, Count);

            if (this.Data == null)
            {
                return;
            }
            foreach (KeyValuePair <HeroVarId, HeroAnyValue> keyValuePair in this.Data)
            {
                serializeLookupList.SetKey(keyValuePair.Key.Value, keyValuePair.Key.VarId);
                keyValuePair.Value.Serialize(stream);
            }
        }
        public static void SetTypeInJStream(PackedStream_2 stream, HeroType type)
        {
            stream.WriteVersion(0L);
            stream.Write((ulong)((long)type.Type));
            switch (type.Type)
            {
            case HeroTypes.List:
                SetTypeInJStream(stream, type.Values);
                return;

            case HeroTypes.LookupList:
                SetTypeInJStream(stream, type.Indexer);
                SetTypeInJStream(stream, type.Values);
                return;

            case HeroTypes.Class:
            case HeroTypes.NodeRef:
                stream.Write(type.Id.Id);
                return;
            }
        }
Beispiel #19
0
        public static void SetTypeInJStream(PackedStream_2 stream, HeroType type)
        {
            stream.WriteVersion(0UL);
            stream.Write((ulong)type.Type);
            switch (type.Type)
            {
            case HeroTypes.List:
                HeroAnyValue.SetTypeInJStream(stream, type.Values);
                break;

            case HeroTypes.LookupList:
                HeroAnyValue.SetTypeInJStream(stream, type.Indexer);
                HeroAnyValue.SetTypeInJStream(stream, type.Values);
                break;

            case HeroTypes.Class:
            case HeroTypes.NodeRef:
                stream.Write(type.Id.Id);
                break;
            }
        }
Beispiel #20
0
        public override void Serialize(PackedStream_2 stream)
        {
            ulong num  = this._08;
            long  num2 = 0xdeadbeefL;

            stream.Write(this._00);
            stream.Write(num);
            stream.Write(this._0C);
            stream.Write(this._10);
            stream.Write(this._18);
            stream.Write(this._20);
            stream.Write(this._28);
            stream.Write(this._30);
            stream.Write(num2);
            stream.Write(this._38);
            if (num2 == 0xdeadbeefL)
            {
                stream.Write(this._40);
                stream.Write(this._48);
            }
        }
        public static HeroType GetTypeFromJStream(PackedStream_2 stream)
        {
            ulong num;
            ulong num2;

            stream.ReadVersion(out num);
            if (num != 0L)
            {
                throw new InvalidDataException("incorrect header token for creating HeroValueType");
            }
            stream.Read(out num2);
            HeroType type = new HeroType((HeroTypes)((int)num2));

            switch (type.Type)
            {
            case HeroTypes.Enum:
            case HeroTypes.Class:
            case HeroTypes.NodeRef:
                stream.Read(out num2);
                type.Id = new DefinitionId(num2);
                return(type);

            case HeroTypes.String:
                return(type);

            case HeroTypes.List:
                type.Values = GetTypeFromJStream(stream);
                stream.CheckEnd();
                return(type);

            case HeroTypes.LookupList:
                type.Indexer = GetTypeFromJStream(stream);
                stream.CheckEnd();
                type.Values = GetTypeFromJStream(stream);
                stream.CheckEnd();
                return(type);
            }
            return(type);
        }
Beispiel #22
0
        public override void Serialize(PackedStream_2 stream)
        {
            ulong num1 = (ulong)this._08;
            long  num2 = 3735928559L;

            stream.Write(this._00);
            stream.Write(num1);
            stream.Write(this._0C);
            stream.Write(this._10);
            stream.Write(this._18);
            stream.Write(this._20);
            stream.Write(this._28);
            stream.Write(this._30);
            stream.Write(num2);
            stream.Write(this._38);
            if (num2 != 3735928559L)
            {
                return;
            }
            stream.Write(this._40);
            stream.Write(this._48);
        }
Beispiel #23
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));
                }
            }
        }
Beispiel #24
0
        public override void Deserialize(PackedStream_2 stream)
        {
            ulong num;
            long  num2;

            base.hasValue = true;
            stream.Read(out this._00);
            stream.Read(out num);
            stream.Read(out this._0C);
            stream.Read(out this._10);
            stream.Read(out this._18);
            stream.Read(out this._20);
            stream.Read(out this._28);
            stream.Read(out this._30);
            stream.Read(out num2);
            stream.Read(out this._38);
            if (num2 == 0xdeadbeefL)
            {
                stream.Read(out this._40);
                stream.Read(out this._48);
            }
            this._08 = (uint)num;
        }
Beispiel #25
0
        public static HeroType GetTypeFromJStream(PackedStream_2 stream)
        {
            ulong num;

            stream.ReadVersion(out num);
            if ((long)num != 0L)
            {
                throw new InvalidDataException("incorrect header token for creating HeroValueType");
            }
            ulong id;

            stream.Read(out id);
            HeroType heroType = new HeroType((HeroTypes)id);

            switch (heroType.Type)
            {
            case HeroTypes.Enum:
            case HeroTypes.Class:
            case HeroTypes.NodeRef:
                stream.Read(out id);
                heroType.Id = new DefinitionId(id);
                break;

            case HeroTypes.List:
                heroType.Values = HeroAnyValue.GetTypeFromJStream(stream);
                stream.CheckEnd();
                break;

            case HeroTypes.LookupList:
                heroType.Indexer = HeroAnyValue.GetTypeFromJStream(stream);
                stream.CheckEnd();
                heroType.Values = HeroAnyValue.GetTypeFromJStream(stream);
                stream.CheckEnd();
                break;
            }
            return(heroType);
        }
Beispiel #26
0
        public override void Deserialize(PackedStream_2 stream)
        {
            this.hasValue = true;
            stream.Read(out this._00);
            ulong num1;

            stream.Read(out num1);
            stream.Read(out this._0C);
            stream.Read(out this._10);
            stream.Read(out this._18);
            stream.Read(out this._20);
            stream.Read(out this._28);
            stream.Read(out this._30);
            long num2;

            stream.Read(out num2);
            stream.Read(out this._38);
            if (num2 == 3735928559L)
            {
                stream.Read(out this._40);
                stream.Read(out this._48);
            }
            this._08 = (uint)num1;
        }
Beispiel #27
0
 public override void Deserialize(PackedStream_2 stream)
 {
     stream.Read(out this.Value);
 }
Beispiel #28
0
 public override void Serialize(PackedStream_2 stream)
 {
     stream.Write(this.x);
     stream.Write(this.y);
     stream.Write(this.z);
 }
Beispiel #29
0
 public override void Serialize(PackedStream_2 stream)
 {
     stream.Write(this.Text);
 }
Beispiel #30
0
 public override void Deserialize(PackedStream_2 stream)
 {
     this.hasValue = true;
     stream.Read(out this.Text);
 }