static void SetArrayValue(Array array, int arrayIndex, DBClientHelper helper, DB6BinaryReader reader, int field) { switch (Type.GetTypeCode(helper.RealType)) { case TypeCode.SByte: helper.SetValue(array, reader.ReadSByte(), arrayIndex); break; case TypeCode.Byte: helper.SetValue(array, reader.ReadByte(), arrayIndex); break; case TypeCode.Int16: helper.SetValue(array, reader.ReadInt16(), arrayIndex); break; case TypeCode.UInt16: helper.SetValue(array, reader.ReadUInt16(), arrayIndex); break; case TypeCode.Int32: helper.SetValue(array, reader.GetInt32(_header.GetFieldBytes(field)), arrayIndex); break; case TypeCode.UInt32: helper.SetValue(array, reader.GetUInt32(_header.GetFieldBytes(field)), arrayIndex); break; case TypeCode.Single: helper.SetValue(array, reader.ReadSingle(), arrayIndex); break; case TypeCode.String: helper.SetValue(array, GetString(reader, field), arrayIndex); break; default: Log.outError(LogFilter.ServerLoading, "Wrong Array Type: {0}", helper.FieldType.Name); break; } }
static void SetValue(object obj, DBClientHelper helper, DB6BinaryReader reader, int field) { switch (Type.GetTypeCode(helper.RealType)) { case TypeCode.SByte: helper.SetValue(obj, reader.ReadSByte()); break; case TypeCode.Byte: helper.SetValue(obj, reader.ReadByte()); break; case TypeCode.Int16: helper.SetValue(obj, reader.ReadInt16()); break; case TypeCode.UInt16: helper.SetValue(obj, reader.ReadUInt16()); break; case TypeCode.Int32: helper.SetValue(obj, reader.GetInt32(_header.GetFieldBytes(field))); break; case TypeCode.UInt32: helper.SetValue(obj, reader.GetUInt32(_header.GetFieldBytes(field))); break; case TypeCode.Single: helper.SetValue(obj, reader.ReadSingle()); break; case TypeCode.String: string str = GetString(reader, field); helper.SetValue(obj, str); break; case TypeCode.Object: switch (helper.FieldType.Name) { case "Vector2": helper.SetValue(obj, new Vector2(reader.ReadSingle(), reader.ReadSingle())); break; case "Vector3": helper.SetValue(obj, new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle())); break; case "LocalizedString": LocalizedString locString = new LocalizedString(); locString[Global.WorldMgr.GetDefaultDbcLocale()] = GetString(reader, field); helper.SetValue(obj, locString); break; default: Log.outError(LogFilter.ServerLoading, "Wrong Array Type: {0}", helper.FieldType.Name); break; } break; default: Log.outError(LogFilter.ServerLoading, "Wrong Array Type: {0}", helper.FieldType.Name); break; } }