Browse Source

* clsHelp.cs: Add spreadsheet url to help

* clsGit.cs: Add catch block

* TFA-Bot.csproj:
* packages.config:
* UserPrefs.xml:

* clsAlarm.cs: Retain alarm message if not connected to discord.
Stuart Johnson 5 months ago
parent
commit
c272cf632c

+ 34 - 8
.vs/TFA-Bot/xs/UserPrefs.xml

@@ -2,35 +2,61 @@
   <MonoDevelop.Ide.ItemProperties.TFA-Bot PreferredExecutionTarget="MonoDevelop.Default" />
   <MonoDevelop.Ide.Workbench ActiveDocument="TFA-Bot Status">
     <Files>
-      <File FileName="TFA-Bot/DiscordBot/Commands/clsNetworks.cs" Line="1" Column="10" />
+      <File FileName="TFA-Bot/DiscordBot/Commands/clsNetworks.cs" Line="23" Column="37" />
       <File FileName="TFA-Bot/DiscordBot/Commands/clsListNodes.cs" Line="1" Column="1" />
       <File FileName="TFA-Bot/DataClasses/clsNetwork.cs" Line="1" Column="1" />
       <File FileName="TFA-Bot/clsExtenstions.cs" Line="1" Column="1" />
-      <File FileName="TFA-Bot/DataClasses/clsNodeGroup.cs" Line="1" Column="1" />
+      <File FileName="TFA-Bot/DataClasses/clsNodeGroup.cs" Line="16" Column="38" />
       <File FileName="TFA-Bot/DiscordBot/Commands/clsEmail.cs" Line="1" Column="1" />
       <File FileName="TFA-Bot/DiscordBot/clsCommands.cs" Line="1" Column="1" />
       <File FileName="TFA-Bot/DataClasses/clsSetting.cs" Line="1" Column="1" />
       <File FileName="TFA-Bot/DataClasses/clsNotificationPolicy.cs" Line="1" Column="1" />
-      <File FileName="TFA-Bot/Spreadsheet/clsSpreadsheetReader.cs" Line="1" Column="1" />
-      <File FileName="TFA-Bot/Program.cs" Line="1" Column="1" />
+      <File FileName="TFA-Bot/Spreadsheet/clsSpreadsheetReader.cs" Line="125" Column="1" />
+      <File FileName="TFA-Bot/Program.cs" Line="47" Column="32" />
       <File FileName="TFA-Bot/Spreadsheet/ISpreadsheet.cs" Line="1" Column="1" />
       <File FileName="TFA-Bot/Dialler/clsDialler.cs" Line="1" Column="1" />
       <File FileName="TFA-Bot/DiscordBot/Commands/clsCall.cs" Line="1" Column="1" />
       <File FileName="TFA-Bot/Dialler/clsDiallerSIP.cs" Line="1" Column="1" />
-      <File FileName="TFA-Bot/clsAlarm.cs" Line="1" Column="1" />
-      <File FileName="TFA-Bot/Dialler/clsDiallerTwilio.cs" Line="1" Column="1" />
-      <File FileName="TFA-Bot/DiscordBot/clsBotClient.cs" Line="1" Column="1" />
+      <File FileName="TFA-Bot/Dialler/clsDiallerTwilio.cs" Line="41" Column="51" />
+      <File FileName="TFA-Bot/DiscordBot/clsBotClient.cs" Line="105" Column="1" />
       <File FileName="TFA-Bot/DiscordBot/Commands/clsMTR.cs" Line="1" Column="1" />
       <File FileName="TFA-Bot/Dialler/IDialler.cs" Line="1" Column="1" />
-      <File FileName="TFA-Bot/DataClasses/clsNode.cs" Line="170" Column="35" />
+      <File FileName="TFA-Bot/Utils/clsRollingAverage.cs" Line="32" Column="1" />
+      <File FileName="TFA-Bot/DiscordBot/Commands/clsGitCommand.cs" Line="10" Column="2" />
+      <File FileName="TFA-Bot/Git/clsGit.cs" Line="40" Column="67" />
+      <File FileName="TFA-Bot/Git/clsGitHead.cs" Line="1" Column="1" />
+      <File FileName="TFA-Bot/DiscordBot/Commands/clsHelp.cs" Line="26" Column="63" />
       <File FileName="TFA-Bot Status" />
     </Files>
