Browse Source

* clsNode.cs: Allow custom api port number

* TFA-Bot.csproj:
* packages.config:
* UserPrefs.xml: update packages
Stuart Johnson 1 year ago
parent
commit
ccea7398f6
4 changed files with 64 additions and 49 deletions
  1. 20 20
      .vs/TFA-Bot/xs/UserPrefs.xml
  2. 21 3
      TFA-Bot/DataClasses/clsNode.cs
  3. 16 19
      TFA-Bot/TFA-Bot.csproj
  4. 7 7
      TFA-Bot/packages.config

+ 20 - 20
.vs/TFA-Bot/xs/UserPrefs.xml

@@ -2,27 +2,27 @@
   <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="1" />
+      <File FileName="TFA-Bot/DiscordBot/Commands/clsNetworks.cs" Line="1" Column="10" />
       <File FileName="TFA-Bot/DiscordBot/Commands/clsListNodes.cs" Line="1" Column="1" />
-      <File FileName="TFA-Bot/DataClasses/clsNode.cs" Line="29" Column="25" />
-      <File FileName="TFA-Bot/DataClasses/clsNetwork.cs" Line="50" Column="21" />
-      <File FileName="TFA-Bot/clsExtenstions.cs" Line="84" Column="38" />
-      <File FileName="TFA-Bot/DataClasses/clsNodeGroup.cs" Line="51" Column="43" />
-      <File FileName="TFA-Bot/DiscordBot/Commands/clsEmail.cs" Line="16" Column="44" />
-      <File FileName="TFA-Bot/DiscordBot/clsCommands.cs" Line="72" Column="1" />
-      <File FileName="TFA-Bot/DataClasses/clsSetting.cs" Line="28" Column="1" />
-      <File FileName="TFA-Bot/DataClasses/clsNotificationPolicy.cs" Line="30" Column="23" />
-      <File FileName="TFA-Bot/Spreadsheet/clsSpreadsheetReader.cs" Line="105" Column="1" />
-      <File FileName="TFA-Bot/Program.cs" Line="205" Column="9" />
-      <File FileName="TFA-Bot/Spreadsheet/ISpreadsheet.cs" Line="7" Column="14" />
-      <File FileName="TFA-Bot/Dialler/clsDialler.cs" Line="81" Column="83" />
-      <File FileName="TFA-Bot/DiscordBot/Commands/clsCall.cs" Line="21" Column="24" />
-      <File FileName="TFA-Bot/Dialler/clsDiallerSIP.cs" Line="53" Column="48" />
-      <File FileName="TFA-Bot/clsAlarm.cs" Line="113" Column="18" />
-      <File FileName="TFA-Bot/Dialler/clsDiallerTwilio.cs" Line="14" Column="25" />
-      <File FileName="TFA-Bot/DiscordBot/clsBotClient.cs" Line="249" Column="43" />
-      <File FileName="TFA-Bot/DiscordBot/Commands/clsMTR.cs" Line="34" Column="37" />
-      <File FileName="TFA-Bot/Dialler/IDialler.cs" Line="9" Column="14" />
+      <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/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/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/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 Status" />
     </Files>
   </MonoDevelop.Ide.Workbench>

+ 21 - 3
TFA-Bot/DataClasses/clsNode.cs

