Browse Source

* UserPrefs.xml:

* clsNodeGroup.cs: Add check for single node reference
Stuart Johnson 1 year ago
parent
commit
f86aa6c60c
2 changed files with 17 additions and 14 deletions
  1. 9 10
      .vs/TFA-Bot/xs/UserPrefs.xml
  2. 8 4
      TFA-Bot/DataClasses/clsNodeGroup.cs

+ 9 - 10
.vs/TFA-Bot/xs/UserPrefs.xml

@@ -2,18 +2,17 @@
   <MonoDevelop.Ide.ItemProperties.TFA-Bot PreferredExecutionTarget="MonoDevelop.Default" />
   <MonoDevelop.Ide.Workbench ActiveDocument="TFA-Bot Status">
     <Files>
-      <File FileName="TFA-Bot/Spreadsheet/clsSpreadsheetReader.cs" Line="125" Column="1" />
       <File FileName="TFA-Bot/DiscordBot/Commands/clsHelp.cs" Line="44" Column="1" />
       <File FileName="TFA-Bot/DiscordBot/Commands/clsNetworks.cs" Line="32" Column="45" />
-      <File FileName="TFA-Bot/DataClasses/clsNetwork.cs" Line="56" Column="13" />
-      <File FileName="TFA-Bot/clsExtenstions.cs" Line="57" Column="30" />
+      <File FileName="TFA-Bot/DataClasses/clsNetwork.cs" Line="52" Column="1" />
+      <File FileName="TFA-Bot/clsExtenstions.cs" Line="88" Column="1" />
       <File FileName="TFA-Bot/DiscordBot/Commands/clsListNodes.cs" Line="21" Column="65" />
       <File FileName="TFA-Bot/Program.cs" Line="34" Column="96" />
-      <File FileName="TFA-Bot/DataClasses/clsNodeGroup.cs" Line="26" Column="29" />
-      <File FileName="TFA-Bot/DataClasses/clsNode.cs" Line="97" Column="62" />
+      <File FileName="TFA-Bot/DataClasses/clsNodeGroup.cs" Line="57" Column="44" />
+      <File FileName="TFA-Bot/DataClasses/clsNode.cs" Line="424" Column="17" />
       <File FileName="TFA-Bot/DiscordBot/clsBotClient.cs" Line="169" Column="84" />
       <File FileName="TFA-Bot/clsEmail.cs" Line="96" Column="14" />
-      <File FileName="TFA-Bot/clsAlarm.cs" Line="107" Column="34" />
+      <File FileName="TFA-Bot/clsAlarm.cs" Line="82" Column="55" />
       <File FileName="TFA-Bot/DiscordBot/Commands/clsDiscord.cs" Line="32" Column="13" />
       <File FileName="TFA-Bot/DiscordBot/Commands/clsGoodnight.cs" Line="31" Column="1" />
       <File FileName="TFA-Bot/DiscordBot/Commands/clsEmail.cs" Line="30" Column="1" />
@@ -24,20 +23,20 @@
       <File FileName="TFA-Bot/Spreadsheet/clsSpreadsheet.cs" Line="26" Column="58" />
       <File FileName="TFA-Bot/Spreadsheet/ASheetColumnHeader.cs" Line="1" Column="1" />
       <File FileName="TFA-Bot/Spreadsheet/ISpreadsheet.cs" Line="1" Column="1" />
+      <File FileName="TFA-Bot/Utils/clsRollingAverage.cs" Line="48" Column="1" />
       <File FileName="TFA-Bot Status" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
         <State name="__root__">
           <Node name="TFA-Bot" expanded="True">
-            <Node name="TFA-Bot" expanded="True">
-              <Node name="DataClasses" expanded="True">
-                <Node name="clsNetwork.cs" selected="True" />
-              </Node>
+            <Node name="TFA-Bot" expanded="True" selected="True">
+              <Node name="DataClasses" expanded="True" />
               <Node name="DiscordBot" expanded="True">
                 <Node name="Commands" expanded="True" />
               </Node>
               <Node name="Spreadsheet" expanded="True" />
+              <Node name="Utils" expanded="True" />
             </Node>
           </Node>
         </State>

+ 8 - 4
TFA-Bot/DataClasses/clsNodeGroup.cs

@@ -45,16 +45,20 @@ namespace TFABot
 
         public void Monitor()
         {
-            foreach (var node in Program.NodesList.Values.Where(x=>x.Group == this.Name && x.Monitor))
+            var nodeList = Program.NodesList.Values.Where(x => x.Group == this.Name && x.Monitor);
+            foreach (var node in nodeList)
             {
                 //Check the height, against heighest known height
                 if (node.LeaderHeight > Network.TopHeight) //New highest LearderHeight.
                 {
-                    if (Network.TopHeight > 0 && (node.LeaderHeight - Network.TopHeight > 10))
+                    if (Network.TopHeight > 0 && (node.LeaderHeight - Network.TopHeight > 10) && nodeList.Count() > 1)
                     {
                         //Suspect wrong network setting
-                        Program.SendAlert($"WARNING: {node.Name} height too high!  Wrong Bot setting?");
-                        node.SyncMode=true;
+                        if (!node.SyncMode)
+                        {
+                            Program.SendAlert($"WARNING: {node.Name} height too high!  Wrong Bot setting?");
+                            node.SyncMode = true;
+                        }
                     }
                     else
                     {