+    <Pads>
+      <Pad Id="ProjectPad">
+        <State name="__root__">
+          <Node name="TFA-Bot" expanded="True">
+            <Node name="Solution Items" expanded="True" />
+            <Node name="TFA-Bot" expanded="True">
+              <Node name="DataClasses" expanded="True" />
+              <Node name="DiscordBot" expanded="True">
+                <Node name="Commands" expanded="True" />
+              </Node>
+              <Node name="Git" expanded="True" />
+              <Node name="Spreadsheet" expanded="True" />
+              <Node name="clsAlarm.cs" selected="True" />
+            </Node>
+          </Node>
+        </State>
+      </Pad>
+      <Pad Id="MonoDevelop.Debugger.WatchPad">
+        <State />
+      </Pad>
+    </Pads>
   </MonoDevelop.Ide.Workbench>
   <MonoDevelop.Ide.DebuggingService.PinnedWatches />
   <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
   <MonoDevelop.Ide.DebuggingService.Breakpoints>
     <BreakpointStore>
       <Breakpoint file="/HOME/Projects/TFA-Bot/TFA-Bot/clsCaller.cs" relfile="TFA-Bot/clsCaller.cs" line="144" column="1" />
+      <Breakpoint file="/HOME/Projects/TFA-Bot/TFA-Bot/DataClasses/clsNode.cs" relfile="TFA-Bot/DataClasses/clsNode.cs" line="247" column="1" />
+      <Catchpoint exceptionName="System.Exception" includeSubclasses="True" />
     </BreakpointStore>
   </MonoDevelop.Ide.DebuggingService.Breakpoints>
   <MultiItemStartupConfigurations />

+ 1 - 0
TFA-Bot/DiscordBot/Commands/clsHelp.cs

@@ -27,6 +27,7 @@ namespace TFABot.DiscordBot.Commands
                {
                     e.Channel.SendMessageAsync($"```{text}```");
                }
