private void listViewVariables_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { this.labelFieldDesc.Text = ""; this.labelType.Text = ""; this.labelTypeDesc.Text = ""; if (e.IsSelected && (e.Item != null)) { HeroAnyValue tag = e.Item.Tag as HeroAnyValue; Variable variable = e.Item.Tag as Variable; if (variable != null) { if (variable.Field.Definition != null) { this.labelFieldDesc.Text = variable.Field.Definition.Description; } tag = variable.Value; } if ((tag != null) && (tag.Type.Id != null)) { if (tag.Type.Id.Definition != null) { this.labelType.Text = tag.Type.Id.Definition.Type.ToString(); this.labelTypeDesc.Text = tag.Type.Id.Definition.Description; } else { this.labelType.Text = string.Format("0x{0}", tag.Type.Id.Id); } } } }
public bool GetKeyString(out HeroAnyValue key, out int variableId) { key = HeroAnyValue.Create(new HeroType(HeroTypes.String)); if (base.Stream.TransportVersion > 1) { if (base.Stream.Peek() == 210) { base.Stream.ReadByte(); key.Deserialize(base.Stream); } else { ulong num; base.Stream.Read(out num); (key as HeroString).Text = string.Format("{0}", num); } } else if (base.Stream.Peek() == 0x89) { key.Deserialize(base.Stream); } else { ulong num2; base.Stream.Read(out num2); (key as HeroString).Text = string.Format("{0}", num2); } variableId = base.ReadVariableId(); return(true); }
public bool GetKeyString(out HeroAnyValue key, out int variableId) { key = HeroAnyValue.Create(new HeroType(HeroTypes.String)); if ((int)this.Stream.TransportVersion > 1) { if ((int)this.Stream.Peek() == 210) { int num = (int)this.Stream.ReadByte(); key.Deserialize(this.Stream); } else { ulong num; this.Stream.Read(out num); (key as HeroString).Text = string.Format("{0}", (object)num); } } else if ((int)this.Stream.Peek() == 137) { key.Deserialize(this.Stream); } else { ulong num; this.Stream.Read(out num); (key as HeroString).Text = string.Format("{0}", (object)num); } variableId = this.ReadVariableId(); return(true); }
public bool GetKey(out HeroAnyValue key, out int variableId) { if ((this.indexerType.Type == HeroTypes.String) || (this.indexerType.Type == HeroTypes.None)) { return(this.GetKeyString(out key, out variableId)); } return(this.GetKeyInt(out key, out variableId)); }
public void Add(HeroAnyValue obj) { if (obj.ID < this.start || obj.ID >= this.end) { throw new Exception("Object has a wrong ID for this space"); } this.objects[obj.ID] = obj; }
private void SetValueText(HeroAnyValue value, int indent, ListViewItem item) { string text = ""; item.Tag = value; switch (value.Type.Type) { case HeroTypes.Id: { text = (value as HeroID).ValueText; HeroID oid = value as HeroID; if (GOM.Instance.Definitions.ContainsKey(oid.Id)) { object obj2 = text; text = string.Concat(new object[] { obj2, " (", GOM.Instance.Definitions[oid.Id], ")" }); } break; } case HeroTypes.Integer: { text = (value as HeroInt).ValueText; HeroInt num = value as HeroInt; if (GOM.Instance.Definitions.ContainsKey((ulong)num.Value)) { object obj3 = text; text = string.Concat(new object[] { obj3, " (", GOM.Instance.Definitions[(ulong)num.Value], ")" }); } break; } case HeroTypes.List: { HeroList list = value as HeroList; this.AddList(list, indent + 1); break; } case HeroTypes.LookupList: { HeroLookupList list2 = value as HeroLookupList; this.AddLookupList(list2, indent + 1); break; } case HeroTypes.Class: { HeroClass class2 = value as HeroClass; this.AddVariables(class2.Variables, indent + 1); break; } default: text = value.ValueText; break; } item.SubItems.Add(text); }
public bool GetKey(out HeroAnyValue key, out int variableId) { if (indexerType.Type == HeroTypes.String || indexerType.Type == HeroTypes.None) { return(GetKeyString(out key, out variableId)); } else { return(GetKeyInt(out key, out variableId)); } }
public void SetKey(HeroAnyValue key, int variableId) { switch (key.Type.Type) { case HeroTypes.Id: this.SetKeyInt((key as HeroID).Id, variableId); return; case HeroTypes.Integer: this.SetKeyInt((ulong)(key as HeroInt).Value, variableId); return; case HeroTypes.Enum: this.SetKeyInt((key as HeroEnum).Value, variableId); return; case HeroTypes.String: this.SetKeyString((key as HeroString).Text, variableId); return; } throw new NotImplementedException(); }
public Variable(DefinitionId field, int variableId, HeroAnyValue value) { this.Field = field; this.VariableId = variableId; this.Value = value; }
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)); } } } }
private void SetValueText(HeroAnyValue value, int indent, ListViewItem item) { string text = ""; item.Tag = value; switch (value.Type.Type) { case HeroTypes.Id: { text = (value as HeroID).ValueText; HeroID oid = value as HeroID; if (GOM.Instance.Definitions.ContainsKey(oid.Id)) { object obj2 = text; text = string.Concat(new object[] { obj2, " (", GOM.Instance.Definitions[oid.Id], ")" }); } break; } case HeroTypes.Integer: { text = (value as HeroInt).ValueText; HeroInt num = value as HeroInt; if (GOM.Instance.Definitions.ContainsKey((ulong) num.Value)) { object obj3 = text; text = string.Concat(new object[] { obj3, " (", GOM.Instance.Definitions[(ulong) num.Value], ")" }); } break; } case HeroTypes.List: { HeroList list = value as HeroList; this.AddList(list, indent + 1); break; } case HeroTypes.LookupList: { HeroLookupList list2 = value as HeroLookupList; this.AddLookupList(list2, indent + 1); break; } case HeroTypes.Class: { HeroClass class2 = value as HeroClass; this.AddVariables(class2.Variables, indent + 1); break; } default: text = value.ValueText; break; } item.SubItems.Add(text); }
public bool GetKeyInt(out HeroAnyValue key, out int variableId) { key = HeroAnyValue.Create(this.indexerType); if (base.Stream.TransportVersion > 1) { if (base.Stream.Peek() == 210) { base.Stream.ReadByte(); HeroAnyValue value2 = HeroAnyValue.Create(new HeroType(HeroTypes.String)); value2.Deserialize(base.Stream); if (this.indexerType.Type != HeroTypes.Enum) { if (this.indexerType.Type != HeroTypes.Integer) { if (this.indexerType.Type != HeroTypes.Id) { throw new InvalidDataException("Invalid key type"); } (key as HeroID).ID = Convert.ToUInt64((value2 as HeroString).Text); } else { (key as HeroInt).Value = Convert.ToInt64((value2 as HeroString).Text); } } else { (key as HeroEnum).Value = Convert.ToUInt64((value2 as HeroString).Text); } } else { ulong num; base.Stream.Read(out num); if (this.indexerType.Type == HeroTypes.Enum) { (key as HeroEnum).Value = num; } else if (this.indexerType.Type == HeroTypes.Integer) { (key as HeroInt).Value = (long)num; } else { if (this.indexerType.Type != HeroTypes.Id) { throw new InvalidDataException("Invalid key type"); } (key as HeroID).Id = num; } key.hasValue = true; } } else if (base.Stream.Peek() == 0x89) { HeroAnyValue value3 = HeroAnyValue.Create(new HeroType(HeroTypes.String)); value3.Deserialize(base.Stream); if (this.indexerType.Type != HeroTypes.Enum) { if (this.indexerType.Type != HeroTypes.Integer) { if (this.indexerType.Type != HeroTypes.Id) { throw new InvalidDataException("Invalid key type"); } (key as HeroID).Id = Convert.ToUInt64((value3 as HeroString).Text); } else { (key as HeroInt).Value = Convert.ToInt64((value3 as HeroString).Text); } } else { (key as HeroEnum).Value = Convert.ToUInt64((value3 as HeroString).Text); } } else { ulong num2; base.Stream.Read(out num2); if (this.indexerType.Type == HeroTypes.Enum) { (key as HeroEnum).Value = num2; } else if (this.indexerType.Type == HeroTypes.Integer) { (key as HeroInt).Value = (long)num2; } else { if (this.indexerType.Type != HeroTypes.Id) { throw new InvalidDataException("Invalid key type"); } (key as HeroID).Id = num2; } key.hasValue = true; } variableId = base.ReadVariableId(); return(true); }
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)); } } }