/** Convert */ public static void Convert(ref System.Object a_to_refobject, System.Type a_to_type, JsonItem a_from_jsonitem, WorkPool a_workpool) { WorkPool t_workpool = a_workpool; if (t_workpool == null) { t_workpool = new WorkPool(); } { switch (a_from_jsonitem.GetValueType()) { case ValueType.StringData: { FromStringData.Convert(ref a_to_refobject, a_to_type, a_from_jsonitem); } break; case ValueType.SignedNumber: case ValueType.UnsignedNumber: case ValueType.FloatingNumber: case ValueType.DecimalNumber: case ValueType.BoolData: { FromNumber.Convert(ref a_to_refobject, a_to_type, a_from_jsonitem); } break; case ValueType.IndexArray: { FromIndexArray.Convert(ref a_to_refobject, a_to_type, a_from_jsonitem, t_workpool); } break; case ValueType.AssociativeArray: { FromAssociativeArray.Convert(ref a_to_refobject, a_to_type, a_from_jsonitem, t_workpool); } break; case ValueType.Null: { //NULL処理。 } break; default: { #if (DEF_BLUEBACK_JSONITEM_ASSERT) DebugTool.Assert(false); #endif } break; } } if (a_workpool == null) { t_workpool.Main(); } }
/** Convert */ public static void Convert(ref System.Object a_to_ref_object, System.Type a_to_type, JsonItem a_from_jsonitem, JsonItemToObject_WorkPool a_workpool) { JsonItemToObject_WorkPool t_workpool = a_workpool; if (t_workpool == null) { t_workpool = new JsonItemToObject_WorkPool(); } try{ switch (a_from_jsonitem.GetValueType()) { case ValueType.StringData: { JsonItemToObject_FromStringData.Convert(ref a_to_ref_object, a_to_type, a_from_jsonitem); } break; case ValueType.SignedNumber: case ValueType.UnsignedNumber: case ValueType.FloatingNumber: case ValueType.DecimalNumber: case ValueType.BoolData: { JsonItemToObject_FromNumber.Convert(ref a_to_ref_object, a_to_type, a_from_jsonitem); } break; case ValueType.IndexArray: { JsonItemToObject_FromIndexArray.Convert(ref a_to_ref_object, a_to_type, a_from_jsonitem, t_workpool); } break; case ValueType.AssociativeArray: { JsonItemToObject_FromAssociativeArray.Convert(ref a_to_ref_object, a_to_type, a_from_jsonitem, t_workpool); } break; case ValueType.Null: { //NULL処理。 } break; default: { Tool.Assert(false); } break; } }catch (System.Exception t_exception) { Tool.DebugReThrow(t_exception); } if (a_workpool == null) { t_workpool.Main(); } }
/** Convert */ public static void Convert(ref System.Object a_to_refobject, System.Type a_to_type, JsonItem a_from_jsonitem) { #pragma warning disable 0162 switch (a_to_type.FullName) { case "System." + nameof(System.Char): { a_to_refobject = a_from_jsonitem.CastToChar(); return; } break; case "System." + nameof(System.SByte): { a_to_refobject = a_from_jsonitem.CastToSbyte(); return; } break; case "System." + nameof(System.Byte): { a_to_refobject = a_from_jsonitem.CastToByte(); return; } break; case "System." + nameof(System.Int16): { a_to_refobject = a_from_jsonitem.CastToInt16(); return; } break; case "System." + nameof(System.UInt16): { a_to_refobject = a_from_jsonitem.CastToUint16(); return; } break; case "System." + nameof(System.Int32): { a_to_refobject = a_from_jsonitem.CastToInt32(); return; } break; case "System." + nameof(System.UInt32): { a_to_refobject = a_from_jsonitem.CastToUint32(); return; } break; case "System." + nameof(System.Int64): { a_to_refobject = a_from_jsonitem.CastToInt64(); return; } break; case "System." + nameof(System.UInt64): { a_to_refobject = a_from_jsonitem.CastToUint64(); return; } break; case "System." + nameof(System.Single): { a_to_refobject = a_from_jsonitem.CastToSingle(); return; } break; case "System." + nameof(System.Double): { a_to_refobject = a_from_jsonitem.CastToDouble(); return; } break; case "System." + nameof(System.Boolean): { a_to_refobject = a_from_jsonitem.CastToBoolData(); return; } break; case "System." + nameof(System.Decimal): { a_to_refobject = a_from_jsonitem.CastToDecimal(); return; } break; case "System." + nameof(System.String): { switch (a_from_jsonitem.GetValueType()) { case ValueType.SignedNumber: { a_to_refobject = a_from_jsonitem.GetSignedNumber().ToString(); return; } break; case ValueType.UnsignedNumber: { a_to_refobject = a_from_jsonitem.GetUnsignedNumber().ToString(); return; } break; case ValueType.FloatingNumber: { a_to_refobject = a_from_jsonitem.GetFloatingNumber().ToString(); return; } break; case ValueType.DecimalNumber: { a_to_refobject = a_from_jsonitem.GetDecimalNumber().ToString(); return; } break; case ValueType.BoolData: { a_to_refobject = a_from_jsonitem.GetBoolData().ToString(); return; } break; default: { //失敗。 #if (DEF_BLUEBACK_JSONITEM_ASSERT) DebugTool.Assert(false); #endif return; } break; } } break; default: { if (a_to_type.IsEnum == true) { System.Enum t_enum = (System.Enum)a_to_refobject; if (t_enum != null) { switch (t_enum.GetTypeCode()) { case System.TypeCode.Byte: { a_to_refobject = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToByte()); return; } break; case System.TypeCode.SByte: { a_to_refobject = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToSbyte()); return; } break; case System.TypeCode.Int16: { a_to_refobject = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToInt16()); return; } break; case System.TypeCode.UInt16: { a_to_refobject = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToUint16()); return; } break; case System.TypeCode.Int32: { a_to_refobject = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToInt32()); return; } break; case System.TypeCode.UInt32: { a_to_refobject = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToUint32()); return; } break; case System.TypeCode.Int64: { a_to_refobject = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToInt64()); return; } break; case System.TypeCode.UInt64: { a_to_refobject = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToUint64()); return; } break; default: { //失敗。 #if (DEF_BLUEBACK_JSONITEM_ASSERT) DebugTool.Assert(false); #endif return; } break; } } else { //失敗。 #if (DEF_BLUEBACK_JSONITEM_ASSERT) DebugTool.Assert(false); #endif return; } } else { //失敗。 #if (DEF_BLUEBACK_JSONITEM_ASSERT) DebugTool.Assert(false); #endif return; } } break; } #pragma warning restore }
/** Convert */ public static void Convert(ref System.Object a_to_ref_object, System.Type a_to_type, JsonItem a_from_jsonitem) { try{ switch (a_to_type.FullName) { case "System." + nameof(System.Char): { a_to_ref_object = a_from_jsonitem.CastToChar(); return; } break; case "System." + nameof(System.SByte): { a_to_ref_object = a_from_jsonitem.CastToSbyte(); return; } break; case "System." + nameof(System.Byte): { a_to_ref_object = a_from_jsonitem.CastToByte(); return; } break; case "System." + nameof(System.Int16): { a_to_ref_object = a_from_jsonitem.CastToInt16(); return; } break; case "System." + nameof(System.UInt16): { a_to_ref_object = a_from_jsonitem.CastToUint16(); return; } break; case "System." + nameof(System.Int32): { a_to_ref_object = a_from_jsonitem.CastToInt32(); return; } break; case "System." + nameof(System.UInt32): { a_to_ref_object = a_from_jsonitem.CastToUint32(); return; } break; case "System." + nameof(System.Int64): { a_to_ref_object = a_from_jsonitem.CastToInt64(); return; } break; case "System." + nameof(System.UInt64): { a_to_ref_object = a_from_jsonitem.CastToUint64(); return; } break; case "System." + nameof(System.Single): { a_to_ref_object = a_from_jsonitem.CastToSingle(); return; } break; case "System." + nameof(System.Double): { a_to_ref_object = a_from_jsonitem.CastToDouble(); return; } break; case "System." + nameof(System.Boolean): { a_to_ref_object = a_from_jsonitem.CastToBoolData(); return; } break; case "System." + nameof(System.Decimal): { a_to_ref_object = a_from_jsonitem.CastToDecimal(); return; } break; case "System." + nameof(System.String): { switch (a_from_jsonitem.GetValueType()) { case ValueType.SignedNumber: { a_to_ref_object = a_from_jsonitem.GetSignedNumber().ToString(); return; } break; case ValueType.UnsignedNumber: { a_to_ref_object = a_from_jsonitem.GetUnsignedNumber().ToString(); return; } break; case ValueType.FloatingNumber: { a_to_ref_object = a_from_jsonitem.GetFloatingNumber().ToString(); return; } break; case ValueType.DecimalNumber: { a_to_ref_object = a_from_jsonitem.GetDecimalNumber().ToString(); return; } break; case ValueType.BoolData: { a_to_ref_object = a_from_jsonitem.GetBoolData().ToString(); return; } break; } } break; default: { if (a_to_type.IsEnum == true) { System.Enum t_enum = (System.Enum)a_to_ref_object; if (t_enum != null) { switch (t_enum.GetTypeCode()) { case System.TypeCode.Byte: { a_to_ref_object = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToByte()); return; } break; case System.TypeCode.SByte: { a_to_ref_object = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToSbyte()); return; } break; case System.TypeCode.Int16: { a_to_ref_object = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToInt16()); return; } break; case System.TypeCode.UInt16: { a_to_ref_object = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToUint16()); return; } break; case System.TypeCode.Int32: { a_to_ref_object = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToInt32()); return; } break; case System.TypeCode.UInt32: { a_to_ref_object = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToUint32()); return; } break; case System.TypeCode.Int64: { a_to_ref_object = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToInt64()); return; } break; case System.TypeCode.UInt64: { a_to_ref_object = System.Enum.ToObject(a_to_type, a_from_jsonitem.CastToUint64()); return; } break; } } } } break; } }catch (System.Exception t_exception) { Tool.DebugReThrow(t_exception); } //失敗。 Tool.Assert(false); }