Make Backend Tor ready.
ADD
MagicalCryptoWallet.Backend/Logs.txt
+INFO 2/16/2018 12:17:28 PM +00:00
+Using APPDATA environment variable for initializing application data at `C:\Users\user\AppData\Roaming\MagicalCryptoWalletBackend`.
+
+INFO 2/16/2018 12:18:25 PM +00:00
+Using APPDATA environment variable for initializing application data at `C:\Users\user\AppData\Roaming\MagicalCryptoWalletBackend`.
+
+INFO 2/16/2018 12:21:49 PM +00:00
+Using APPDATA environment variable for initializing application data at `C:\Users\user\AppData\Roaming\MagicalCryptoWalletBackend`.
+
+INFO 2/16/2018 12:22:02 PM +00:00
+Using APPDATA environment variable for initializing application data at `C:\Users\user\AppData\Roaming\MagicalCryptoWalletBackend`.
+
+INFO 2/16/2018 12:22:32 PM +00:00
+Using APPDATA environment variable for initializing application data at `C:\Users\user\AppData\Roaming\MagicalCryptoWalletBackend`.
+

MODIFY
MagicalCryptoWallet.Backend/MagicalCryptoWallet.Backend.csproj
MagicalCryptoWallet.Backend/MagicalCryptoWallet.Backend.csproj
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<LangVersion>latest</LangVersion>
- <NoWarn>1701;1702;1705;1591</NoWarn>
+ <NoWarn>1701;1702;1705;1591;1573</NoWarn>
<Version>1.0</Version>
<Product>MagicalCryptoApi</Product>
<Copyright>MIT</Copyright>

MODIFY
MagicalCryptoWallet.Backend/Program.cs
MagicalCryptoWallet.Backend/Program.cs
@@ -3,10 +3,10 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
+using MagicalCryptoWallet.Logging;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Logging;
namespace MagicalCryptoWallet.Backend
{
@@ -16,12 +16,28 @@ namespace MagicalCryptoWallet.Backend
public static async Task Main(string[] args)
#pragma warning restore IDE1006 // Naming Styles
{
- await BuildWebHost(args).RunAsync();
- }
+ try
+ {
+ Logger.SetMinimumLevel(LogLevel.Debug);
+ Logger.SetModes(LogMode.Debug, LogMode.Console, LogMode.File);
+ Logger.SetFilePath("Logs.txt");
+
+ await Global.InitializeAsync();
- public static IWebHost BuildWebHost(string[] args) =>
- WebHost.CreateDefaultBuilder(args)
+ var endPoint = "http://localhost:37127/";
+
+ using (var host = WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
- .Build();
+ .UseUrls(endPoint)
+ .Build())
+ {
+ await host.RunAsync();
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.LogWarning<Program>(ex);
+ }
+ }
}
}

MODIFY
MagicalCryptoWallet.Backend/Properties/launchSettings.json
MagicalCryptoWallet.Backend/Properties/launchSettings.json
{
- "iisSettings": {
- "windowsAuthentication": false,
- "anonymousAuthentication": true,
- "iisExpress": {
- "applicationUrl": "http://localhost:61916/",
- "sslPort": 0
- }
- },
"profiles": {
- "IIS Express": {
- "commandName": "IISExpress",
- "launchBrowser": true,
- "launchUrl": "swagger",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- }
- },
"MagicalCryptoWallet.Backend": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
- "applicationUrl": "http://localhost:61917/"
+ "applicationUrl": "http://localhost:37127/"
}
}
}

MODIFY
MagicalCryptoWallet.Tests/TorTests.cs
MagicalCryptoWallet.Tests/TorTests.cs
@@ -290,8 +290,8 @@ namespace MagicalCryptoWallet.Tests
[Fact]
public async Task TorRunningAsync()
{
- Assert.True(await TorHttpClient.IsTorRunning());
- Assert.False(await TorHttpClient.IsTorRunning(new IPEndPoint(IPAddress.Loopback, 9054)));
+ Assert.True(await TorHttpClient.IsTorRunningAsync());
+ Assert.False(await TorHttpClient.IsTorRunningAsync(new IPEndPoint(IPAddress.Loopback, 9054)));
}
private static async Task<List<string>> QBitTestAsync(TorHttpClient client, int times, bool alterRequests = false)

MODIFY
MagicalCryptoWallet/ClientSideFilter/DirectoryStream.cs
MagicalCryptoWallet/ClientSideFilter/DirectoryStream.cs
@@ -61,7 +61,6 @@ namespace MagicalCryptoWallet.Backend
private volatile Stream _currentStream;
private volatile int _currentStreamIndex;
- private long _length = -1;
private long _position;
protected void SetStreams(IEnumerable<Stream> streams)

MODIFY
MagicalCryptoWallet/Logging/Logger.cs
MagicalCryptoWallet/Logging/Logger.cs
@@ -27,7 +27,7 @@ namespace MagicalCryptoWallet.Logging
private static readonly object Lock = new object();
/// <summary>
- /// MB
+ /// KB
/// </summary>
public static long MaximumLogFileSize { get; private set; } = 10000; // approx 10 MB

MODIFY
MagicalCryptoWallet/MagicalCryptoWallet.csproj
MagicalCryptoWallet/MagicalCryptoWallet.csproj
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<LangVersion>latest</LangVersion>
- <NoWarn>1701;1702;1705;1591</NoWarn>
+ <NoWarn>1701;1702;1705;1591;1573</NoWarn>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

MODIFY
MagicalCryptoWallet/TorSocks5/TorHttpClient.cs
MagicalCryptoWallet/TorSocks5/TorHttpClient.cs
@@ -37,7 +37,7 @@ namespace MagicalCryptoWallet.TorSocks5
IsolateStream = isolateStream;
}
- public static async Task<bool> IsTorRunning(IPEndPoint torSocks5EndPoint = null)
+ public static async Task<bool> IsTorRunningAsync(IPEndPoint torSocks5EndPoint = null)
{
using (var client = new TorSocks5Client(torSocks5EndPoint))
{

Make Backend Tor ready.