Use paths relative to the location of the executable and not absolute paths.

This allows the executable to be relocated without issues with the configuration files.
This commit is contained in:
2024-03-07 19:19:22 -05:00
parent e297cfb710
commit 9e45b418f9
34 changed files with 74 additions and 48 deletions

View File

@@ -1,14 +1,14 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<configuration> <configuration>
<appSettings> <appSettings>
<add key="torConfigurationFile" value="C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\torcc" /> <add key="torConfigurationFile" value="torcc" />
<add key="torControlPassword" value="" /> <add key="torControlPassword" value="" />
<add key="captureTorConsoleOuput" value="true" /> <add key="captureTorConsoleOuput" value="true" />
<add key="torControlPort" value="9051" /> <add key="torControlPort" value="9051" />
<add key="torDefaultConfigurationFile" value="" /> <add key="torDefaultConfigurationFile" value="" />
<add key="geoipfile" value="C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\geoip" /> <add key="geoipfile" value="geoip" />
<add key="geoip6file" value="C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\geoip6" /> <add key="geoip6file" value="geoip6" />
<add key="torPath" value="C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\Tor.exe" /> <add key="torPath" value="Tor\Tor\Tor.exe" />
<add key="ClientSettingsProvider.ServiceUri" value="" /> <add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings> </appSettings>
<startup> <startup>

View File

