Adjust bot

This commit is contained in:
Zontreck 2020-06-21 00:49:17 -07:00
parent a9e34bac15
commit e985c5fd12
3 changed files with 32 additions and 59 deletions

View file

@ -6,7 +6,7 @@ using System.Reflection;
[assembly: AssemblyCompany("ZNI")] [assembly: AssemblyCompany("ZNI")]
[assembly: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)] [assembly: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)]
[assembly: AssemblyCopyright("© 2020 Tara Piccari")] [assembly: AssemblyCopyright("© 2020 Tara Piccari")]
[assembly: AssemblyFileVersion("5.2.011")] [assembly: AssemblyFileVersion("5.2.012")]
[assembly: AssemblyDescription("Second Life Bot - BotCore5")] [assembly: AssemblyDescription("Second Life Bot - BotCore5")]
@ -15,7 +15,7 @@ namespace Bot.Assemble
public class ASMInfo public class ASMInfo
{ {
public static string BotName = "ZBotCore"; public static string BotName = "ZBotCore";
public static string BotVer = "5.2.011"; public static string BotVer = "5.2.012";
public static string GitPassword public static string GitPassword
{ {
get get

View file

@ -46,7 +46,6 @@ namespace Bot
get; set; get; set;
} }
public string MainProgramDLL = "";
public string first { get; set; } = ""; public string first { get; set; } = "";
public string last { get; set; } = ""; public string last { get; set; } = "";
public string password { get; set; } = ""; public string password { get; set; } = "";
@ -69,7 +68,6 @@ namespace Bot
public Dictionary<UUID, int> BotAdmins { get; set; } = new Dictionary<UUID, int>(); public Dictionary<UUID, int> BotAdmins { get; set; } = new Dictionary<UUID, int>();
public List<string> AuthedGithubUsers { get; set; } = new List<string>(); public List<string> AuthedGithubUsers { get; set; } = new List<string>();
public List<string> LinkedDLLs { get; set; } = new List<string>();
public bool Authed(string GHLogin) public bool Authed(string GHLogin)
{ {

View file

@ -23,7 +23,6 @@ namespace Bot
public static string BotStr = ASMInfo.BotName; // internal identifier for linden public static string BotStr = ASMInfo.BotName; // internal identifier for linden
public static string Flavor = "Bot"; // inworld identification - must be customized public static string Flavor = "Bot"; // inworld identification - must be customized
public static SerialManager SM = new SerialManager(); public static SerialManager SM = new SerialManager();
public static string DefaultProgram = ""; // no default.
public static GridClient client = new GridClient(); public static GridClient client = new GridClient();
public static bool g_iIsRunning = true; public static bool g_iIsRunning = true;
public static MessageHandler MH; public static MessageHandler MH;
@ -72,12 +71,6 @@ namespace Bot
MainConfiguration.Instance.Save(); MainConfiguration.Instance.Save();
return; return;
} }
else if (args[0] == "-m")
{
MainConfiguration.Instance.MainProgramDLL = args[1];
MainConfiguration.Instance.Save();
return;
}
} }
else if (args.Length == 4) else if (args.Length == 4)
{ {
@ -186,7 +179,6 @@ namespace Bot
Log.info(false, "Now enter your password: "); Log.info(false, "Now enter your password: ");
pwd = Console.ReadLine(); pwd = Console.ReadLine();
conf.MainProgramDLL = DefaultProgram;
conf.ConfigFor = "ZBotCore"; conf.ConfigFor = "ZBotCore";
conf.ConfigVersion = 1.0f; conf.ConfigVersion = 1.0f;
@ -384,61 +376,44 @@ namespace Bot
Flavor = conf.ConfigFor; 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<UUID, Group>();
ReloadGroupsCache();
if (startupSeq)
{ {
Log.info(true, "Setting main program library to none");
conf.MainProgramDLL = DefaultProgram;
SM.Write<MainConfiguration>("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 = CommandRegistry.Instance;
registry.LocateCommands(); //ReloadGroupsCache();
try
//msg(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Commands found: " + registry.Cmds.Count.ToString());
GroupsCache = new Dictionary<UUID, Group>();
ReloadGroupsCache();
}
else
{
if (startupSeq)
{ {
registry = CommandRegistry.Instance;
//ReloadGroupsCache();
try
{
Log.info(true, g_ZPrograms.Count.ToString() + " programs linked"); 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"); //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(); 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<UUID, Group>(); GroupsCache = new Dictionary<UUID, Group>();
ReloadGroupsCache(); ReloadGroupsCache();
} }
catch (Exception E) catch (Exception E)
{ {
string Msg = E.Message; string Msg = E.Message;
string STACK = E.StackTrace.Replace("ZNI", ""); string STACK = E.StackTrace.Replace("ZNI", "");
Msg = Msg.Replace("ZNI", ""); Msg = Msg.Replace("ZNI", "");
Log.info(true, "Generic Exception Caught: " + Msg + " [0x0A]"); Log.info(true, "Generic Exception Caught: " + Msg + " [0x0A]");
int i; int i;
int* ptr = &i; int* ptr = &i;
IntPtr addr = (IntPtr)ptr; IntPtr addr = (IntPtr)ptr;
msg(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Generic Exception Caught: " + Msg + " [0x0A, 0x" + addr.ToString("x") + "]\nSTACK: " + STACK); msg(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Generic Exception Caught: " + Msg + " [0x0A, 0x" + addr.ToString("x") + "]\nSTACK: " + STACK);
}
} }
} }
foreach (IProgram plugin in g_ZPrograms) foreach (IProgram plugin in g_ZPrograms)
{ {
plugin.getTick(); // Trigger a tick event!!! plugin.getTick(); // Trigger a tick event!!!