Skip to content

Commit

Permalink
Merge branch 'viceroypenguin-numberhandling'
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveDunn committed Oct 20, 2023
2 parents 85a6d00 + 1453c3f commit f939bd3
Show file tree
Hide file tree
Showing 61,881 changed files with 490,218 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 8 additions & 0 deletions src/Vogen/Templates/Byte/Byte_SystemTextJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ class VOTYPESystemTextJsonConverter : global::System.Text.Json.Serialization.Jso
{
public override VOTYPE Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
__NORMAL__ return VOTYPE.Deserialize(
__NORMAL__ options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
__NORMAL__ ? global::System.Byte.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
__NORMAL__ : reader.GetByte()
__NORMAL__ );
#else
__NORMAL__ return VOTYPE.Deserialize(reader.GetByte());
#endif
__STRING__ return VOTYPE.Deserialize(global::System.Byte.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ class VOTYPESystemTextJsonConverter : global::System.Text.Json.Serialization.Jso
{
public override VOTYPE Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
__NORMAL__ return VOTYPE.Deserialize(
__NORMAL__ options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
__NORMAL__ ? global::System.Decimal.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
__NORMAL__ : reader.GetDecimal()
__NORMAL__ );
#else
__NORMAL__ return VOTYPE.Deserialize(reader.GetDecimal());
#endif
__STRING__ return VOTYPE.Deserialize(global::System.Decimal.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture));
}

Expand Down
8 changes: 8 additions & 0 deletions src/Vogen/Templates/Double/Double_SystemTextJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ class VOTYPESystemTextJsonConverter : global::System.Text.Json.Serialization.Jso
{
public override VOTYPE Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
__NORMAL__ return VOTYPE.Deserialize(
__NORMAL__ options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
__NORMAL__ ? global::System.Double.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
__NORMAL__ : reader.GetDouble()
__NORMAL__ );
#else
__NORMAL__ return VOTYPE.Deserialize(reader.GetDouble());
#endif
__STRING__ return VOTYPE.Deserialize(global::System.Double.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture));
}

Expand Down
8 changes: 8 additions & 0 deletions src/Vogen/Templates/Int/Int_SystemTextJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ class VOTYPESystemTextJsonConverter : global::System.Text.Json.Serialization.Jso
{
public override VOTYPE Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
__NORMAL__ return VOTYPE.Deserialize(
__NORMAL__ options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
__NORMAL__ ? global::System.Int32.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
__NORMAL__ : reader.GetInt32()
__NORMAL__ );
#else
__NORMAL__ return VOTYPE.Deserialize(reader.GetInt32());
#endif
__STRING__ return VOTYPE.Deserialize(global::System.Int32.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture));
}

Expand Down
8 changes: 8 additions & 0 deletions src/Vogen/Templates/Long/Long_SystemTextJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ class VOTYPESystemTextJsonConverter : global::System.Text.Json.Serialization.Jso
{
public override VOTYPE Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
__NORMAL__ return VOTYPE.Deserialize(
__NORMAL__ options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
__NORMAL__ ? global::System.Int64.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
__NORMAL__ : reader.GetInt64()
__NORMAL__ );
#else
__NORMAL__ return VOTYPE.Deserialize(reader.GetInt64());
#endif
__STRING__ return VOTYPE.Deserialize(global::System.Int64.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture));
}

Expand Down
8 changes: 8 additions & 0 deletions src/Vogen/Templates/Short/Short_SystemTextJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ class VOTYPESystemTextJsonConverter : global::System.Text.Json.Serialization.Jso
{
public override VOTYPE Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
__NORMAL__ return VOTYPE.Deserialize(
__NORMAL__ options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
__NORMAL__ ? global::System.Int16.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
__NORMAL__ : reader.GetInt16()
__NORMAL__ );
#else
__NORMAL__ return VOTYPE.Deserialize(reader.GetInt16());
#endif
__STRING__ return VOTYPE.Deserialize(global::System.Int16.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture));
}

