/// <summary> /// BotConfig is a singleton instance, so call this to get the current instance settings. /// </summary> /// <returns></returns> public static BotConfig Instance() { if (instance == null) { instance = new BotConfig(); } return instance; }
public static void Load(string path) { JsonTextReader reader = new JsonTextReader(new StreamReader(path)); JsonSerializer serializer = new JsonSerializer(); instance = serializer.Deserialize<BotConfig>(reader); reader.Close(); }
public static void Save(string path) { if (instance == null) { instance = new BotConfig(); } JsonTextWriter writer = new JsonTextWriter(new StreamWriter(path)); JsonSerializer serializer = new JsonSerializer(); serializer.Formatting = Formatting.Indented; serializer.Serialize(writer, instance); writer.Close(); }
public static void Clear() { instance = new BotConfig(); }