-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSONHelper.cs
More file actions
27 lines (24 loc) · 813 Bytes
/
Copy pathJSONHelper.cs
File metadata and controls
27 lines (24 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using Newtonsoft.Json;
using System.Collections.Generic;
using System.IO;
namespace DabSquadBot
{
//Hidden data class, used for Global vars
public class Data
{
public List<string> DabImages { get; set; }
}
public class JSONHelper
{
//Write vars to json file
public void JsonSerialize(Data hiddenData)
{
File.WriteAllText(Global.filePath + "Data.json", JsonConvert.SerializeObject(hiddenData, Formatting.Indented, new Newtonsoft.Json.Converters.StringEnumConverter()));
}
//Read vars from Json file
public Data JsonDeserialize()
{
return JsonConvert.DeserializeObject<Data>(File.ReadAllText(Global.filePath + "Data.json"), new Newtonsoft.Json.Converters.StringEnumConverter());
}
}
}