diff --git a/BSBshared/Json/JsonConfigApi.cs b/BSBshared/Json/JsonConfigApi.cs index 4a6ae3f..b7691fc 100644 --- a/BSBshared/Json/JsonConfigApi.cs +++ b/BSBshared/Json/JsonConfigApi.cs @@ -124,7 +124,7 @@ namespace BetterSecondBotShared.Json return 1; } - public string GetProp(JsonConfig reply, string arg) + public static string GetProp(JsonConfig reply, string arg) { return reply.GetType().GetProperty(arg, BindingFlags.Public | BindingFlags.Instance).GetValue(reply).ToString(); } diff --git a/BSBshared/Staic/Helpers.cs b/BSBshared/Staic/Helpers.cs index c071ccf..e2960f5 100644 --- a/BSBshared/Staic/Helpers.cs +++ b/BSBshared/Staic/Helpers.cs @@ -71,7 +71,7 @@ namespace BetterSecondBotShared.Static bool default_value_found = false; foreach (string a in testingfor) { - if (Testing.GetCommandArgTypes(a).First() == Testing.GetProp(test, a)) + if (Testing.GetCommandArgTypes(a).First() == MakeJsonConfig.GetProp(test, a)) { ConsoleLog.Warn("" + a + " is currently set to the default"); default_value_found = true; diff --git a/CLI/Cli.cs b/CLI/Cli.cs index fb857da..2b4b454 100644 --- a/CLI/Cli.cs +++ b/CLI/Cli.cs @@ -6,7 +6,7 @@ using BetterSecondBotShared.Static; using BetterSecondBotShared.logs; namespace BetterSecondBot { - class Program + static class Program { static void Main(string[] args) { diff --git a/CLI/CliHardware.cs b/CLI/CliHardware.cs index 430ce08..3fb7b44 100644 --- a/CLI/CliHardware.cs +++ b/CLI/CliHardware.cs @@ -70,7 +70,10 @@ namespace BetterSecondBot io.WriteJsonConfig(MakeJsonConfig.GetDefault(), json_file); } } - else ConsoleLog.Crit("you must select a .json file for config! example \"BetterSecondBot.exe mybot\" will use the mybot.json file!"); + else + { + ConsoleLog.Crit("you must select a .json file for config! example \"BetterSecondBot.exe mybot\" will use the mybot.json file!"); + } if(ok_to_try_start == true) { Config = MakeJsonConfig.http_config_check(Config); diff --git a/CLI/HttpServer/control/Actions/logout.cs b/CLI/HttpServer/control/Actions/logout.cs index e982338..646d120 100644 --- a/CLI/HttpServer/control/Actions/logout.cs +++ b/CLI/HttpServer/control/Actions/logout.cs @@ -15,12 +15,12 @@ namespace BetterSecondBot.HttpServer.Control.Actions if (httpserver.HTTPCnCmode == true) { httpserver.KillBot(); - return new string[] { "OK", "Bot Shutting down" }; + return new [] { "OK", "Bot Shutting down" }; } else { bot.KillMePlease(); - return new string[] { "OK", "I dont want to go" }; + return new [] { "OK", "I dont want to go" }; } } else diff --git a/CLI/HttpServer/control/Interface/cmd_lib.cs b/CLI/HttpServer/control/Interface/cmd_lib.cs index c5caf7b..6d458ae 100644 --- a/CLI/HttpServer/control/Interface/cmd_lib.cs +++ b/CLI/HttpServer/control/Interface/cmd_lib.cs @@ -20,7 +20,7 @@ namespace BetterSecondBot.HttpServer.Control.Interface { if (bot.GetCommandsInterface.Call(args[0], args[1], UUID.Zero) == true) { - return new string[] { "OK" }; + return new [] { "OK" }; } else { diff --git a/CLI/HttpServer/http_commands.cs b/CLI/HttpServer/http_commands.cs index 7ce5bf3..e013e5f 100644 --- a/CLI/HttpServer/http_commands.cs +++ b/CLI/HttpServer/http_commands.cs @@ -91,7 +91,7 @@ namespace BetterSecondBot.HttpServer protected string[] Failed(string why_failed) { ConsoleLog.Warn("HTTP: " + CommandName + " [Failed]: " + why_failed); - return new string[] {"Failed",why_failed}; + return new [] {"Failed",why_failed}; } } diff --git a/CLI/HttpServer/http_server.cs b/CLI/HttpServer/http_server.cs index 74dec7b..1ec5349 100644 --- a/CLI/HttpServer/http_server.cs +++ b/CLI/HttpServer/http_server.cs @@ -183,7 +183,7 @@ namespace BetterSecondBot.HttpServer { get_controler = new HTTPCommandsInterfaceGet(Bot,this); post_controler = new HTTPCommandsInterfacePost(Bot,this); - Thread t = new Thread(delegate (object unused) + Thread t = new Thread(delegate (object _) { listener = new HttpListener(); listener.Prefixes.Add(url); diff --git a/Core/Commands/Dialogs/DialogRelay.cs b/Core/Commands/Dialogs/DialogRelay.cs index 7efe0ce..c078a7c 100644 --- a/Core/Commands/Dialogs/DialogRelay.cs +++ b/Core/Commands/Dialogs/DialogRelay.cs @@ -29,7 +29,10 @@ namespace BSB.Commands.Dialogs { bot.SetRelayDialogsChannel(channel); } - else return Failed("Not a vaild option"); + else + { + return Failed("Not a vaild option"); + } return true; } else diff --git a/Core/Commands/Group/GroupInvite.cs b/Core/Commands/Group/GroupInvite.cs index 72028ee..1c7a47c 100644 --- a/Core/Commands/Group/GroupInvite.cs +++ b/Core/Commands/Group/GroupInvite.cs @@ -21,8 +21,14 @@ namespace BSB.Commands.Group UUID.TryParse(args[2], out target_role); } List invite_roles = new List(); - if (target_role != UUID.Zero) invite_roles.Add(target_role); - else invite_roles.Add(UUID.Zero); + if (target_role != UUID.Zero) + { + invite_roles.Add(target_role); + } + else + { + invite_roles.Add(UUID.Zero); + } bot.GetClient.Groups.Invite(group, invite_roles, avatar); } public override void Callback(string[] args, EventArgs e) diff --git a/Core/Commands/Parcel/GetParcelFlags.cs b/Core/Commands/Parcel/GetParcelFlags.cs index c9ef2e3..4d8286e 100644 --- a/Core/Commands/Parcel/GetParcelFlags.cs +++ b/Core/Commands/Parcel/GetParcelFlags.cs @@ -68,10 +68,7 @@ namespace BSB.Commands.CMD_Parcel reply.Append(cfg); reply.Append("="); reply.Append(p.Flags.HasFlag(flags[cfg]).ToString()); - if (addon != ",") - { - addon = ","; - } + addon = ","; } } return bot.GetCommandsInterface.SmartCommandReply(target, reply.ToString(), CommandName); diff --git a/Core/Commands/Parcel/eject.cs b/Core/Commands/Parcel/eject.cs index eae6208..e63ebee 100644 --- a/Core/Commands/Parcel/eject.cs +++ b/Core/Commands/Parcel/eject.cs @@ -20,7 +20,10 @@ namespace BSB.Commands.CMD_Parcel bool banuser = false; if (args.Length == 2) { - if (args[1] == "True") banuser = true; + if (args[1] == "True") + { + banuser = true; + } } bot.GetClient.Parcels.EjectUser(target, banuser); return true; diff --git a/Core/Commands/StreamAdmin/FetchNextNotecard.cs b/Core/Commands/StreamAdmin/FetchNextNotecard.cs index b580289..7df0fad 100644 --- a/Core/Commands/StreamAdmin/FetchNextNotecard.cs +++ b/Core/Commands/StreamAdmin/FetchNextNotecard.cs @@ -47,7 +47,10 @@ namespace BSB.Commands.StreamAdmin { return bot.SendNotecard(server_reply.NotecardTitle, server_reply.NotecardContent, (UUID)server_reply.AvatarUUID); } - else Failed("Notecard title is to short"); + else + { + Failed("Notecard title is to short"); + } } return Failed(server_reply.message); } diff --git a/Core/Commands/commandlib.cs b/Core/Commands/commandlib.cs index 481adda..0464a33 100644 --- a/Core/Commands/commandlib.cs +++ b/Core/Commands/commandlib.cs @@ -173,7 +173,10 @@ namespace BSB.Commands { "unixtime", helpers.UnixTimeNow().ToString() } }; - if (command != "") values.Add("command", command); + if (command != "") + { + values.Add("command", command); + } var content = new FormUrlEncodedContent(values); try { @@ -216,7 +219,7 @@ namespace BSB.Commands string[] args = new string[] { }; if (helpers.notempty(arg) == true) { - args = arg.Split(new string[] { "~#~" }, StringSplitOptions.None); + args = arg.Split(new [] { "~#~" }, StringSplitOptions.None); } if ((cmd.ArgTypes.Contains("Avatar") == true) || (cmd.ArgTypes.Contains("Smart") == true)) { diff --git a/Core/bottypes/AVstorageBot.cs b/Core/bottypes/AVstorageBot.cs index 5fedd86..6c9e10f 100644 --- a/Core/bottypes/AVstorageBot.cs +++ b/Core/bottypes/AVstorageBot.cs @@ -38,7 +38,10 @@ namespace BSB.bottypes } if (AvatarStorageLastUsed.Count > 0) { - if (reply != "") reply += " , "; + if (reply != "") + { + reply += " , "; + } reply += AvatarStorageLastUsed.Count.ToString() + " loaded"; } if (reply != "") diff --git a/Core/bottypes/CommandsBot.cs b/Core/bottypes/CommandsBot.cs index 3337932..368c121 100644 --- a/Core/bottypes/CommandsBot.cs +++ b/Core/bottypes/CommandsBot.cs @@ -15,7 +15,7 @@ namespace BSB.bottypes { CommandsInterface = new Commands.CoreCommandsInterface(this); } - List CommandHistory = new List(); + protected List CommandHistory = new List(); protected int commandid = 1; public virtual string CommandHistoryAdd(string command, string arg, bool status,string infomessage) { @@ -51,7 +51,10 @@ namespace BSB.bottypes ConsoleLog.Info(sb.ToString()); } commandid++; - if (commandid >= myconfig.MaxCommandHistory) commandid = 1; + if (commandid >= myconfig.MaxCommandHistory) + { + commandid = 1; + } } return message; } diff --git a/Core/bottypes/DiscordBot.cs b/Core/bottypes/DiscordBot.cs index 336abba..4adcc0d 100644 --- a/Core/bottypes/DiscordBot.cs +++ b/Core/bottypes/DiscordBot.cs @@ -151,7 +151,7 @@ namespace BSB.bottypes protected async Task FindTextChannel(string channelname, ICategoryChannel cat, UUID sender, string sendername, string TopicType) { - await WaitForUnlock(); + await WaitForUnlock().ConfigureAwait(false); channelname = channelname.ToLowerInvariant(); channelname = String.Concat(channelname.Where(char.IsLetterOrDigit)); DiscordLock = true; @@ -170,7 +170,7 @@ namespace BSB.bottypes } if(result == null) { - result = await CreateChannel(channelname, TopicType, sender.ToString()); + result = await CreateChannel(channelname, TopicType, sender.ToString()).ConfigureAwait(false); } else { @@ -552,7 +552,7 @@ namespace BSB.bottypes protected async override void BotChatControler(string message, string sender_name, UUID sender_uuid, bool avatar, bool group, UUID group_uuid, bool localchat, bool fromme) { base.BotChatControler(message, sender_name, sender_uuid, avatar, group, group_uuid, localchat, fromme); - await DiscordBotChatControler(message, sender_name, sender_uuid, avatar, group, group_uuid, localchat, fromme); + await DiscordBotChatControler(message, sender_name, sender_uuid, avatar, group, group_uuid, localchat, fromme).ConfigureAwait(false); } public override string CommandHistoryAdd(string command, string arg, bool status,string WhyFailed) diff --git a/Core/bottypes/EventsBot.cs b/Core/bottypes/EventsBot.cs index 6269c12..8d636aa 100644 --- a/Core/bottypes/EventsBot.cs +++ b/Core/bottypes/EventsBot.cs @@ -311,15 +311,9 @@ namespace BSB.bottypes await_event_idtolistener.Add(eventid, event_listener); return true; } - else return false; } - return false; } - else return false; + return false; } - - } - - } diff --git a/Core/bottypes/RLVbot.cs b/Core/bottypes/RLVbot.cs index 8234070..e116aea 100644 --- a/Core/bottypes/RLVbot.cs +++ b/Core/bottypes/RLVbot.cs @@ -99,7 +99,12 @@ namespace BSB.bottypes protected bool permissive_mode = true; protected UUID permissive_mode_set_by = UUID.Zero; public UUID Getpermissive_mode_set_by { get { return permissive_mode_set_by; } } - public void SetPermissiveMode(UUID caller, bool status = false) + + public void SetPermissiveMode(UUID caller) + { + SetPermissiveMode(caller, false); + } + public void SetPermissiveMode(UUID caller, bool status) { bool allow = true; if((permissive_mode == false) && (caller != permissive_mode_set_by)) @@ -243,7 +248,13 @@ namespace BSB.bottypes // Notify protected Dictionary> Notify = new Dictionary>(); public Dictionary> Getnotify { get { return Notify; } } - public void NotifyUpdate(bool Add, string word,int channel = -1) + + public void NotifyUpdate(bool Add, string word) + { + NotifyUpdate(Add, word, -1); + } + + public void NotifyUpdate(bool Add, string word,int channel) { lock (Notify) { diff --git a/Core/bottypes/athome.cs b/Core/bottypes/athome.cs index 7d54669..2034a27 100644 --- a/Core/bottypes/athome.cs +++ b/Core/bottypes/athome.cs @@ -216,8 +216,14 @@ namespace BSB.bottypes public bool IsSimHome(string simname) { simname = simname.ToLowerInvariant(); - if (helpers.notempty(myconfig.homeRegion) == false) return false; - else if (myconfig.homeRegion.Length == 0) return false; + if (helpers.notempty(myconfig.homeRegion) == false) + { + return false; + } + else if (myconfig.homeRegion.Length == 0) + { + return false; + } else { bool reply = false; @@ -272,7 +278,7 @@ namespace BSB.bottypes TeleportWithSLurl(myconfig.homeRegion[last_tested_home_id]); return " [@home **** active teleport: "+ last_attempted_teleport_region+"***]"; } - else return " [@home No home regions]"; + return " [@home No home regions]"; } else {