diff --git a/SpixiBot.sln b/SpixiBot.sln index e676be5..3ac8eab 100644 --- a/SpixiBot.sln +++ b/SpixiBot.sln @@ -1,17 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.572 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33205.214 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpixiBot", "SpixiBot\SpixiBot.csproj", "{F408F9F2-C3A1-4FE2-8443-6D9E251924A8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SpixiBot", "SpixiBot\SpixiBot.csproj", "{F408F9F2-C3A1-4FE2-8443-6D9E251924A8}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "IXICore", "..\Ixian-Core\IXICore.shproj", "{80487C64-619A-4B60-97BD-ED7670BF45B3}" EndProject Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - ..\Ixian-Core\IXICore.projitems*{80487c64-619a-4b60-97bd-ed7670bf45b3}*SharedItemsImports = 13 - ..\Ixian-Core\IXICore.projitems*{f408f9f2-c3a1-4fe2-8443-6d9e251924a8}*SharedItemsImports = 4 - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU @@ -28,4 +24,8 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {97344C29-18D5-463D-AD09-4E397CAFA4B6} EndGlobalSection + GlobalSection(SharedMSBuildProjectFiles) = preSolution + ..\Ixian-Core\IXICore.projitems*{80487c64-619a-4b60-97bd-ed7670bf45b3}*SharedItemsImports = 13 + ..\Ixian-Core\IXICore.projitems*{f408f9f2-c3a1-4fe2-8443-6d9e251924a8}*SharedItemsImports = 5 + EndGlobalSection EndGlobal diff --git a/SpixiBot/Meta/Config.cs b/SpixiBot/Meta/Config.cs index dc9fb7b..95a5813 100644 --- a/SpixiBot/Meta/Config.cs +++ b/SpixiBot/Meta/Config.cs @@ -43,7 +43,7 @@ public class Config public static List
whiteList = new List
(); // Read-only values - public static readonly string version = "xsbc-0.5.5a-PR1"; // Spixi Bot version + public static readonly string version = "xsbc-0.5.6-PR1"; // Spixi Bot version public static readonly string pushServiceUrl = "https://ipn.ixian.io/v1"; diff --git a/SpixiBot/Meta/Node.cs b/SpixiBot/Meta/Node.cs index 684731c..bf9faa6 100644 --- a/SpixiBot/Meta/Node.cs +++ b/SpixiBot/Meta/Node.cs @@ -338,7 +338,8 @@ static public void stop() if (maintenanceThread != null) { - maintenanceThread.Abort(); + maintenanceThread.Interrupt(); + maintenanceThread.Join(); maintenanceThread = null; } @@ -463,7 +464,7 @@ public override int getLastBlockVersion() public override bool addTransaction(Transaction tx, bool force_broadcast) { // TODO Send to peer if directly connectable - CoreProtocolMessage.broadcastProtocolMessage(new char[] { 'M', 'H' }, ProtocolMessageCode.transactionData, tx.getBytes(), null); + CoreProtocolMessage.broadcastProtocolMessage(new char[] { 'M', 'H' }, ProtocolMessageCode.transactionData2, tx.getBytes(true, true), null); PendingTransactions.addPendingLocalTransaction(tx); return true; } @@ -589,7 +590,7 @@ public static void processPendingTransactions() if (cur_time - tx_time > 40) // if the transaction is pending for over 40 seconds, resend { - CoreProtocolMessage.broadcastProtocolMessage(new char[] { 'M', 'H' }, ProtocolMessageCode.transactionData, t.getBytes(), null); + CoreProtocolMessage.broadcastProtocolMessage(new char[] { 'M', 'H' }, ProtocolMessageCode.transactionData2, t.getBytes(true, true), null); entry.addedTimestamp = cur_time; entry.confirmedNodeList.Clear(); } diff --git a/SpixiBot/Network/PushNotifications.cs b/SpixiBot/Network/PushNotifications.cs index dc320fc..83be9c7 100644 --- a/SpixiBot/Network/PushNotifications.cs +++ b/SpixiBot/Network/PushNotifications.cs @@ -3,6 +3,9 @@ using System; using System.Linq; using System.Net; +using System.Net.Http; +using System.Security.Policy; +using System.Text; using System.Threading; namespace SpixiBot.Network @@ -42,7 +45,8 @@ public void stop() running = false; if(pushNotificationThread != null) { - pushNotificationThread.Abort(); + pushNotificationThread.Interrupt(); + pushNotificationThread.Join(); pushNotificationThread = null; } } @@ -101,13 +105,14 @@ private bool sendPushMessage(string receiver, string sender, bool push) string URI = String.Format("{0}/push.php", serverUrl); string parameters = String.Format("tag={0}&data={1}&pk={2}&push={3}&fa={4}", receiver, data, "", push, sender); - using (WebClient client = new WebClient()) + using (HttpClient client = new HttpClient()) { try { - client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; - string htmlCode = client.UploadString(URI, parameters); - if (htmlCode.Equals("OK")) + HttpContent httpContent = new StringContent(parameters, Encoding.UTF8, "application/x-www-form-urlencoded"); + var response = client.PostAsync(URI, httpContent).Result; + string body = response.Content.ReadAsStringAsync().Result; + if (body.Equals("OK")) { return true; } diff --git a/SpixiBot/Network/StreamProcessor.cs b/SpixiBot/Network/StreamProcessor.cs index f821dd0..9ef5e83 100644 --- a/SpixiBot/Network/StreamProcessor.cs +++ b/SpixiBot/Network/StreamProcessor.cs @@ -449,7 +449,7 @@ public static void onBotAction(byte[] action_data, RemoteEndpoint endpoint, int return; } - CoreProtocolMessage.broadcastProtocolMessage(new char[] { 'M', 'H' }, ProtocolMessageCode.transactionData, stream_tx.transaction.getBytes(), null); + CoreProtocolMessage.broadcastProtocolMessage(new char[] { 'M', 'H' }, ProtocolMessageCode.transactionData2, stream_tx.transaction.getBytes(true, true), null); CoreProtocolMessage.broadcastGetTransaction(stream_tx.transaction.id, 0, null, false); PendingTransactions.addPendingLocalTransaction(stream_tx.transaction, stream_tx.messageID); break; diff --git a/SpixiBot/Program.cs b/SpixiBot/Program.cs index 7ed3970..007451e 100644 --- a/SpixiBot/Program.cs +++ b/SpixiBot/Program.cs @@ -56,8 +56,10 @@ static void checkRequiredFiles() } } + static void checkVCRedist() { +#pragma warning disable CA1416 // Validate platform compatibility object installed_vc_redist = Microsoft.Win32.Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\x64", "Installed", 0); object installed_vc_redist_debug = Microsoft.Win32.Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\debug\\x64", "Installed", 0); bool success = false; @@ -144,6 +146,7 @@ static void checkVCRedist() Console.ReadLine(); Environment.Exit(-1); } +#pragma warning restore CA1416 // Validate platform compatibility } static void Main(string[] args) @@ -154,7 +157,7 @@ static void Main(string[] args) IXICore.Utils.ConsoleHelpers.prepareWindowsConsole(); // Start logging - if(!Logging.start(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location))) + if (!Logging.start(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location))) { IxianHandler.forceShutdown = true; Logging.info("Press ENTER to exit."); @@ -240,7 +243,8 @@ static void onStart(string[] args) if (mainLoopThread != null) { - mainLoopThread.Abort(); + mainLoopThread.Interrupt(); + mainLoopThread.Join(); mainLoopThread = null; } diff --git a/SpixiBot/SpixiBot.csproj b/SpixiBot/SpixiBot.csproj index 433e24e..ad32dba 100644 --- a/SpixiBot/SpixiBot.csproj +++ b/SpixiBot/SpixiBot.csproj @@ -1,102 +1,24 @@ - - - + - Debug - AnyCPU - {F408F9F2-C3A1-4FE2-8443-6D9E251924A8} Exe - SpixiBot - SpixiBot - v4.8 - 512 - true - - - x64 - true - full - false - bin\Debug\ TRACE;DEBUG;SpixiBot_BUILD - prompt - 4 - false x64 - pdbonly - true - bin\Release\ TRACE;SpixiBot_BUILD - prompt - 4 - false SpixiBot.ico + + net6.0 + false + - - ..\packages\Portable.BouncyCastle.1.8.8\lib\net40\BouncyCastle.Crypto.dll - - - ..\packages\FluentCommandLineParser.1.4.3\lib\net35\FluentCommandLineParser.dll - - - ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll - - - ..\packages\Open.NAT.2.1.0.0\lib\net45\Open.Nat.dll - - - ..\packages\sqlite-net-pcl.1.6.292\lib\netstandard1.1\SQLite-net.dll - - - ..\packages\SQLitePCLRaw.bundle_green.1.1.14\lib\net45\SQLitePCLRaw.batteries_green.dll - - - ..\packages\SQLitePCLRaw.bundle_green.1.1.14\lib\net45\SQLitePCLRaw.batteries_v2.dll - - - ..\packages\SQLitePCLRaw.core.1.1.14\lib\net45\SQLitePCLRaw.core.dll - - - ..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.14\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -106,6 +28,21 @@ + + + + + + + + + + + + + + + @@ -116,19 +53,5 @@ - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - + \ No newline at end of file diff --git a/SpixiBot/packages.config b/SpixiBot/packages.config deleted file mode 100644 index 7236520..0000000 --- a/SpixiBot/packages.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file