mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 12:38:00 +00:00
Improve ipc (#102)
This commit is contained in:
1 parent
47f5756e5a
commit
fc64c0b505
81 files changed
+2408
-799
No files matched your search
@@ -0,0 +1,27 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace AIStudio.Tools;
|
||||
|
||||
public sealed class EncryptedTextJsonConverter : JsonConverter<EncryptedText>
|
||||
{
|
||||
#region Overrides of JsonConverter<EncryptedText>
|
||||
|
||||
public override EncryptedText Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType is JsonTokenType.String)
|
||||
{
|
||||
var value = reader.GetString()!;
|
||||
return new EncryptedText(value);
|
||||
}
|
||||
|
||||
throw new JsonException($"Unexpected token type when parsing EncryptedText. Expected {JsonTokenType.String}, but got {reader.TokenType}.");
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, EncryptedText value, JsonSerializerOptions options)
|
||||
{
|
||||
writer.WriteStringValue(value.EncryptedData);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in new issue
Block a user