1
- using System ;
1
+ using Microsoft . Win32 ;
2
+ using System ;
2
3
using System . Collections . Generic ;
3
4
using System . Configuration ;
4
5
using System . Diagnostics ;
5
6
using System . IO ;
6
7
using System . Net . NetworkInformation ;
7
8
using System . Threading ;
8
- using Microsoft . Win32 ;
9
9
10
10
namespace Uninstall
11
11
{
@@ -38,7 +38,7 @@ internal static void BackupConfigurationFile()
38
38
{
39
39
try
40
40
{
41
- var sdcConfig = Path . Combine ( Directory . GetCurrentDirectory ( ) , "SimpleDnsCrypt.exe.config" ) ;
41
+ var sdcConfig = Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "SimpleDnsCrypt.exe.config" ) ;
42
42
if ( ! File . Exists ( sdcConfig ) ) return ;
43
43
var sdcConfigMap = new ExeConfigurationFileMap
44
44
{
@@ -51,7 +51,7 @@ internal static void BackupConfigurationFile()
51
51
var setting = section . Settings . Get ( "BackupAndRestoreConfigOnUpdate" ) ;
52
52
var backupAndRestoreConfigOnUpdate = Convert . ToBoolean ( setting . Value . ValueXml . LastChild . InnerText ) ;
53
53
if ( ! backupAndRestoreConfigOnUpdate ) return ;
54
- var config = Path . Combine ( Directory . GetCurrentDirectory ( ) , DnsCryptProxyFolder ,
54
+ var config = Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , DnsCryptProxyFolder ,
55
55
DnsCryptProxyConfigName ) ;
56
56
if ( ! File . Exists ( config ) ) return ;
57
57
var tmp = Path . Combine ( Path . GetTempPath ( ) , DnsCryptProxyConfigName + ".bak" ) ;
@@ -90,7 +90,8 @@ internal static void ExecuteWithArguments(string arguments)
90
90
const int timeout = 9000 ;
91
91
using ( var process = new Process ( ) )
92
92
{
93
- process . StartInfo . FileName = Path . Combine ( Directory . GetCurrentDirectory ( ) , DnsCryptProxyFolder , DnsCryptProxyExecutableName ) ;
93
+ process . StartInfo . FileName = Path . Combine ( AppDomain . CurrentDomain . BaseDirectory ,
94
+ DnsCryptProxyFolder , DnsCryptProxyExecutableName ) ;
94
95
process . StartInfo . Arguments = arguments ;
95
96
process . StartInfo . UseShellExecute = false ;
96
97
process . StartInfo . CreateNoWindow = true ;
0 commit comments