@@ -167,7 +167,16 @@ namespace TFABot
         {
             try {
                 
-                var client = new RestClient($"http://{Host}:8088");
+                RestClient client;
+                if (Host.Contains(":"))
+                {
+                    client = new RestClient($"http://{Host}");
+                }
+                else
+                {
+                    client = new RestClient($"http://{Host}:8088");
+                }
+
                         
                 client.Timeout = timeout;                    
                         
@@ -268,8 +277,17 @@ namespace TFABot
         public void GetVersion(int timeout = 2000)
         {
             try {
-                var client = new RestClient($"http://{Host}:8088");
-                        
+                
+                RestClient client;
+                if (Host.Contains(":"))
+                {
+                    client = new RestClient($"http://{Host}");
+                }
+                else
+                {
+                    client = new RestClient($"http://{Host}:8088");
+                }
+                                
                 client.Timeout = timeout;                    
                         
                 var request = new RestRequest("v2", Method.POST);

+ 16 - 19
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.217\build\net461\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.217\build\net461\LibGit2Sharp.NativeBinaries.props')" />
+  <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')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@@ -57,21 +57,12 @@
     <Reference Include="DSharpPlus.WebSocket.WebSocketSharp">
       <HintPath>..\packages\DSharpPlus.WebSocket.WebSocketSharp.3.2.3\lib\net46\DSharpPlus.WebSocket.WebSocketSharp.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json">
-      <HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
-    </Reference>
-    <Reference Include="RestSharp">
-      <HintPath>..\packages\RestSharp.106.3.1\lib\net452\RestSharp.dll</HintPath>
-    </Reference>
     <Reference Include="System.ValueTuple">
       <HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
     </Reference>
     <Reference Include="websocket-sharp">
       <HintPath>..\packages\WebSocketSharp-NonPreRelease.1.0.0\lib\net35\websocket-sharp.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json">
-      <HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
-    </Reference>
     <Reference Include="websocket-sharp">
       <HintPath>..\packages\WebSocketSharp-NonPreRelease.1.0.0\lib\net35\websocket-sharp.dll</HintPath>
     </Reference>
@@ -81,20 +72,26 @@
     <Reference Include="websocket-sharp">
       <HintPath>bin\Debug\websocket-sharp.dll</HintPath>
     </Reference>
-    <Reference Include="LibGit2Sharp">
-      <HintPath>..\packages\LibGit2Sharp.0.25.2\lib\netstandard2.0\LibGit2Sharp.dll</HintPath>
-    </Reference>
+    <Reference Include="System.Core" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Security" />
     <Reference Include="BouncyCastle.Crypto">
-      <HintPath>..\packages\BouncyCastle.1.8.2\lib\BouncyCastle.Crypto.dll</HintPath>
+      <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>
     </Reference>
     <Reference Include="MimeKit">
-      <HintPath>..\packages\MimeKit.2.0.6\lib\net45\MimeKit.dll</HintPath>
+      <HintPath>..\packages\MimeKit.2.1.0\lib\net45\MimeKit.dll</HintPath>
     </Reference>
-    <Reference Include="System.Core" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Security" />
     <Reference Include="MailKit">
-      <HintPath>..\packages\MailKit.2.0.6\lib\net45\MailKit.dll</HintPath>
+      <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>
+    </Reference>
+    <Reference Include="RestSharp">
+      <HintPath>..\packages\RestSharp.106.5.4\lib\net452\RestSharp.dll</HintPath>
     </Reference>
   </ItemGroup>
   <ItemGroup>

+ 7 - 7
TFA-Bot/packages.config

@@ -1,17 +1,17 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="BouncyCastle" version="1.8.2" targetFramework="net462" />
+  <package id="BouncyCastle" version="1.8.4" targetFramework="net462" />
   <package id="DSharpPlus" version="3.2.3" targetFramework="net462" />
   <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.2" targetFramework="net462" />
-  <package id="LibGit2Sharp.NativeBinaries" version="1.0.217" targetFramework="net462" />
-  <package id="MailKit" version="2.0.6" targetFramework="net462" />
-  <package id="MimeKit" version="2.0.6" 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="Mono.Posix" version="5.4.0.201" targetFramework="net462" />
-  <package id="Newtonsoft.Json" version="11.0.2" targetFramework="net462" />
-  <package id="RestSharp" version="106.3.1" targetFramework="net462" />
+  <package id="Newtonsoft.Json" version="12.0.1" targetFramework="net462" />
+  <package id="RestSharp" version="106.5.4" targetFramework="net462" />
   <package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
   <package id="WebSocketSharp-NonPreRelease" version="1.0.0" targetFramework="net462" />
 </packages>