From 5fa506e01bf359f0335d312cef85025cd1c20773 Mon Sep 17 00:00:00 2001 From: Zontreck Date: Tue, 18 Aug 2020 16:11:14 -0700 Subject: [PATCH] Attempt 2 to fix the out of bounds issue --- Assembly/ASMInfo.cs | 4 ++-- CommandSystem/CommandRegistry.cs | 2 +- WebHookServer/NewVersionWatcher.cs | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 WebHookServer/NewVersionWatcher.cs diff --git a/Assembly/ASMInfo.cs b/Assembly/ASMInfo.cs index eadfbcc..0b01c63 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("(C) 2020 Tara Piccari")] -[assembly: AssemblyFileVersion("5.4.396")] +[assembly: AssemblyFileVersion("5.4.397")] [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.4.396"; + public static string BotVer = "5.4.397"; public static string GitPassword { get diff --git a/CommandSystem/CommandRegistry.cs b/CommandSystem/CommandRegistry.cs index bb31922..5a0ab72 100644 --- a/CommandSystem/CommandRegistry.cs +++ b/CommandSystem/CommandRegistry.cs @@ -222,7 +222,7 @@ namespace Bot.CommandSystem var ovj = Activator.CreateInstance(cg.AssignedMethod.DeclaringType); List lArgs = new List(); - for(int i=1; i<= cmdStruct.Length; i++) + for(int i=1; i < cmdStruct.Length; i++) { lArgs.Add(cmdStruct[i]); } diff --git a/WebHookServer/NewVersionWatcher.cs b/WebHookServer/NewVersionWatcher.cs new file mode 100644 index 0000000..e589392 --- /dev/null +++ b/WebHookServer/NewVersionWatcher.cs @@ -0,0 +1,27 @@ +using Bot.CommandSystem; +using OpenMetaverse; +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Text; + +namespace Bot.WebHookServer +{ + class NewVersionWatcher + { + [WebhookAttribs("/NewVersionAvailable", HTTPMethod = "POST")] + public WebhookRegistry.HTTPResponseData a_new_version_is_available(List args, string body, string method, NameValueCollection headers) + { + WebhookRegistry.HTTPResponseData hrd = new WebhookRegistry.HTTPResponseData(); + hrd.ReplyString = "OK"; + hrd.ReturnContentType = "text/plain"; + hrd.Status = 200; + + BaseCommands.MH(Destinations.DEST_LOCAL, UUID.Zero, "Alert: A new version is available. Restart required"); + + BotSession.Instance.EnqueueExit = true; + + return hrd; + } + } +}