@@ -1,3 +1,7 @@ | |||
2.1.6 2015-01-02 | |||
- Fix OPTIONS requests | |||
- Improve logs | |||
2.1.5 2014-12-25 | |||
- Fix QR Code compatibility with iOS | |||
- Only left button will trigger double click on tray icon | |||
@@ -1,7 +1,7 @@ | |||
shadowsocks-csharp | |||
================== | |||
Copyright (C) 2014 clowwindy <clowwindy42@gmail.com> | |||
Copyright (C) 2015 clowwindy <clowwindy42@gmail.com> | |||
This program is free software: you can redistribute it and/or modify | |||
it under the terms of the GNU General Public License as published by | |||
@@ -81,20 +81,38 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
qrcodejs | |||
-------- | |||
ZXing | |||
----- | |||
Copyright 2007 ZXing authors | |||
Licensed under the Apache License, Version 2.0 (the "License"); | |||
you may not use this file except in compliance with the License. | |||
You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
QRCode for C#4.0 Silverlight is translation of QRCode for JavaScript | |||
https://github.com/jeromeetienne/jquery-qrcode/ | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
Copyright (c) 2009 Kazuhiko Arase | |||
URL: http://www.d-project.com/ | |||
libsodium | |||
--------- | |||
Licensed under the MIT license: | |||
http://www.opensource.org/licenses/mit-license.php | |||
Copyright (c) 2013-2015 | |||
Frank Denis <j at pureftpd dot org> | |||
The word "QR Code" is registered trademark of | |||
DENSO WAVE INCORPORATED | |||
http://www.denso-wave.com/qrcode/faqpatent-e.html | |||
Permission to use, copy, modify, and/or distribute this software for any | |||
purpose with or without fee is hereby granted, provided that the above | |||
copyright notice and this permission notice appear in all copies. | |||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
@@ -1,39 +1,55 @@ | |||
using System; | |||
using System.Windows.Forms; | |||
using Microsoft.Win32; | |||
namespace Shadowsocks.Controller { | |||
class AutoStartup { | |||
public static bool Set(bool enabled) { | |||
try { | |||
string path = Application.ExecutablePath; | |||
RegistryKey runKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); | |||
if (enabled) { | |||
runKey.SetValue("Shadowsocks", path); | |||
} else { | |||
runKey.DeleteValue("Shadowsocks"); | |||
} | |||
runKey.Close(); | |||
return true; | |||
} catch (Exception) { | |||
return false; | |||
} | |||
} | |||
public static bool Check() { | |||
try { | |||
string path = Application.ExecutablePath; | |||
RegistryKey runKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run"); | |||
string[] runList = runKey.GetValueNames(); | |||
runKey.Close(); | |||
foreach (string item in runList) { | |||
if (item.Equals("Shadowsocks")) | |||
return true; | |||
} | |||
return false; | |||
} catch (Exception) { | |||
return false; | |||
} | |||
} | |||
} | |||
using Microsoft.Win32; | |||
namespace Shadowsocks.Controller | |||
{ | |||
class AutoStartup | |||
{ | |||
public static bool Set(bool enabled) | |||
{ | |||
try | |||
{ | |||
string path = Application.ExecutablePath; | |||
RegistryKey runKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); | |||
if (enabled) | |||
{ | |||
runKey.SetValue("Shadowsocks", path); | |||
} | |||
else | |||
{ | |||
runKey.DeleteValue("Shadowsocks"); | |||
} | |||
runKey.Close(); | |||
return true; | |||
} | |||
catch (Exception e) | |||
{ | |||
Logging.LogUsefulException(e); | |||
return false; | |||
} | |||
} | |||
public static bool Check() | |||
{ | |||
try | |||
{ | |||
string path = Application.ExecutablePath; | |||
RegistryKey runKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run"); | |||
string[] runList = runKey.GetValueNames(); | |||
runKey.Close(); | |||
foreach (string item in runList) | |||
{ | |||
if (item.Equals("Shadowsocks")) | |||
return true; | |||
} | |||
return false; | |||
} | |||
catch (Exception e) | |||
{ | |||
Logging.LogUsefulException(e); | |||
return false; | |||
} | |||
} | |||
} | |||
} |
@@ -3,7 +3,7 @@ using System.Collections.Generic; | |||
using System.Text; | |||
using System.Net.Sockets; | |||
using System.Net; | |||
using Shadowsocks.Encrypt; | |||
using Shadowsocks.Encryption; | |||
using Shadowsocks.Model; | |||
namespace Shadowsocks.Controller | |||
@@ -17,7 +17,7 @@ namespace Shadowsocks.Controller | |||
public string LatestVersionURL; | |||
public event EventHandler NewVersionFound; | |||
public const string Version = "2.1.5"; | |||
public const string Version = "2.1.6"; | |||
public void CheckUpdate() | |||
{ | |||
@@ -1,7 +1,7 @@ | |||
using System.Security.Cryptography; | |||
using System.Text; | |||
namespace Shadowsocks.Encrypt | |||
namespace Shadowsocks.Encryption | |||
{ | |||
public abstract class EncryptorBase | |||
: IEncryptor |
@@ -2,7 +2,7 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Reflection; | |||
namespace Shadowsocks.Encrypt | |||
namespace Shadowsocks.Encryption | |||
{ | |||
public static class EncryptorFactory | |||
{ |
@@ -2,7 +2,7 @@ | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace Shadowsocks.Encrypt | |||
namespace Shadowsocks.Encryption | |||
{ | |||
public interface IEncryptor : IDisposable | |||
{ |
@@ -3,7 +3,7 @@ using System.Collections.Generic; | |||
using System.Security.Cryptography; | |||
using System.Text; | |||
namespace Shadowsocks.Encrypt | |||
namespace Shadowsocks.Encryption | |||
{ | |||
public abstract class IVEncryptor | |||
: EncryptorBase |
@@ -6,7 +6,7 @@ using System.IO; | |||
using System.Runtime.InteropServices; | |||
using System.Text; | |||
namespace Shadowsocks.Encrypt | |||
namespace Shadowsocks.Encryption | |||
{ | |||
public class PolarSSL | |||
{ |
@@ -5,7 +5,7 @@ using System.Security.Cryptography; | |||
using System.Text; | |||
using System.Threading; | |||
namespace Shadowsocks.Encrypt | |||
namespace Shadowsocks.Encryption | |||
{ | |||
public class PolarSSLEncryptor | |||
: IVEncryptor, IDisposable |
@@ -6,7 +6,7 @@ using System.IO; | |||
using System.Runtime.InteropServices; | |||
using System.Text; | |||
namespace Shadowsocks.Encrypt | |||
namespace Shadowsocks.Encryption | |||
{ | |||
public class Sodium | |||
{ |
@@ -2,7 +2,7 @@ | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace Shadowsocks.Encrypt | |||
namespace Shadowsocks.Encryption | |||
{ | |||
public class SodiumEncryptor | |||
: IVEncryptor, IDisposable |
@@ -1,7 +1,7 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
namespace Shadowsocks.Encrypt | |||
namespace Shadowsocks.Encryption | |||
{ | |||
public class TableEncryptor | |||
: EncryptorBase |
@@ -11,7 +11,7 @@ using System.Runtime.InteropServices; | |||
[assembly: AssemblyConfiguration("")] | |||
[assembly: AssemblyCompany("")] | |||
[assembly: AssemblyProduct("Shadowsocks")] | |||
[assembly: AssemblyCopyright("Copyright © clowwindy 2014")] | |||
[assembly: AssemblyCopyright("Copyright © clowwindy 2015")] | |||
[assembly: AssemblyTrademark("")] | |||
[assembly: AssemblyCulture("")] | |||
@@ -1,26 +0,0 @@ | |||
//------------------------------------------------------------------------------ | |||
// <auto-generated> | |||
// This code was generated by a tool. | |||
// Runtime Version:4.0.30319.18444 | |||
// | |||
// Changes to this file may cause incorrect behavior and will be lost if | |||
// the code is regenerated. | |||
// </auto-generated> | |||
//------------------------------------------------------------------------------ | |||
namespace Shadowsocks.Properties { | |||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] | |||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { | |||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); | |||
public static Settings Default { | |||
get { | |||
return defaultInstance; | |||
} | |||
} | |||
} | |||
} |
@@ -1,7 +0,0 @@ | |||
<?xml version='1.0' encoding='utf-8'?> | |||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"> | |||
<Profiles> | |||
<Profile Name="(Default)" /> | |||
</Profiles> | |||
<Settings /> | |||
</SettingsFile> |
@@ -28,16 +28,7 @@ namespace Shadowsocks.View | |||
private MenuItem ShareOverLANItem; | |||
private MenuItem SeperatorItem; | |||
private MenuItem ConfigItem; | |||
private MenuItem menuItem4; | |||
private MenuItem editPACFileItem; | |||
private MenuItem QRCodeItem; | |||
private MenuItem ShowLogItem; | |||
private MenuItem aboutItem; | |||
private MenuItem ServersItem; | |||
private MenuItem menuItem3; | |||
private MenuItem quitItem; | |||
private MenuItem menuItem1; | |||
private MenuItem modeItem; | |||
private MenuItem globalModeItem; | |||
private MenuItem PACModeItem; | |||
private ConfigForm configForm; | |||
@@ -121,146 +112,39 @@ namespace Shadowsocks.View | |||
_notifyIcon.Text = text.Substring(0, Math.Min(63, text.Length)); | |||
} | |||
private MenuItem CreateMenuItem(string text, EventHandler click) | |||
{ | |||
return new MenuItem(I18N.GetString(text), click); | |||
} | |||
private MenuItem CreateMenuGroup(string text, MenuItem[] items) | |||
{ | |||
return new MenuItem(I18N.GetString(text), items); | |||
} | |||
private void LoadMenu() | |||
{ | |||
this.contextMenu1 = new System.Windows.Forms.ContextMenu(); | |||
this.enableItem = new System.Windows.Forms.MenuItem(); | |||
this.modeItem = new System.Windows.Forms.MenuItem(); | |||
this.PACModeItem = new System.Windows.Forms.MenuItem(); | |||
this.globalModeItem = new System.Windows.Forms.MenuItem(); | |||
this.AutoStartupItem = new System.Windows.Forms.MenuItem(); | |||
this.ShareOverLANItem = new System.Windows.Forms.MenuItem(); | |||
this.ServersItem = new System.Windows.Forms.MenuItem(); | |||
this.SeperatorItem = new System.Windows.Forms.MenuItem(); | |||
this.ConfigItem = new System.Windows.Forms.MenuItem(); | |||
this.menuItem4 = new System.Windows.Forms.MenuItem(); | |||
this.editPACFileItem = new System.Windows.Forms.MenuItem(); | |||
this.QRCodeItem = new System.Windows.Forms.MenuItem(); | |||
this.ShowLogItem = new System.Windows.Forms.MenuItem(); | |||
this.aboutItem = new System.Windows.Forms.MenuItem(); | |||
this.menuItem3 = new System.Windows.Forms.MenuItem(); | |||
this.quitItem = new System.Windows.Forms.MenuItem(); | |||
this.menuItem1 = new System.Windows.Forms.MenuItem(); | |||
// | |||
// contextMenu1 | |||
// | |||
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | |||
this.enableItem, | |||
this.modeItem, | |||
this.ServersItem, | |||
this.menuItem1, | |||
this.AutoStartupItem, | |||
this.ShareOverLANItem, | |||
this.editPACFileItem, | |||
this.menuItem4, | |||
this.QRCodeItem, | |||
this.ShowLogItem, | |||
this.aboutItem, | |||
this.menuItem3, | |||
this.quitItem}); | |||
// | |||
// enableItem | |||
// | |||
this.enableItem.Index = 0; | |||
this.enableItem.Text = I18N.GetString("Enable"); | |||
this.enableItem.Click += new System.EventHandler(this.EnableItem_Click); | |||
// | |||
// modeMenu | |||
// | |||
this.modeItem.Index = 1; | |||
this.modeItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | |||
this.PACModeItem, | |||
this.globalModeItem}); | |||
this.modeItem.Text = I18N.GetString("Mode"); | |||
// | |||
// PACModeItem | |||
// | |||
this.PACModeItem.Index = 0; | |||
this.PACModeItem.Text = I18N.GetString("PAC"); | |||
this.PACModeItem.Click += new System.EventHandler(this.PACModeItem_Click); | |||
// | |||
// globalModeItem | |||
// | |||
this.globalModeItem.Index = 1; | |||
this.globalModeItem.Text = I18N.GetString("Global"); | |||
this.globalModeItem.Click += new System.EventHandler(this.GlobalModeItem_Click); | |||
// | |||
// ServersItem | |||
// | |||
this.ServersItem.Index = 2; | |||
this.ServersItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | |||
this.SeperatorItem, | |||
this.ConfigItem}); | |||
this.ServersItem.Text = I18N.GetString("Servers"); | |||
// | |||
// SeperatorItem | |||
// | |||
this.SeperatorItem.Index = 0; | |||
this.SeperatorItem.Text = "-"; | |||
// | |||
// ConfigItem | |||
// | |||
this.ConfigItem.Index = 1; | |||
this.ConfigItem.Text = I18N.GetString("Edit Servers..."); | |||
this.ConfigItem.Click += new System.EventHandler(this.Config_Click); | |||
// | |||
// menuItem1 | |||
// | |||
this.menuItem1.Index = 3; | |||
this.menuItem1.Text = "-"; | |||
// | |||
// AutoStartupItem | |||
// | |||
this.AutoStartupItem.Index = 4; | |||
this.AutoStartupItem.Text = I18N.GetString("Start on Boot"); | |||
this.AutoStartupItem.Click += new System.EventHandler(this.AutoStartupItem_Click); | |||
// | |||
// ShareOverLANItem | |||
// | |||
this.ShareOverLANItem.Index = 5; | |||
this.ShareOverLANItem.Text = I18N.GetString("Share over LAN"); | |||
this.ShareOverLANItem.Click += new System.EventHandler(this.ShareOverLANItem_Click); | |||
// | |||
// editPACFileItem | |||
// | |||
this.editPACFileItem.Index = 6; | |||
this.editPACFileItem.Text = I18N.GetString("Edit PAC File..."); | |||
this.editPACFileItem.Click += new System.EventHandler(this.EditPACFileItem_Click); | |||
// | |||
// menuItem4 | |||
// | |||
this.menuItem4.Index = 7; | |||
this.menuItem4.Text = "-"; | |||
// | |||
// QRCodeItem | |||
// | |||
this.QRCodeItem.Index = 8; | |||
this.QRCodeItem.Text = I18N.GetString("Show QRCode..."); | |||
this.QRCodeItem.Click += new System.EventHandler(this.QRCodeItem_Click); | |||
// | |||
// ShowLogItem | |||
// | |||
this.ShowLogItem.Index = 9; | |||
this.ShowLogItem.Text = I18N.GetString("Show Logs..."); | |||
this.ShowLogItem.Click += new System.EventHandler(this.ShowLogItem_Click); | |||
// | |||
// aboutItem | |||
// | |||
this.aboutItem.Index = 10; | |||
this.aboutItem.Text = I18N.GetString("About..."); | |||
this.aboutItem.Click += new System.EventHandler(this.AboutItem_Click); | |||
// | |||
// menuItem3 | |||
// | |||
this.menuItem3.Index = 11; | |||
this.menuItem3.Text = "-"; | |||
// | |||
// quitItem | |||
// | |||
this.quitItem.Index = 12; | |||
this.quitItem.Text = I18N.GetString("Quit"); | |||
this.quitItem.Click += new System.EventHandler(this.Quit_Click); | |||
this.contextMenu1 = new ContextMenu(new MenuItem[] { | |||
this.enableItem = CreateMenuItem("Enable", new EventHandler(this.EnableItem_Click)), | |||
CreateMenuGroup("Mode", new MenuItem[] { | |||
this.PACModeItem = CreateMenuItem("PAC", new EventHandler(this.PACModeItem_Click)), | |||
this.globalModeItem = CreateMenuItem("Global", new EventHandler(this.GlobalModeItem_Click)) | |||
}), | |||
this.ServersItem = CreateMenuGroup("Servers", new MenuItem[] { | |||
this.SeperatorItem = new MenuItem("-"), | |||
this.ConfigItem = CreateMenuItem("Edit Servers...", new EventHandler(this.Config_Click)) | |||
}), | |||
new MenuItem("-"), | |||
this.AutoStartupItem = CreateMenuItem("Start on Boot", new EventHandler(this.AutoStartupItem_Click)), | |||
this.ShareOverLANItem = CreateMenuItem("Share over LAN", new EventHandler(this.ShareOverLANItem_Click)), | |||
CreateMenuItem("Edit PAC File...", new EventHandler(this.EditPACFileItem_Click)), | |||
new MenuItem("-"), | |||
CreateMenuItem("Show QRCode...", new EventHandler(this.QRCodeItem_Click)), | |||
CreateMenuItem("Show Logs...", new EventHandler(this.ShowLogItem_Click)), | |||
CreateMenuItem("About...", new EventHandler(this.AboutItem_Click)), | |||
new MenuItem("-"), | |||
CreateMenuItem("Quit", new EventHandler(this.Quit_Click)) | |||
}); | |||
} | |||
private void controller_ConfigChanged(object sender, EventArgs e) | |||
@@ -390,7 +274,7 @@ namespace Shadowsocks.View | |||
private void AboutItem_Click(object sender, EventArgs e) | |||
{ | |||
Process.Start("https://github.com/clowwindy/shadowsocks-csharp"); | |||
Process.Start("https://github.com/shadowsocks/shadowsocks-csharp"); | |||
} | |||
private void notifyIcon1_DoubleClick(object sender, MouseEventArgs e) | |||
@@ -89,15 +89,15 @@ | |||
<Compile Include="Controller\I18N.cs" /> | |||
<Compile Include="Controller\Logging.cs" /> | |||
<Compile Include="Controller\UpdateChecker.cs" /> | |||
<Compile Include="Encrypt\EncryptorBase.cs" /> | |||
<Compile Include="Encrypt\EncryptorFactory.cs" /> | |||
<Compile Include="Encrypt\IVEncryptor.cs" /> | |||
<Compile Include="Encrypt\PolarSSL.cs" /> | |||
<Compile Include="Encrypt\PolarSSLEncryptor.cs" /> | |||
<Compile Include="Encrypt\Sodium.cs" /> | |||
<Compile Include="Encrypt\SodiumEncryptor.cs" /> | |||
<Compile Include="Encrypt\TableEncryptor.cs" /> | |||
<Compile Include="Encrypt\IEncryptor.cs" /> | |||
<Compile Include="Encryption\EncryptorBase.cs" /> | |||
<Compile Include="Encryption\EncryptorFactory.cs" /> | |||
<Compile Include="Encryption\IVEncryptor.cs" /> | |||
<Compile Include="Encryption\PolarSSL.cs" /> | |||
<Compile Include="Encryption\PolarSSLEncryptor.cs" /> | |||
<Compile Include="Encryption\Sodium.cs" /> | |||
<Compile Include="Encryption\SodiumEncryptor.cs" /> | |||
<Compile Include="Encryption\TableEncryptor.cs" /> | |||
<Compile Include="Encryption\IEncryptor.cs" /> | |||
<Compile Include="Controller\PACServer.cs" /> | |||
<Compile Include="Model\Server.cs" /> | |||
<Compile Include="Model\Configuration.cs" /> | |||
@@ -153,15 +153,6 @@ | |||
</None> | |||
<None Include="Data\libsscrypto.dll.gz" /> | |||
<None Include="Data\polipo.exe.gz" /> | |||
<None Include="Properties\Settings.settings"> | |||
<Generator>SettingsSingleFileGenerator</Generator> | |||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> | |||
</None> | |||
<Compile Include="Properties\Settings.Designer.cs"> | |||
<AutoGen>True</AutoGen> | |||
<DependentUpon>Settings.settings</DependentUpon> | |||
<DesignTimeSharedInput>True</DesignTimeSharedInput> | |||
</Compile> | |||
<None Include="Data\proxy.pac.txt.gz" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices; | |||
[assembly: AssemblyConfiguration("")] | |||
[assembly: AssemblyCompany("")] | |||
[assembly: AssemblyProduct("test")] | |||
[assembly: AssemblyCopyright("Copyright © 2014")] | |||
[assembly: AssemblyCopyright("Copyright © 2015")] | |||
[assembly: AssemblyTrademark("")] | |||
[assembly: AssemblyCulture("")] | |||
@@ -1,7 +1,7 @@ | |||
using System; | |||
using Microsoft.VisualStudio.TestTools.UnitTesting; | |||
using Shadowsocks.Controller; | |||
using Shadowsocks.Encrypt; | |||
using Shadowsocks.Encryption; | |||
using System.Threading; | |||
using System.Collections.Generic; | |||