@@ -69,7 +69,7 @@ namespace Shadowsocks.Controller | |||
} | |||
else | |||
{ | |||
abpContent = File.ReadAllText(Utils.GetDataPath("abp.js")); | |||
abpContent = File.ReadAllText("abp.js"); | |||
} | |||
List<string> userruleLines = new List<string>(); | |||
@@ -39,8 +39,8 @@ namespace Shadowsocks.Controller | |||
{ | |||
if (!File.Exists(PAC_FILE)) | |||
{ | |||
string defaultRule = File.ReadAllText(Utils.GetDataPath("default-abp-rule.js")); | |||
string abpJs = File.ReadAllText(Utils.GetDataPath("abp.js")); | |||
string defaultRule = File.ReadAllText("default-abp-rule.js"); | |||
string abpJs = File.ReadAllText("abp.js"); | |||
File.WriteAllText(PAC_FILE, defaultRule + abpJs); | |||
} | |||
return PAC_FILE; | |||
@@ -50,7 +50,7 @@ namespace Shadowsocks.Controller | |||
{ | |||
if (!File.Exists(USER_RULE_FILE)) | |||
{ | |||
File.WriteAllText(USER_RULE_FILE, Utils.GetDataPath("user-rule.txt")); | |||
File.WriteAllText(USER_RULE_FILE, "user-rule.txt"); | |||
} | |||
return USER_RULE_FILE; | |||
} | |||
@@ -59,8 +59,8 @@ namespace Shadowsocks.Controller | |||
{ | |||
if (!File.Exists(PAC_FILE)) | |||
{ | |||
string defaultRule = File.ReadAllText(Utils.GetDataPath("default-abp-rule.js")); | |||
string abpJs = File.ReadAllText(Utils.GetDataPath("abp.js")); | |||
string defaultRule = File.ReadAllText("default-abp-rule.js"); | |||
string abpJs = File.ReadAllText("abp.js"); | |||
File.WriteAllText(PAC_FILE, defaultRule + abpJs); | |||
} | |||
return File.ReadAllText(PAC_FILE, Encoding.UTF8); | |||
@@ -27,7 +27,7 @@ namespace Shadowsocks.Controller | |||
_uid = Application.StartupPath.GetHashCode(); // Currently we use ss's StartupPath to identify different Privoxy instance. | |||
_uniqueConfigFile = $"privoxy_{_uid}.conf"; | |||
_privoxyJob = new Job(); | |||
File.Copy(Utils.GetDataPath("privoxy.exe"), Utils.GetTempPath("ss_privoxy.exe")); | |||
File.Copy("privoxy.exe", Utils.GetTempPath("ss_privoxy.exe")); | |||
} | |||
catch (IOException e) | |||
{ | |||
@@ -46,7 +46,7 @@ namespace Shadowsocks.Controller | |||
{ | |||
KillProcess(p); | |||
} | |||
string privoxyConfig = File.ReadAllText(Utils.GetDataPath("privoxy_conf.txt")); | |||
string privoxyConfig = File.ReadAllText("privoxy_conf.txt"); | |||
_runningPort = GetFreePort(configuration.isIPv6Enabled); | |||
privoxyConfig = privoxyConfig.Replace("__SOCKS_PORT__", configuration.localPort.ToString()); | |||
privoxyConfig = privoxyConfig.Replace("__PRIVOXY_BIND_PORT__", _runningPort.ToString()); | |||
@@ -55,16 +55,6 @@ namespace Shadowsocks.Util | |||
return _tempPath; | |||
} | |||
public static string GetDataPath() | |||
{ | |||
return Path.Combine(Directory.GetCurrentDirectory(), "Data"); | |||
} | |||
public static string GetDataPath(string filename) | |||
{ | |||
return Path.Combine(GetDataPath(), filename); | |||
} | |||
public enum WindowsThemeMode { Dark, Light } | |||
// Support on Windows 10 1903+ | |||
@@ -264,37 +264,41 @@ | |||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> | |||
</None> | |||
<None Include="Resources\ssw128.png" /> | |||
<Content Include="Data\abp.js"> | |||
<ContentWithTargetPath Include="Data\abp.js"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</Content> | |||
<Content Include="Data\default-abp-rule.js"> | |||
<TargetPath>abp.js</TargetPath> | |||
</ContentWithTargetPath > | |||
<ContentWithTargetPath Include="Data\default-abp-rule.js"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
<TargetPath>default-abp-rule.js</TargetPath> | |||
</ContentWithTargetPath > | |||
<ContentWithTargetPath Include="Data\i18n.csv"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</Content> | |||
<TargetPath>i18n.csv</TargetPath> | |||
</ContentWithTargetPath > | |||
<ContentWithTargetPath Include="Data\libsscrypto.dll"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
<TargetPath>libsscrypto.dll</TargetPath> | |||
</ContentWithTargetPath > | |||
<Content Include="Data\privoxy.exe"> | |||
<ContentWithTargetPath Include="Data\privoxy.exe"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</Content> | |||
<Content Include="Data\privoxy_conf.txt"> | |||
<TargetPath>privoxy.exe</TargetPath> | |||
</ContentWithTargetPath > | |||
<ContentWithTargetPath Include="Data\privoxy_conf.txt"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</Content> | |||
<TargetPath>privoxy_conf.txt</TargetPath> | |||
</ContentWithTargetPath > | |||
<ContentWithTargetPath Include="Data\sysproxy.exe"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
<TargetPath>sysproxy.exe</TargetPath> | |||
</ContentWithTargetPath> | |||
</ContentWithTargetPath > | |||
<ContentWithTargetPath Include="Data\sysproxy64.exe"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
<TargetPath>sysproxy64.exe</TargetPath> | |||
</ContentWithTargetPath> | |||
</ContentWithTargetPath > | |||
<ContentWithTargetPath Include="Data\user-rule.txt"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
<TargetPath>user-rule.txt</TargetPath> | |||
</ContentWithTargetPath> | |||
<ContentWithTargetPath Include="Data\i18n.csv"> | |||
<TargetPath>i18n.csv</TargetPath> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</ContentWithTargetPath > | |||
<None Include="FodyWeavers.xml"> | |||
<SubType>Designer</SubType> | |||