public static void ShowJSON(EmoteTable emoteTable) { var jsonTable = new JSON.EmoteTable(emoteTable); var json = BuildJSON(jsonTable); Console.WriteLine(json); }
public static void OutputJSON(JSON.EmoteTable emoteTable, FileInfo jsonFile) { var json = BuildJSON(emoteTable); File.WriteAllText(jsonFile.FullName, json); Console.WriteLine($"Compiled {jsonFile.FullName}"); }
public static string BuildJSON(JSON.EmoteTable emoteTable) { var settings = new JsonSerializerSettings(); settings.NullValueHandling = NullValueHandling.Ignore; settings.Formatting = Formatting.Indented; //settings.ContractResolver = new LowercaseContractResolver(); return(JsonConvert.SerializeObject(emoteTable, settings)); }
public EmoteTable(JSON.EmoteTable emoteTable) { EmoteSets = new List <EmoteSet>(); foreach (var categorySets in emoteTable.emoteTable) { foreach (var emoteSet in categorySets.value) { EmoteSets.Add(new EmoteSet(emoteSet)); } } }
public static void es2json(EmoteTable emoteTable, FileInfo esFile) { var jsonFilename = Path.ChangeExtension(esFile.FullName, ".json"); var jsonFile = new FileInfo(jsonFilename); emoteTable.NormalRange(); var jsonTable = new JSON.EmoteTable(emoteTable); // check if file already exists? // output json file OutputJSON(jsonTable, jsonFile); }
public static string es2json(string[] esLines, uint?wcid = null) { var emoteTable = new EmoteTable(); emoteTable.EmoteSets = Parser.ParseLines(esLines); if (emoteTable.EmoteSets == null) { return(null); } emoteTable.Wcid = wcid; emoteTable.NormalRange(); var jsonTable = new JSON.EmoteTable(emoteTable); var jsonLines = BuildJSON(jsonTable); return(jsonLines); }