add json support, custom client names

This commit is contained in:
Bitl 2024-02-14 19:12:23 -07:00
parent 27fe0e777d
commit cbc8520de1

View File

@ -1,4 +1,5 @@
using System; using Newtonsoft.Json;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
@ -11,10 +12,11 @@ namespace Novetus.Core
#region File Formats #region File Formats
public class FileFormat public class FileFormat
{ {
#region Client Information (Legacy) #region Client Information
[JsonObject(MemberSerialization.OptIn)]
public class ClientInfo public class ClientInfo
{ {
public class ClientPathDictionary public class ClientSpecificDictionary
{ {
private Dictionary<ScriptType, string> _dict = new Dictionary<ScriptType, string>(); private Dictionary<ScriptType, string> _dict = new Dictionary<ScriptType, string>();
@ -45,27 +47,54 @@ namespace Novetus.Core
public ClientInfo() public ClientInfo()
{ {
Name = "";
UsesPlayerName = true; UsesPlayerName = true;
UsesID = true; UsesID = true;
Description = ""; Description = "";
Warning = ""; Warning = "";
ClientPaths = new ClientPathDictionary(); ClientPaths = new ClientSpecificDictionary();
ClientMD5s = new ClientPathDictionary(); ClientMD5s = new ClientSpecificDictionary();
ScriptPaths = new ClientPathDictionary(); ScriptPaths = new ClientSpecificDictionary();
ScriptMD5s = new ClientPathDictionary(); ScriptMD5s = new ClientSpecificDictionary();
CommandLineArgs = new ClientPathDictionary(); CommandLineArgs = new ClientSpecificDictionary();
ClientTags = new List<ClientTag>(); ClientTags = new List<ClientTag>();
} }
[JsonProperty]
[JsonRequired]
public string Name { get; set; }
[JsonProperty]
public bool UsesPlayerName { get; set; } public bool UsesPlayerName { get; set; }
[JsonProperty]
public bool UsesID { get; set; } public bool UsesID { get; set; }
[JsonProperty]
public string Description { get; set; } public string Description { get; set; }
[JsonProperty]
public string Warning { get; set; } public string Warning { get; set; }
public ClientPathDictionary ClientPaths { get; set; }
public ClientPathDictionary ClientMD5s { get; set; } [JsonProperty]
public ClientPathDictionary ScriptPaths { get; set; } [JsonRequired]
public ClientPathDictionary ScriptMD5s { get; set; } public ClientSpecificDictionary ClientPaths { get; set; }
public ClientPathDictionary CommandLineArgs { get; set; }
[JsonProperty]
[JsonRequired]
public ClientSpecificDictionary ClientMD5s { get; set; }
[JsonProperty]
public ClientSpecificDictionary ScriptPaths { get; set; }
[JsonProperty]
public ClientSpecificDictionary ScriptMD5s { get; set; }
[JsonProperty]
[JsonRequired]
public ClientSpecificDictionary CommandLineArgs { get; set; }
[JsonProperty]
public List<ClientTag> ClientTags { get; set; } public List<ClientTag> ClientTags { get; set; }
} }
#endregion #endregion