private void LoadSavedDecks() { string path = Utils.GetTotalFileName(FileFolder, SavedDecksFileName); try { if (!Directory.Exists(FileFolder)) { Directory.CreateDirectory(FileFolder); } if (File.Exists(path)) { string fileText = File.ReadAllText(path, Encoding.ASCII); if (_debug) { Console.WriteLine("read " + path); } SavedDecks = JsonConvert.DeserializeObject <List <SavedDeck> >(fileText); if (_debug) { Console.WriteLine("loaded SavedDecks successfully."); } if (SavedDecks == null) { SavedDecks = new List <SavedDeck>(); } } else { Console.WriteLine("LoadSavedDecks file does not exist."); } } catch (System.Exception exc) { Console.WriteLine("Exception: Failed to load LoadSavedTables for " + path + "\n" + exc.ToString()); } }
private void LoadAccountSettings() { string settingsFile = AccountSettingsFileName; string path = Utils.GetTotalFileName(FileFolder, settingsFile); try { if (!Directory.Exists(FileFolder)) { Directory.CreateDirectory(FileFolder); } if (File.Exists(path)) { string fileText = File.ReadAllText(path, Encoding.ASCII); if (_debug) { Console.WriteLine("read " + path); } AccountSettings = JsonConvert.DeserializeObject <AccountSettings>(fileText); if (_debug) { Console.WriteLine("loaded LoadAccountSettings successfully."); } } else { Console.WriteLine("LoadAccountSettings file does not exist."); } } catch (System.Exception exc) { Console.WriteLine("Exception: Failed to load LoadAccountSettings for " + path + "\n" + exc.ToString()); } }
public ChannelSettings GetChannelSettings(string channel) { ChannelSettings set = SavedChannelSettings.FirstOrDefault(a => a.Name.ToLower() == channel.ToLower()); if (set == null) { set = new ChannelSettings() { Name = channel, AllowCustomTableRolls = true, AllowTableRolls = true, AllowTableInfo = true, AllowChips = true, AllowGames = true, ChipsClearance = ChipsClearanceLevel.NONE }; SavedChannelSettings.Add(set); Utils.WriteToFileAsData(SavedChannelSettings, Utils.GetTotalFileName(BotMain.FileFolder, BotMain.ChannelSettingsFileName)); } return(set); }
public static void AddToLog(string note, object saveData) { try { AppendToFileAsData(DateTime.Now.ToString() + ": " + note + ": ", saveData, Utils.GetTotalFileName(BotMain.FileFolder, AddDateToFileName(BotMain.LogFileName))); }catch (Exception exc) { Console.WriteLine("exception on addtolog: " + exc.ToString()); } }