public void AddCharacter(CharacterSheet sheet, bool overrideExisting, bool saveImmediatly = false) { // Check for duplicate sheets if (!characterSheets.Contains(sheet)) { // Check if a sheet with two of the same character names exist. If the override // is true, remove the old one. If not set then we abort. CharacterSheet oldSheet = null; foreach (CharacterSheet characterSheet in characterSheets) { if (characterSheet.Name == sheet.Name) { if (overrideExisting == false) { return; } oldSheet = characterSheet; } } if (oldSheet != null) { characterSheets.Remove(oldSheet); } characterSheets.Add(sheet); if (saveImmediatly) { InfoExportClass.ExportCharacterSheet(sheet, overrideExisting); } Console.WriteLine("Added new character to library"); } }
public async Task ExportAbilityLibrary() { if (BotInfo.UsewhiteList && !BotInfo.Permissions.IsUserInWhiteList(Context.User.ToString())) { if (BotInfo.UseblackListCaughtUsers && !BotInfo.Permissions.IsUserInBlackList(Context.User.ToString())) { await Log("The user " + Context.User.ToString() + " attempted to export the ability library!", LogSeverity.Critical); BotInfo.Permissions.AddUserToBlacklist(Context.User.ToString()); return; } } InfoExportClass.ExportAbilityLibrary(); await Log("The user " + Context.User.ToString() + " has exported the AbilityLibrary"); await ReplyAsync("The AbilityLibrary has been exported."); }
public async Task DumpLogs() { if (BotInfo.UsewhiteList && !BotInfo.Permissions.IsUserInWhiteList(Context.User.ToString())) { if (BotInfo.UseblackListCaughtUsers && !BotInfo.Permissions.IsUserInBlackList(Context.User.ToString())) { await Log("The user " + Context.User.ToString() + " attempted to use the command AnnoyDeath", LogSeverity.Critical); BotInfo.Permissions.AddUserToBlacklist(Context.User.ToString()); return; } } await Log(Context.User.ToString() + " is dumping logs", LogSeverity.Debug); await ReplyAsync("Dumped Logs"); await Log("Log has been dumped to " + Directory.GetCurrentDirectory() + "Logs\\LogDump.txt"); InfoExportClass.DumpLogOutput(); }
public async Task ExportBlacklist() { InfoExportClass.ExportBlacklist(); await ReplyAsync("Exported blacklist!"); await Log(Context.User.ToString() + " export the blacklist."); }
public async Task ExportWhitelist() { InfoExportClass.ExportWhiteList(); await ReplyAsync("Exported whitelist!"); await Log(Context.User.ToString() + " export the whitelist."); }