Exemplo n.º 1
0
 /// <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;
 }
Exemplo n.º 2
0
        public static void Load(string path)
        {
            
            JsonTextReader reader = new JsonTextReader(new StreamReader(path));

            JsonSerializer serializer = new JsonSerializer();
            instance = serializer.Deserialize<BotConfig>(reader);
            reader.Close();
        }
Exemplo n.º 3
0
        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();

        }
Exemplo n.º 4
0
 public static void Clear()
 {
     instance = new BotConfig();
 }
Exemplo n.º 5
0
 public static void Clear()
 {
     instance = new BotConfig();
 }