private object ReadObject() { int num = this.ReadInt(); bool flag = (num & 1) != 0; num >>= 1; if (flag) { bool flag2 = (num & 1) != 0; num >>= 1; ClassDefinition classDefinition; if (flag2) { classDefinition = new ClassDefinition(); classDefinition.type = this.ReadString(); classDefinition.externalizable = ((num & 1) != 0); num >>= 1; classDefinition.dynamic = ((num & 1) != 0); num >>= 1; for (int i = 0; i < num; i++) { classDefinition.members.Add(this.ReadString()); } this.classDefinitions.Add(classDefinition); } else { classDefinition = this.classDefinitions[num]; } TypedObject typedObject = new TypedObject(classDefinition.type); this.objectReferences.Add(typedObject); if (classDefinition.externalizable) { if (classDefinition.type.Equals("DSK")) { typedObject = this.ReadDSK(); } else if (classDefinition.type.Equals("DSA")) { typedObject = this.ReadDSA(); } else if (classDefinition.type.Equals("flex.messaging.io.ArrayCollection")) { object obj = this.Decode(); typedObject = TypedObject.MakeArrayCollection((object[])obj); } else { if (!classDefinition.type.Equals("com.riotgames.platform.systemstate.ClientSystemStatesNotification") && !classDefinition.type.Equals("com.riotgames.platform.broadcast.BroadcastNotification")) { throw new NotImplementedException("Externalizable not handled for " + classDefinition.type); } int num2 = 0; for (int j = 0; j < 4; j++) { num2 = num2 * 256 + this.ReadByteAsInt(); } byte[] array = this.ReadBytes(num2); StringBuilder stringBuilder = new StringBuilder(); for (int k = 0; k < array.Length; k++) { stringBuilder.Append(Convert.ToChar(array[k])); } JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); typedObject = javaScriptSerializer.Deserialize <TypedObject>(stringBuilder.ToString()); typedObject.type = classDefinition.type; } } else { for (int l = 0; l < classDefinition.members.Count; l++) { string key = classDefinition.members[l]; object value = this.Decode(); typedObject.Add(key, value); } if (classDefinition.dynamic) { string key2; while ((key2 = this.ReadString()).Length != 0) { object value2 = this.Decode(); typedObject.Add(key2, value2); } } } return(typedObject); } return(this.objectReferences[num]); }
private object ReadObject() { ClassDefinition definition; int num = this.ReadInt(); num = num >> 1; if ((num & 1) <= 0) { return(this.objectReferences[num]); } num = num >> 1; if ((num & 1) > 0) { definition = new ClassDefinition { type = this.ReadString(), externalizable = (num & 1) > 0 }; num = num >> 1; definition.dynamic = (num & 1) > 0; num = num >> 1; for (int j = 0; j < num; j++) { definition.members.Add(this.ReadString()); } this.classDefinitions.Add(definition); } else { definition = this.classDefinitions[num]; } TypedObject item = new TypedObject(definition.type); this.objectReferences.Add(item); if (definition.externalizable) { if (definition.type.Equals("DSK")) { return(this.ReadDSK()); } if (definition.type.Equals("DSA")) { return(this.ReadDSA()); } if (definition.type.Equals("flex.messaging.io.ArrayCollection")) { return(TypedObject.MakeArrayCollection((object[])this.Decode())); } if (!definition.type.Equals("com.riotgames.platform.systemstate.ClientSystemStatesNotification") && !definition.type.Equals("com.riotgames.platform.broadcast.BroadcastNotification")) { throw new NotImplementedException("Externalizable not handled for " + definition.type); } int length = 0; for (int k = 0; k < 4; k++) { length = (length * 0x100) + this.ReadByteAsInt(); } byte[] buffer = this.ReadBytes(length); StringBuilder builder = new StringBuilder(); for (int m = 0; m < buffer.Length; m++) { builder.Append(Convert.ToChar(buffer[m])); } item = new JavaScriptSerializer().Deserialize <TypedObject>(builder.ToString()); item.type = definition.type; return(item); } for (int i = 0; i < definition.members.Count; i++) { string key = definition.members[i]; object obj3 = this.Decode(); item.Add(key, obj3); } if (definition.dynamic) { string str2; while ((str2 = this.ReadString()).Length != 0) { object obj4 = this.Decode(); item.Add(str2, obj4); } } return(item); }
private object ReadObject() { int handle = ReadInt(); bool inline = ((handle & 1) != 0); handle = handle >> 1; if (inline) { bool inlineDefine = ((handle & 1) != 0); handle = handle >> 1; ClassDefinition cd; if (inlineDefine) { cd = new ClassDefinition(); cd.type = ReadString(); cd.externalizable = ((handle & 1) != 0); handle = handle >> 1; cd.dynamic = ((handle & 1) != 0); handle = handle >> 1; for (int i = 0; i < handle; i++) { cd.members.Add(ReadString()); } classDefinitions.Add(cd); } else { cd = classDefinitions[handle]; } TypedObject ret = new TypedObject(cd.type); // Need to add reference here due to circular references objectReferences.Add(ret); if (cd.externalizable) { if (cd.type.Equals("DSK")) { ret = ReadDSK(); } else if (cd.type.Equals("DSA")) { ret = ReadDSA(); } else if (cd.type.Equals("flex.messaging.io.ArrayCollection")) { object obj = Decode(); ret = TypedObject.MakeArrayCollection((object[])obj); } else if (cd.type.Equals("com.riotgames.platform.systemstate.ClientSystemStatesNotification") || cd.type.Equals("com.riotgames.platform.broadcast.BroadcastNotification")) { int size = 0; for (int i = 0; i < 4; i++) { size = size * 256 + ReadByteAsInt(); } byte[] data = ReadBytes(size); StringBuilder sb = new StringBuilder(); for (int i = 0; i < data.Length; i++) { sb.Append(Convert.ToChar(data[i])); } JavaScriptSerializer serializer = new JavaScriptSerializer(); ret = serializer.Deserialize <TypedObject>(sb.ToString()); ret.type = cd.type; } else { //for (int i = dataPos; i < dataBuffer.length; i++) //System.out.print(String.format("%02X", dataBuffer[i])); //System.out.println(); throw new NotImplementedException("Externalizable not handled for " + cd.type); } } else { for (int i = 0; i < cd.members.Count; i++) { String key = cd.members[i]; object value = Decode(); ret.Add(key, value); } if (cd.dynamic) { String key; while ((key = ReadString()).Length != 0) { object value = Decode(); ret.Add(key, value); } } } return(ret); } else { return(objectReferences[handle]); } }