public static object ReadVariable(this ZPackage zp, Type t) { if (t == typeof(int)) { return(zp.ReadInt()); } if (t == typeof(uint)) { return(zp.ReadUInt()); } if (t == typeof(bool)) { return(zp.ReadBool()); } if (t == typeof(char)) { return(zp.ReadChar()); } if (t == typeof(sbyte)) { return(zp.ReadSByte()); } if (t == typeof(long)) { return(zp.ReadLong()); } if (t == typeof(ulong)) { return(zp.ReadULong()); } if (t == typeof(float)) { return(zp.ReadSingle()); } if (t == typeof(double)) { return(zp.ReadDouble()); } if (t == typeof(string)) { return(zp.ReadString()); } return(null); }
// Token: 0x06000918 RID: 2328 RVA: 0x0004377C File Offset: 0x0004197C public static void Deserialize(ParameterInfo[] paramInfo, ZPackage pkg, ref List <object> parameters) { for (int i = 1; i < paramInfo.Length; i++) { ParameterInfo parameterInfo = paramInfo[i]; if (parameterInfo.ParameterType == typeof(int)) { parameters.Add(pkg.ReadInt()); } else if (parameterInfo.ParameterType == typeof(uint)) { parameters.Add(pkg.ReadUInt()); } else if (parameterInfo.ParameterType == typeof(long)) { parameters.Add(pkg.ReadLong()); } else if (parameterInfo.ParameterType == typeof(float)) { parameters.Add(pkg.ReadSingle()); } else if (parameterInfo.ParameterType == typeof(double)) { parameters.Add(pkg.ReadDouble()); } else if (parameterInfo.ParameterType == typeof(bool)) { parameters.Add(pkg.ReadBool()); } else if (parameterInfo.ParameterType == typeof(string)) { parameters.Add(pkg.ReadString()); } else if (parameterInfo.ParameterType == typeof(ZPackage)) { parameters.Add(pkg.ReadPackage()); } else if (parameterInfo.ParameterType == typeof(List <string>)) { int num = pkg.ReadInt(); List <string> list = new List <string>(num); for (int j = 0; j < num; j++) { list.Add(pkg.ReadString()); } parameters.Add(list); } else if (parameterInfo.ParameterType == typeof(Vector3)) { Vector3 vector = new Vector3(pkg.ReadSingle(), pkg.ReadSingle(), pkg.ReadSingle()); parameters.Add(vector); } else if (parameterInfo.ParameterType == typeof(Quaternion)) { Quaternion quaternion = new Quaternion(pkg.ReadSingle(), pkg.ReadSingle(), pkg.ReadSingle(), pkg.ReadSingle()); parameters.Add(quaternion); } else if (parameterInfo.ParameterType == typeof(ZDOID)) { parameters.Add(pkg.ReadZDOID()); } else if (parameterInfo.ParameterType == typeof(HitData)) { HitData hitData = new HitData(); hitData.Deserialize(ref pkg); parameters.Add(hitData); } } }