Skip to content

Commit

Permalink
xsbc-0.5.6-PR1
Browse files Browse the repository at this point in the history
- .net6 migration
- updated to latest IxiCore
  • Loading branch information
IxiAngel committed Dec 31, 2022
1 parent 5bf9d88 commit 8fd4b03
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 133 deletions.
14 changes: 7 additions & 7 deletions SpixiBot.sln
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion SpixiBot/Meta/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class Config
public static List<Address> whiteList = new List<Address>();

// 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";

Expand Down
7 changes: 4 additions & 3 deletions SpixiBot/Meta/Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ static public void stop()

if (maintenanceThread != null)
{
maintenanceThread.Abort();
maintenanceThread.Interrupt();
maintenanceThread.Join();
maintenanceThread = null;
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
}
Expand Down
15 changes: 10 additions & 5 deletions SpixiBot/Network/PushNotifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -42,7 +45,8 @@ public void stop()
running = false;
if(pushNotificationThread != null)
{
pushNotificationThread.Abort();
pushNotificationThread.Interrupt();
pushNotificationThread.Join();
pushNotificationThread = null;
}
}
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion SpixiBot/Network/StreamProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions SpixiBot/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -144,6 +146,7 @@ static void checkVCRedist()
Console.ReadLine();
Environment.Exit(-1);
}
#pragma warning restore CA1416 // Validate platform compatibility
}

static void Main(string[] args)
Expand All @@ -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.");
Expand Down Expand Up @@ -240,7 +243,8 @@ static void onStart(string[] args)

if (mainLoopThread != null)
{
mainLoopThread.Abort();
mainLoopThread.Interrupt();
mainLoopThread.Join();
mainLoopThread = null;
}

Expand Down
121 changes: 22 additions & 99 deletions SpixiBot/SpixiBot.csproj
Original file line number Diff line number Diff line change
@@ -1,102 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F408F9F2-C3A1-4FE2-8443-6D9E251924A8}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>SpixiBot</RootNamespace>
<AssemblyName>SpixiBot</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;SpixiBot_BUILD</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;SpixiBot_BUILD</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>SpixiBot.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.8.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.8\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="FluentCommandLineParser, Version=1.4.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\FluentCommandLineParser.1.4.3\lib\net35\FluentCommandLineParser.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Open.Nat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f22a6a4582336c76, processorArchitecture=MSIL">
<HintPath>..\packages\Open.NAT.2.1.0.0\lib\net45\Open.Nat.dll</HintPath>
</Reference>
<Reference Include="SQLite-net, Version=1.6.292.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\sqlite-net-pcl.1.6.292\lib\netstandard1.1\SQLite-net.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.batteries_green, Version=1.1.14.520, Culture=neutral, PublicKeyToken=a84b7dcfb1391f7f, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.bundle_green.1.1.14\lib\net45\SQLitePCLRaw.batteries_green.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.batteries_v2, Version=1.1.14.520, Culture=neutral, PublicKeyToken=8226ea5df37bcae9, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.bundle_green.1.1.14\lib\net45\SQLitePCLRaw.batteries_v2.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.core, Version=1.1.14.520, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.core.1.1.14\lib\net45\SQLitePCLRaw.core.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.provider.e_sqlite3, Version=1.1.14.520, Culture=neutral, PublicKeyToken=9c301db686d0bd12, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.14\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="API\APIServer.cs" />
<Compile Include="Messages\Messages.cs" />
<Compile Include="Meta\Config.cs" />
<Compile Include="Meta\Node.cs" />
<Compile Include="Meta\Settings.cs" />
<Compile Include="Meta\StatsConsoleScreen.cs" />
<Compile Include="Network\NetworkProtocol.cs" />
<Compile Include="Network\PushNotifications.cs" />
<Compile Include="Network\QuotaManager.cs" />
<Compile Include="Network\StreamProcessor.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>

<Content Include="html\css\bot\settings.css" />
<Content Include="html\js\bot\settings.js" />
<Content Include="html\js\custom.js" />
Expand All @@ -106,6 +28,21 @@
<ItemGroup>
<Folder Include="html\img\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentCommandLineParser" Version="1.4.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Open.Nat" Version="2.1.0" />
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageReference Include="sqlite-net-pcl" Version="1.6.292" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="1.1.14" />
<PackageReference Include="SQLitePCLRaw.core" Version="1.1.14" />
<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3.linux" Version="1.1.14" />
<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3.osx" Version="1.1.14" />
<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3.v110_xp" Version="1.1.14" />
<PackageReference Include="SQLitePCLRaw.provider.e_sqlite3.netstandard11" Version="1.1.14" />
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="7.0.0" />
</ItemGroup>
<Import Project="..\..\Ixian-Core\IXICore.projitems" Label="Shared" />
<Target Name="CopyHTMLToOutput" AfterTargets="CoreCompile">
<ItemGroup>
<IXIPB1 Include="$(SolutionDir)\..\Ixian-Core\html\**\*.*" />
Expand All @@ -116,19 +53,5 @@
<Copy SourceFiles="@(IXIPB1)" DestinationFiles="@(IXIPB1->'$(OutputPath)\html\%(RecursiveDir)%(Filename)%(Extension)')" ContinueOnError="true" />
<Copy SourceFiles="@(IXIPB2)" DestinationFiles="@(IXIPB2->'$(OutputPath)\html\%(RecursiveDir)%(Filename)%(Extension)')" ContinueOnError="true" />
</Target>
<Import Project="..\..\Ixian-Core\IXICore.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\IxianDLT\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets" Condition="Exists('..\IxianDLT\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" />
<Import Project="..\IxianDLT\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets" Condition="Exists('..\IxianDLT\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" />
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>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}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets'))" />
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets'))" />
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets'))" />
</Target>
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" />
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.14\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" />

</Project>
15 changes: 0 additions & 15 deletions SpixiBot/packages.config

This file was deleted.

0 comments on commit 8fd4b03

Please sign in to comment.