|
@@ -1,5 +1,5 @@ |
|
|
using System; |
|
|
|
|
|
using System.Windows.Forms; |
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
using Microsoft.Win32;
|
|
|
using Microsoft.Win32;
|
|
|
|
|
|
|
|
|
namespace Shadowsocks.Controller
|
|
|
namespace Shadowsocks.Controller
|
|
@@ -14,7 +14,7 @@ namespace Shadowsocks.Controller |
|
|
try
|
|
|
try
|
|
|
{
|
|
|
{
|
|
|
string path = Application.ExecutablePath;
|
|
|
string path = Application.ExecutablePath;
|
|
|
runKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
|
|
|
|
|
|
|
|
|
runKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
|
|
|
if (enabled)
|
|
|
if (enabled)
|
|
|
{
|
|
|
{
|
|
|
runKey.SetValue(Key, path);
|
|
|
runKey.SetValue(Key, path);
|
|
@@ -47,13 +47,13 @@ namespace Shadowsocks.Controller |
|
|
try
|
|
|
try
|
|
|
{
|
|
|
{
|
|
|
string path = Application.ExecutablePath;
|
|
|
string path = Application.ExecutablePath;
|
|
|
runKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
|
|
|
|
|
|
|
|
|
runKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
|
|
|
string[] runList = runKey.GetValueNames();
|
|
|
string[] runList = runKey.GetValueNames();
|
|
|
foreach (string item in runList)
|
|
|
foreach (string item in runList)
|
|
|
{
|
|
|
{
|
|
|
if (item.Equals(Key))
|
|
|
|
|
|
|
|
|
if (item == Key)
|
|
|
return true;
|
|
|
return true;
|
|
|
else if (item.Equals("Shadowsocks")) // Compatibility with older versions
|
|
|
|
|
|
|
|
|
else if (item == "Shadowsocks") // Compatibility with older versions
|
|
|
{
|
|
|
{
|
|
|
string value = Convert.ToString(runKey.GetValue(item));
|
|
|
string value = Convert.ToString(runKey.GetValue(item));
|
|
|
if (path.Equals(value, StringComparison.InvariantCultureIgnoreCase))
|
|
|
if (path.Equals(value, StringComparison.InvariantCultureIgnoreCase))
|
|
@@ -82,4 +82,4 @@ namespace Shadowsocks.Controller |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} |
|
|
|
|
|
|
|
|
}
|