Browse Source

Fix "4.0.4 launch exception" error (PR #1232)

tags/4.0.5
Jacob Zuo celeron533 7 years ago
parent
commit
f0b196c8c3
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      shadowsocks-csharp/Util/SystemProxy/Sysproxy.cs

+ 6
- 3
shadowsocks-csharp/Util/SystemProxy/Sysproxy.cs View File

@@ -48,14 +48,15 @@ namespace Shadowsocks.Util.SystemProxy
public static void SetIEProxy(bool enable, bool global, string proxyServer, string pacURL) public static void SetIEProxy(bool enable, bool global, string proxyServer, string pacURL)
{ {
Read(); Read();
if (!_userSettings.UserSettingsRecorded) if (!_userSettings.UserSettingsRecorded)
{ {
// record user settings // record user settings
ExecSysproxy("query"); ExecSysproxy("query");
ParseQueryStr(_queryStr); ParseQueryStr(_queryStr);
} }
string arguments;
string arguments;
if (enable) if (enable)
{ {
arguments = global arguments = global
@@ -138,8 +139,10 @@ namespace Shadowsocks.Util.SystemProxy
try { try {
string configContent = File.ReadAllText(_userWininetConfigFile); string configContent = File.ReadAllText(_userWininetConfigFile);
_userSettings = JsonConvert.DeserializeObject<SysproxyConfig>(configContent); _userSettings = JsonConvert.DeserializeObject<SysproxyConfig>(configContent);
} catch (FileNotFoundException) {
_userSettings = new SysproxyConfig();
} catch(Exception) {
// Suppress all exceptions. finally block will initialize new user config settings.
} finally {
if (_userSettings == null) _userSettings = new SysproxyConfig();
} }
} }


Loading…
Cancel
Save