-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
455 additions
and
573 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
src/Artemis.Core/JsonConverters/ForgivingVersionConverter.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
using System; | ||
using Newtonsoft.Json; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Artemis.Core.JsonConverters; | ||
|
||
internal class NumericJsonConverter : JsonConverter<Numeric> | ||
namespace Artemis.Core.JsonConverters | ||
{ | ||
#region Overrides of JsonConverter<Numeric> | ||
|
||
/// <inheritdoc /> | ||
public override void WriteJson(JsonWriter writer, Numeric value, JsonSerializer serializer) | ||
internal class NumericJsonConverter : JsonConverter<Numeric> | ||
{ | ||
float floatValue = value; | ||
writer.WriteValue(floatValue); | ||
} | ||
public override void Write(Utf8JsonWriter writer, Numeric value, JsonSerializerOptions options) | ||
{ | ||
float floatValue = value; | ||
writer.WriteNumberValue(floatValue); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override Numeric ReadJson(JsonReader reader, Type objectType, Numeric existingValue, bool hasExistingValue, JsonSerializer serializer) | ||
{ | ||
return new Numeric(reader.Value); | ||
} | ||
public override Numeric Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | ||
{ | ||
if (reader.TokenType != JsonTokenType.Number) | ||
{ | ||
throw new JsonException($"Expected a number token, but got {reader.TokenType}."); | ||
} | ||
|
||
#endregion | ||
float floatValue = reader.GetSingle(); | ||
return new Numeric(floatValue); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
using System; | ||
using Newtonsoft.Json; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
using SkiaSharp; | ||
|
||
namespace Artemis.Core.JsonConverters; | ||
|
||
internal class SKColorConverter : JsonConverter<SKColor> | ||
namespace Artemis.Core.JsonConverters | ||
{ | ||
public override void WriteJson(JsonWriter writer, SKColor value, JsonSerializer serializer) | ||
internal class SKColorConverter : JsonConverter<SKColor> | ||
{ | ||
writer.WriteValue(value.ToString()); | ||
} | ||
public override void Write(Utf8JsonWriter writer, SKColor value, JsonSerializerOptions options) | ||
{ | ||
writer.WriteStringValue(value.ToString()); | ||
} | ||
|
||
public override SKColor ReadJson(JsonReader reader, Type objectType, SKColor existingValue, bool hasExistingValue, JsonSerializer serializer) | ||
{ | ||
if (reader.Value is string value && !string.IsNullOrWhiteSpace(value)) | ||
return SKColor.Parse(value); | ||
public override SKColor Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | ||
{ | ||
if (reader.TokenType != JsonTokenType.String) | ||
{ | ||
throw new JsonException($"Expected a string token, but got {reader.TokenType}."); | ||
} | ||
|
||
return SKColor.Empty; | ||
string colorString = reader.GetString() ?? string.Empty; | ||
return SKColor.TryParse(colorString, out SKColor color) ? color : SKColor.Empty; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
src/Artemis.Core/Models/ProfileConfiguration/ProfileConfigurationExportModel.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.