From e985c5fd1268cbcb3517a4dde3f04ed235d19a62 Mon Sep 17 00:00:00 2001 From: Zontreck Date: Sun, 21 Jun 2020 00:49:17 -0700 Subject: [PATCH] Adjust bot --- Assembly/ASMInfo.cs | 4 +- ConfigSystem/MainConfiguration.cs | 2 - Program.cs | 85 +++++++++++-------------------- 3 files changed, 32 insertions(+), 59 deletions(-) diff --git a/Assembly/ASMInfo.cs b/Assembly/ASMInfo.cs index a3d43e8..784230b 100644 --- a/Assembly/ASMInfo.cs +++ b/Assembly/ASMInfo.cs @@ -6,7 +6,7 @@ using System.Reflection; [assembly: AssemblyCompany("ZNI")] [assembly: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)] [assembly: AssemblyCopyright("© 2020 Tara Piccari")] -[assembly: AssemblyFileVersion("5.2.011")] +[assembly: AssemblyFileVersion("5.2.012")] [assembly: AssemblyDescription("Second Life Bot - BotCore5")] @@ -15,7 +15,7 @@ namespace Bot.Assemble public class ASMInfo { public static string BotName = "ZBotCore"; - public static string BotVer = "5.2.011"; + public static string BotVer = "5.2.012"; public static string GitPassword { get diff --git a/ConfigSystem/MainConfiguration.cs b/ConfigSystem/MainConfiguration.cs index 145bad9..7b92b42 100644 --- a/ConfigSystem/MainConfiguration.cs +++ b/ConfigSystem/MainConfiguration.cs @@ -46,7 +46,6 @@ namespace Bot get; set; } - public string MainProgramDLL = ""; public string first { get; set; } = ""; public string last { get; set; } = ""; public string password { get; set; } = ""; @@ -69,7 +68,6 @@ namespace Bot public Dictionary BotAdmins { get; set; } = new Dictionary(); public List AuthedGithubUsers { get; set; } = new List(); - public List LinkedDLLs { get; set; } = new List(); public bool Authed(string GHLogin) { diff --git a/Program.cs b/Program.cs index 8a83093..e90ec3f 100644 --- a/Program.cs +++ b/Program.cs @@ -23,7 +23,6 @@ namespace Bot public static string BotStr = ASMInfo.BotName; // internal identifier for linden public static string Flavor = "Bot"; // inworld identification - must be customized public static SerialManager SM = new SerialManager(); - public static string DefaultProgram = ""; // no default. public static GridClient client = new GridClient(); public static bool g_iIsRunning = true; public static MessageHandler MH; @@ -72,12 +71,6 @@ namespace Bot MainConfiguration.Instance.Save(); return; } - else if (args[0] == "-m") - { - MainConfiguration.Instance.MainProgramDLL = args[1]; - MainConfiguration.Instance.Save(); - return; - } } else if (args.Length == 4) { @@ -186,7 +179,6 @@ namespace Bot Log.info(false, "Now enter your password: "); pwd = Console.ReadLine(); - conf.MainProgramDLL = DefaultProgram; conf.ConfigFor = "ZBotCore"; conf.ConfigVersion = 1.0f; @@ -384,61 +376,44 @@ namespace Bot Flavor = conf.ConfigFor; } - // Check MainConfiguration for a mainProgram handle - if (conf.MainProgramDLL == null) + + registry = CommandRegistry.Instance; + registry.LocateCommands(); + + //msg(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Commands found: " + registry.Cmds.Count.ToString()); + + GroupsCache = new Dictionary(); + ReloadGroupsCache(); + + if (startupSeq) { - Log.info(true, "Setting main program library to none"); - conf.MainProgramDLL = DefaultProgram; - SM.Write("Main", conf); - - } - if (File.Exists(conf.MainProgramDLL) == false && startupSeq) - { - Log.info(true, "MainProgram Library: " + conf.MainProgramDLL + " does not exist"); - - startupSeq = false; - registry = CommandRegistry.Instance; - registry.LocateCommands(); - - //msg(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Commands found: " + registry.Cmds.Count.ToString()); - - GroupsCache = new Dictionary(); - ReloadGroupsCache(); - } - else - { - if (startupSeq) + //ReloadGroupsCache(); + try { - registry = CommandRegistry.Instance; - //ReloadGroupsCache(); - try - { - Log.info(true, g_ZPrograms.Count.ToString() + " programs linked"); - //if (g_ZPrograms.Count > 0) msg(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Default Program [" + conf.MainProgramDLL + "] has been loaded, " + programCount.ToString() + " plugin(s) loaded"); - registry.LocateCommands(); + Log.info(true, g_ZPrograms.Count.ToString() + " programs linked"); + //if (g_ZPrograms.Count > 0) msg(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Default Program [" + conf.MainProgramDLL + "] has been loaded, " + programCount.ToString() + " plugin(s) loaded"); + registry.LocateCommands(); - //msg(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Commands found: " + registry.Cmds.Count.ToString()); + //msg(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Commands found: " + registry.Cmds.Count.ToString()); - GroupsCache = new Dictionary(); - ReloadGroupsCache(); - } - catch (Exception E) - { - string Msg = E.Message; - string STACK = E.StackTrace.Replace("ZNI", ""); - Msg = Msg.Replace("ZNI", ""); - Log.info(true, "Generic Exception Caught: " + Msg + " [0x0A]"); - int i; - int* ptr = &i; - IntPtr addr = (IntPtr)ptr; - msg(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Generic Exception Caught: " + Msg + " [0x0A, 0x" + addr.ToString("x") + "]\nSTACK: " + STACK); - } + GroupsCache = new Dictionary(); + ReloadGroupsCache(); + } + catch (Exception E) + { + string Msg = E.Message; + string STACK = E.StackTrace.Replace("ZNI", ""); + Msg = Msg.Replace("ZNI", ""); + Log.info(true, "Generic Exception Caught: " + Msg + " [0x0A]"); + int i; + int* ptr = &i; + IntPtr addr = (IntPtr)ptr; + msg(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Generic Exception Caught: " + Msg + " [0x0A, 0x" + addr.ToString("x") + "]\nSTACK: " + STACK); } - - } + foreach (IProgram plugin in g_ZPrograms) { plugin.getTick(); // Trigger a tick event!!!