Added garbage to attempt to update json field name.
This commit is contained in:
parent
fc70cb90d8
commit
67a00716f8
|
@ -0,0 +1,34 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft;
|
||||||
|
|
||||||
|
namespace Server.LegacyJsonSupport
|
||||||
|
{
|
||||||
|
public class LogToAdminJsonConverter : JsonConverter<string>
|
||||||
|
{
|
||||||
|
public override string? ReadJson(JsonReader reader, Type objectType, string? existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
//JToken t = JToken.Load(reader);
|
||||||
|
if (reader.TokenType != JsonToken.String)
|
||||||
|
return null;
|
||||||
|
//JObject j = JObject.Load(reader);
|
||||||
|
//string? k = reader.ReadAsString();
|
||||||
|
//if (k == "LogChannel" || k == "AdminChannel")
|
||||||
|
return hasExistingValue ? existingValue : (string?)reader.Value;
|
||||||
|
//else
|
||||||
|
// return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void WriteJson(JsonWriter writer, string? value, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
//writer.
|
||||||
|
//writer.WritePropertyName("AdminChannel");
|
||||||
|
writer.WriteValue(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
using Shared;
|
using Shared;
|
||||||
|
using Server.LegacyJsonSupport;
|
||||||
|
|
||||||
namespace Server;
|
namespace Server;
|
||||||
|
|
||||||
|
@ -74,7 +75,8 @@ public class Settings {
|
||||||
public string? Token { get; set; }
|
public string? Token { get; set; }
|
||||||
public string Prefix { get; set; } = "$";
|
public string Prefix { get; set; } = "$";
|
||||||
public string? CommandChannel { get; set; }
|
public string? CommandChannel { get; set; }
|
||||||
[JsonProperty(PropertyName = "LogChannel")]
|
[JsonProperty(PropertyName = "AdminChannel")]
|
||||||
|
[JsonConverter(typeof(LogToAdminJsonConverter))]
|
||||||
public string? AdminChannel { get; set; }
|
public string? AdminChannel { get; set; }
|
||||||
public bool LogCommands { get; set; } = false;
|
public bool LogCommands { get; set; } = false;
|
||||||
public bool FilterOutNonIssueWarnings { get; set; } = true;
|
public bool FilterOutNonIssueWarnings { get; set; } = true;
|
||||||
|
|
Loading…
Reference in New Issue