@@ -15,6 +15,7 @@ using MarketData;
using MarketData.Utils; using MarketData.Utils;
using Utility=MarketData.Utils.Utility; using Utility=MarketData.Utils.Utility;
// This project must be built in 32 bit mode. Due to the size of IntPtr being 64 and not 32 as needed.
// Tor Current Version // Tor Current Version
// https://www.torproject.org/download/tor/ // https://www.torproject.org/download/tor/
@@ -269,7 +270,9 @@ namespace TorWebClient
{ {
try try
{ {
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Creating {0}",pathTorConfig)); String currentWorkingDirectory = Directory.GetCurrentDirectory();
pathTorConfig=currentWorkingDirectory+@"\Tor\Tor\"+pathTorConfig;
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Creating {0} ",pathTorConfig));
String pathBackupTorConfig=pathTorConfig+".bak"; String pathBackupTorConfig=pathTorConfig+".bak";
if(File.Exists(pathTorConfig)) if(File.Exists(pathTorConfig))
{ {
@@ -439,7 +442,6 @@ namespace TorWebClient
} }
static void Main(string[] args) static void Main(string[] args)
{ {
Console.WriteLine("TorWebClient is running {0} bits.",Utility.Is64Bit()?64:32);
try{Program.SetConsoleCtrlHandler(new HandlerRoutine(Program.ConsoleCtrlCheck),true);} try{Program.SetConsoleCtrlHandler(new HandlerRoutine(Program.ConsoleCtrlCheck),true);}
catch(Exception exception){Console.WriteLine(exception.ToString());} catch(Exception exception){Console.WriteLine(exception.ToString());}
if(!Utility.IsAdministrator()) if(!Utility.IsAdministrator())

View File

@@ -17,3 +17,22 @@ C:\boneyard\Tor.Mod\TorWebClient\TorClient\bin\Debug\System.Runtime.CompilerServ
C:\boneyard\Tor.Mod\TorWebClient\TorClient\obj\Debug\Tor.csprojResolveAssemblyReference.cache C:\boneyard\Tor.Mod\TorWebClient\TorClient\obj\Debug\Tor.csprojResolveAssemblyReference.cache
C:\boneyard\Tor.Mod\TorWebClient\TorClient\obj\Debug\Tor.dll C:\boneyard\Tor.Mod\TorWebClient\TorClient\obj\Debug\Tor.dll
C:\boneyard\Tor.Mod\TorWebClient\TorClient\obj\Debug\Tor.pdb C:\boneyard\Tor.Mod\TorWebClient\TorClient\obj\Debug\Tor.pdb
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\Tor.dll
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\Tor.pdb
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\MarketDataLib.dll
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\HtmlAgilityPack.dll
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\Newtonsoft.Json.dll
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\Axiom.Core.dll
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\System.Threading.Tasks.Extensions.dll
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\log4net.dll
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\System.Runtime.CompilerServices.Unsafe.dll
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\MarketDataLib.pdb
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\Newtonsoft.Json.pdb
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\Newtonsoft.Json.xml
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\Axiom.Core.pdb
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\System.Threading.Tasks.Extensions.xml
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\log4net.xml
C:\boneyard\Tor\TorWebClient\TorClient\bin\Debug\System.Runtime.CompilerServices.Unsafe.xml
C:\boneyard\Tor\TorWebClient\TorClient\obj\Debug\Tor.csprojResolveAssemblyReference.cache
C:\boneyard\Tor\TorWebClient\TorClient\obj\Debug\Tor.dll
C:\boneyard\Tor\TorWebClient\TorClient\obj\Debug\Tor.pdb

Binary file not shown.

Binary file not shown.

View File

@@ -4,6 +4,6 @@
AvoidDiskWrites 1 AvoidDiskWrites 1
ControlPort 9051 ControlPort 9051
ExitNodes {US} ExitNodes {US}
GeoIPFile C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\geoip GeoIPFile geoip
GeoIPv6File C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\geoip6 GeoIPv6File geoip6
SocksPort 9050 SocksPort 9050

View File

@@ -1,9 +1,3 @@
# This file was generated by Tor; if you edit it, comments will not be preserved # Created by TorWebClient
# The old torrc file was renamed to torrc.orig.1 or similar, and Tor will ignore it # If non-zero, try to write to disk less frequently than we would otherwise.
AvoidDiskWrites 1 AvoidDiskWrites 1
ControlPort 9051
ExitNodes {US}
GeoIPFile C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\geoip
GeoIPv6File C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\geoip6
SocksPort 9050

View File

@@ -1,3 +0,0 @@
# Created by TorWebClient
# If non-zero, try to write to disk less frequently than we would otherwise.
AvoidDiskWrites 1

View File

@@ -1,3 +0,0 @@
# Created by TorWebClient
# If non-zero, try to write to disk less frequently than we would otherwise.
AvoidDiskWrites 1

View File

@@ -1,3 +0,0 @@
# Created by TorWebClient
# If non-zero, try to write to disk less frequently than we would otherwise.
AvoidDiskWrites 1

View File

@@ -1,3 +0,0 @@
# Created by TorWebClient
# If non-zero, try to write to disk less frequently than we would otherwise.
AvoidDiskWrites 1

View File

@@ -1,3 +0,0 @@
# Created by TorWebClient
# If non-zero, try to write to disk less frequently than we would otherwise.
AvoidDiskWrites 1

View File

@@ -1,3 +0,0 @@
# Created by TorWebClient
# If non-zero, try to write to disk less frequently than we would otherwise.
AvoidDiskWrites 1

View File

@@ -1,3 +0,0 @@
# Created by TorWebClient
# If non-zero, try to write to disk less frequently than we would otherwise.
AvoidDiskWrites 1

View File

@@ -1,3 +0,0 @@
# Created by TorWebClient
# If non-zero, try to write to disk less frequently than we would otherwise.
AvoidDiskWrites 1

Binary file not shown.

View File

@@ -1,14 +1,14 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<configuration> <configuration>
<appSettings> <appSettings>
<add key="torConfigurationFile" value="C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\torcc" /> <add key="torConfigurationFile" value="torcc" />
<add key="torControlPassword" value="" /> <add key="torControlPassword" value="" />
<add key="captureTorConsoleOuput" value="true" /> <add key="captureTorConsoleOuput" value="true" />
<add key="torControlPort" value="9051" /> <add key="torControlPort" value="9051" />
<add key="torDefaultConfigurationFile" value="" /> <add key="torDefaultConfigurationFile" value="" />
<add key="geoipfile" value="C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\geoip" /> <add key="geoipfile" value="geoip" />
<add key="geoip6file" value="C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\geoip6" /> <add key="geoip6file" value="geoip6" />
<add key="torPath" value="C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\Tor.exe" /> <add key="torPath" value="Tor\Tor\Tor.exe" />
<add key="ClientSettingsProvider.ServiceUri" value="" /> <add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings> </appSettings>
<startup> <startup>

Binary file not shown.

View File

@@ -1,14 +1,14 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<configuration> <configuration>
<appSettings> <appSettings>
<add key="torConfigurationFile" value="C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\torcc" /> <add key="torConfigurationFile" value="torcc" />
<add key="torControlPassword" value="" /> <add key="torControlPassword" value="" />
<add key="captureTorConsoleOuput" value="true" /> <add key="captureTorConsoleOuput" value="true" />
<add key="torControlPort" value="9051" /> <add key="torControlPort" value="9051" />
<add key="torDefaultConfigurationFile" value="" /> <add key="torDefaultConfigurationFile" value="" />
<add key="geoipfile" value="C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\geoip" /> <add key="geoipfile" value="geoip" />
<add key="geoip6file" value="C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\geoip6" /> <add key="geoip6file" value="geoip6" />
<add key="torPath" value="C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\Tor\Tor\Tor.exe" /> <add key="torPath" value="Tor\Tor\Tor.exe" />
<add key="ClientSettingsProvider.ServiceUri" value="" /> <add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings> </appSettings>
<startup> <startup>

View File

@@ -33,3 +33,38 @@ C:\boneyard\Tor.Mod\TorWebClient\bin\Debug\System.Runtime.CompilerServices.Unsaf
C:\boneyard\Tor.Mod\TorWebClient\obj\Debug\TorProxy.csprojResolveAssemblyReference.cache C:\boneyard\Tor.Mod\TorWebClient\obj\Debug\TorProxy.csprojResolveAssemblyReference.cache
C:\boneyard\Tor.Mod\TorWebClient\obj\Debug\TorProxy.exe C:\boneyard\Tor.Mod\TorWebClient\obj\Debug\TorProxy.exe
C:\boneyard\Tor.Mod\TorWebClient\obj\Debug\TorProxy.pdb C:\boneyard\Tor.Mod\TorWebClient\obj\Debug\TorProxy.pdb
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor\Tor\libcrypto-1_1-x64.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor\Tor\libevent-2-1-7.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor\Tor\libevent_core-2-1-7.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor\Tor\libevent_extra-2-1-7.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor\Tor\libgcc_s_seh-1.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor\Tor\libssl-1_1-x64.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor\Tor\libssp-0.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor\Tor\libwinpthread-1.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor\Tor\tor.exe
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor\Tor\zlib1.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor\Tor\geoip
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor\Tor\geoip6
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor\Tor\torrc-defaults
C:\boneyard\Tor\TorWebClient\bin\Debug\TorProxy.exe.config
C:\boneyard\Tor\TorWebClient\bin\Debug\TorProxy.exe
C:\boneyard\Tor\TorWebClient\bin\Debug\TorProxy.pdb
C:\boneyard\Tor\TorWebClient\bin\Debug\MarketDataLib.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\HtmlAgilityPack.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\Newtonsoft.Json.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\Axiom.Core.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\System.Threading.Tasks.Extensions.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\log4net.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\System.Runtime.CompilerServices.Unsafe.dll
C:\boneyard\Tor\TorWebClient\bin\Debug\MarketDataLib.pdb
C:\boneyard\Tor\TorWebClient\bin\Debug\Tor.pdb
C:\boneyard\Tor\TorWebClient\bin\Debug\Newtonsoft.Json.pdb
C:\boneyard\Tor\TorWebClient\bin\Debug\Newtonsoft.Json.xml
C:\boneyard\Tor\TorWebClient\bin\Debug\Axiom.Core.pdb
C:\boneyard\Tor\TorWebClient\bin\Debug\System.Threading.Tasks.Extensions.xml
C:\boneyard\Tor\TorWebClient\bin\Debug\log4net.xml
C:\boneyard\Tor\TorWebClient\bin\Debug\System.Runtime.CompilerServices.Unsafe.xml
C:\boneyard\Tor\TorWebClient\obj\Debug\TorProxy.csprojResolveAssemblyReference.cache
C:\boneyard\Tor\TorWebClient\obj\Debug\TorProxy.exe
C:\boneyard\Tor\TorWebClient\obj\Debug\TorProxy.pdb

Binary file not shown.

Binary file not shown.