Expand Down
8 changes: 8 additions & 0 deletions src/Vogen/Templates/Single/Single_SystemTextJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ class VOTYPESystemTextJsonConverter : global::System.Text.Json.Serialization.Jso
{
public override VOTYPE Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
__NORMAL__ return VOTYPE.Deserialize(
__NORMAL__ options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
__NORMAL__ ? global::System.Single.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
__NORMAL__ : reader.GetSingle()
__NORMAL__ );
#else
__NORMAL__ return VOTYPE.Deserialize(reader.GetSingle());
#endif
__STRING__ return VOTYPE.Deserialize(global::System.Single.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,15 @@ public global::System.Boolean Equals(MyVo other, global::System.Collections.Gene
{
public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
return MyVo.Deserialize(
options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
? global::System.Int32.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
: reader.GetInt32()
);
#else
return MyVo.Deserialize(reader.GetInt32());
#endif
}

public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,15 @@ public global::System.Boolean Equals(MyVo other, global::System.Collections.Gene
{
public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
return MyVo.Deserialize(
options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
? global::System.Int32.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
: reader.GetInt32()
);
#else
return MyVo.Deserialize(reader.GetInt32());
#endif
}

public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,15 @@ public global::System.Boolean Equals(MyVo other, global::System.Collections.Gene
{
public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
return MyVo.Deserialize(
options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
? global::System.Int32.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
: reader.GetInt32()
);
#else
return MyVo.Deserialize(reader.GetInt32());
#endif
}

public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,15 @@ public global::System.Boolean Equals(MyVo other, global::System.Collections.Gene
{
public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
return MyVo.Deserialize(
options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
? global::System.Int32.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
: reader.GetInt32()
);
#else
return MyVo.Deserialize(reader.GetInt32());
#endif
}

public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,15 @@ public global::System.Boolean Equals(MyVo other, global::System.Collections.Gene
{
public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
return MyVo.Deserialize(
options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
? global::System.Int32.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
: reader.GetInt32()
);
#else
return MyVo.Deserialize(reader.GetInt32());
#endif
}

public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,15 @@ public global::System.Boolean Equals(MyVo other, global::System.Collections.Gene
{
public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
return MyVo.Deserialize(
options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
? global::System.Int32.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
: reader.GetInt32()
);
#else
return MyVo.Deserialize(reader.GetInt32());
#endif
}

public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,15 @@ public global::System.Boolean Equals(MyVo other, global::System.Collections.Gene
{
public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
return MyVo.Deserialize(
options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
? global::System.Int32.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
: reader.GetInt32()
);
#else
return MyVo.Deserialize(reader.GetInt32());
#endif
}

public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,15 @@ public global::System.Boolean Equals(MyVo other, global::System.Collections.Gene
{
public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
return MyVo.Deserialize(
options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
? global::System.Int32.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
: reader.GetInt32()
);
#else
return MyVo.Deserialize(reader.GetInt32());
#endif
}

public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,15 @@ public global::System.Boolean Equals(MyVo other, global::System.Collections.Gene
{
public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
return MyVo.Deserialize(
options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
? global::System.Int32.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
: reader.GetInt32()
);
#else
return MyVo.Deserialize(reader.GetInt32());
#endif
}

public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,15 @@ public global::System.Boolean Equals(MyVo other, global::System.Collections.Gene
{
public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
return MyVo.Deserialize(
options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
? global::System.Int32.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
: reader.GetInt32()
);
#else
return MyVo.Deserialize(reader.GetInt32());
#endif
}

public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,15 @@ public global::System.Boolean Equals(MyVo other, global::System.Collections.Gene
{
public override MyVo Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
{
#if NET5_0_OR_GREATER
return MyVo.Deserialize(
options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString && reader.TokenType == global::System.Text.Json.JsonTokenType.String
? global::System.Int32.Parse(reader.GetString(), global::System.Globalization.NumberStyles.Any, global::System.Globalization.CultureInfo.InvariantCulture)
: reader.GetInt32()
);
#else
return MyVo.Deserialize(reader.GetInt32());
#endif
}

public override void Write(System.Text.Json.Utf8JsonWriter writer, MyVo value, global::System.Text.Json.JsonSerializerOptions options)
Expand Down
Loading

0 comments on commit f939bd3

Please sign in to comment.