BotSharp/src/Infrastructure/BotSharp.Abstraction/Options/BotSharpOptions.cs

48 lines
1.1 KiB
C#
Raw Normal View History

2024-03-18 19:36:41 +00:00
using BotSharp.Abstraction.Messaging.JsonConverters;
using System.Text.Json;
namespace BotSharp.Abstraction.Options;
public class BotSharpOptions
{
private readonly static JsonSerializerOptions defaultJsonOptions = new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
AllowTrailingCommas = true,
WriteIndented = true,
Converters =
{
new RichContentJsonConverter(),
new TemplateMessageJsonConverter()
}
};
private JsonSerializerOptions _jsonSerializerOptions;
public JsonSerializerOptions JsonSerializerOptions
{
get
{
return _jsonSerializerOptions ?? defaultJsonOptions;
}
set
{
if (value == null)
{
_jsonSerializerOptions = defaultJsonOptions;
}
else
{
_jsonSerializerOptions = value;
}
}
}
public BotSharpOptions()
{
}
}