+                e.Channel.SendMessageAsync($"Settings: {Program.BotURL}");
             }
             catch (Exception ex)
             {

+ 19 - 11
TFA-Bot/Git/clsGit.cs

@@ -16,21 +16,29 @@ namespace TFABot.Git
         
         public clsGit(String gitDirectory = null)
         {
+
+            try
+            {
 #if DEBUG
-            if (Directory.Exists("/HOME/TFA-Bot")) gitDirectory = "/HOME/TFA-Bot";
-#endif      
-            if (String.IsNullOrEmpty(gitDirectory)) gitDirectory = System.Reflection.Assembly.GetEntryAssembly().Location;
+                if (Directory.Exists("/HOME/TFA-Bot")) gitDirectory = "/HOME/TFA-Bot";
+#endif
+                if (String.IsNullOrEmpty(gitDirectory)) gitDirectory = System.Reflection.Assembly.GetEntryAssembly().Location;
 
-            var dir = new DirectoryInfo(gitDirectory);
-            while (dir.GetDirectories(".git",SearchOption.TopDirectoryOnly).Length==0)
+                var dir = new DirectoryInfo(gitDirectory);
+                while (dir.GetDirectories(".git", SearchOption.TopDirectoryOnly).Length == 0)
+                {
+                    dir = dir.Parent;
+                    if (dir == null) throw new Exception("No .git dir found");
+                }
+                Console.WriteLine($"Opening Git @ {dir.FullName}");
+                Repo = new Repository(dir.FullName);
+                Fetch();
+                Head = new clsGitHead(this);
+            }
+            catch (Exception ex)
             {
-                dir = dir.Parent;
-                if (dir==null) throw new Exception("No .git dir found");
+                Console.WriteLine($"Git ini Error ${ex.Message}");
             }
-            Console.WriteLine($"Opening Git @ {dir.FullName}");
-            Repo = new Repository(dir.FullName);
-            Fetch();
-            Head = new clsGitHead(this);
         }
        
         public void Fetch()

+ 8 - 8
TFA-Bot/TFA-Bot.csproj

@@ -1,5 +1,5 @@
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.252\build\net461\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.252\build\net461\LibGit2Sharp.NativeBinaries.props')" />
+  <Import Project="..\packages\LibGit2Sharp.NativeBinaries.2.0.267\build\net46\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.2.0.267\build\net46\LibGit2Sharp.NativeBinaries.props')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@@ -79,19 +79,19 @@
       <HintPath>..\packages\BouncyCastle.1.8.4\lib\BouncyCastle.Crypto.dll</HintPath>
     </Reference>
     <Reference Include="LibGit2Sharp">
-      <HintPath>..\packages\LibGit2Sharp.0.25.4\lib\netstandard2.0\LibGit2Sharp.dll</HintPath>
+      <HintPath>..\packages\LibGit2Sharp.0.26.0\lib\net46\LibGit2Sharp.dll</HintPath>
+    </Reference>
+    <Reference Include="Newtonsoft.Json">
+      <HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="MimeKit">
-      <HintPath>..\packages\MimeKit.2.1.0\lib\net45\MimeKit.dll</HintPath>
+      <HintPath>..\packages\MimeKit.2.1.3\lib\net45\MimeKit.dll</HintPath>
     </Reference>
     <Reference Include="MailKit">
-      <HintPath>..\packages\MailKit.2.1.0.3\lib\net45\MailKit.dll</HintPath>
-    </Reference>
-    <Reference Include="Newtonsoft.Json">
-      <HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\packages\MailKit.2.1.3\lib\net45\MailKit.dll</HintPath>
     </Reference>
     <Reference Include="RestSharp">
-      <HintPath>..\packages\RestSharp.106.5.4\lib\net452\RestSharp.dll</HintPath>
+      <HintPath>..\packages\RestSharp.106.6.7\lib\net452\RestSharp.dll</HintPath>
     </Reference>
   </ItemGroup>
   <ItemGroup>

+ 9 - 1
TFA-Bot/clsAlarm.cs

@@ -131,7 +131,11 @@ namespace TFABot
                 {
                     if (!DelayUntil.HasValue || DelayUntil.Value < DateTime.UtcNow)
                     {
-                        Program.Bot.Our_BotAlert.SendMessageAsync(Message);
+                        if (Program.Bot.Our_BotAlert == null)
+                            AddNote(Message);
+                        else
+                            Program.Bot.Our_BotAlert.SendMessageAsync(Message);
+                        
                         TimeDiscord = DateTime.UtcNow;
                     }
                 }
@@ -143,6 +147,10 @@ namespace TFABot
             return $"{AlarmType.ToString().PadRight(15)} {Node?.Name.PadRight(15) ?? Network?.Name.PadRight(20) ?? ""} {Opened} {Message}";
         }
 
+        /// <summary>
+        /// Add a note to an alarm.  If alarm not yet announced, then save for later
+        /// </summary>
+        /// <param name="text">Text.</param>
         internal void AddNote(String text)
         {        
             if (TimeDiscord.HasValue)

+ 5 - 5
TFA-Bot/packages.config

@@ -5,13 +5,13 @@
   <package id="DSharpPlus.CommandsNext" version="3.2.3" targetFramework="net462" />
   <package id="DSharpPlus.Interactivity" version="3.2.3" targetFramework="net462" />
   <package id="DSharpPlus.WebSocket.WebSocketSharp" version="3.2.3" targetFramework="net462" />
-  <package id="LibGit2Sharp" version="0.25.4" targetFramework="net462" />
-  <package id="LibGit2Sharp.NativeBinaries" version="1.0.252" targetFramework="net462" />
-  <package id="MailKit" version="2.1.0.3" targetFramework="net462" />
-  <package id="MimeKit" version="2.1.0" targetFramework="net462" />
+  <package id="LibGit2Sharp" version="0.26.0" targetFramework="net462" />
+  <package id="LibGit2Sharp.NativeBinaries" version="2.0.267" targetFramework="net462" />
+  <package id="MailKit" version="2.1.3" targetFramework="net462" />
+  <package id="MimeKit" version="2.1.3" targetFramework="net462" />
   <package id="Mono.Posix" version="5.4.0.201" targetFramework="net462" />
   <package id="Newtonsoft.Json" version="12.0.1" targetFramework="net462" />
-  <package id="RestSharp" version="106.5.4" targetFramework="net462" />
+  <package id="RestSharp" version="106.6.7" targetFramework="net462" />
   <package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
   <package id="WebSocketSharp-NonPreRelease" version="1.0.0" targetFramework="net462" />
 </packages>