Compare commits

..
17 Commits
Author SHA1 Message Date
Opportunity 70ec5df5b0 Add temp folder path selection (#1827)
* Translation
* Environment Variables support
2018-05-12 20:31:59 +08:00
celeron533 153727b3b7 Fix typo 2018-05-10 23:53:40 +08:00
celeron533 1a56ea23ec Update CHANGES and bump version 2018-05-10 23:29:06 +08:00
Allen Zhu 1c2e135d8e Merge pull request #1818 from celeron533/CLI
Add plugin CLI arguments support
2018-04-26 20:01:14 +08:00
celeron533 9439fc617a Config form UI updates
* Add tooltips
* Translations
2018-04-17 21:24:19 +08:00
celeron533 b7e30318cd Add plugin CLI arguments support 2018-04-17 20:41:57 +08:00
celeron533 2227595998 Update README.md
- Add section "Open Source Components / Libraries"
- Other minor changes
2018-04-12 23:42:51 +08:00
Allen Zhu 7fb75f27b1 Merge pull request #1769 from studentmain/master
[Fix] QRCodeSplashForm.cs无法在窗体设计工具中打开
2018-03-29 19:53:25 +08:00
Allen Zhu 78e46188f6 Merge pull request #1782 from tltltltl/patch-1
Update zh_TW.txt
2018-03-29 19:32:44 +08:00
tltltltl 58f2c3937b Update zh_TW.txt
change some translations
2018-03-29 18:53:07 +08:00
Zch 81dcad5df5 fix #1768
Move PerPixelAlphaForm's code into QRCodeSplashForm to avoid 2 derived class of Form in same file.

Before: QRCodeSplashForm -> PerPixelAlphaForm -> Form
After: QRCodeSplashForm -> Form
2018-03-24 21:32:48 +08:00
celeron533 5a78ee9212 Add square bracket for SIP002 IPv6 (RFC3986) 2018-03-23 22:39:06 +08:00
Max Lv 4431610205 Merge pull request #1762 from celeron533/Server_IPV6_URL
Server address should not be encoded
2018-03-22 22:07:23 +08:00
celeron533 257448a80a Misc 2018-03-20 21:03:20 +08:00
celeron533 c9ead3eee9 Server address should not be encoded 2018-03-20 13:30:44 +08:00
wzxjohn 226ad0cf50 Fix wrong splash on multi display (#1729)
Because the splash is already on the target display, the target rect doesn't need to calculate with the screen position.
2018-03-18 21:23:43 -05:00
Chen Shaoju 5138e43aff "Allow Clients from LAN" Description & Translation optimization (#1753)
"Allow Clients from LAN" --> "Allow other Devices to connect"
2018-03-16 21:15:15 -05:00
17 changed files with 1053 additions and 1013 deletions
+8
View File
@@ -1,3 +1,11 @@
4.0.10 2018-05-10
- Add square bracket for SIP002 IPv6 (RFC3986)
- Add plugin CLI arguments support
- Bug fix: Server address should not be encoded (#1758)
- Bug fix: Wrong splash on multi display (#1729)
- Fix PerPixelAlphaForm's issue in designer
- Other minor bug fixes and improvements
4.0.9 2018-03-14 4.0.9 2018-03-14
- Fix port occupied issue - Fix port occupied issue
- Add xchacha20-ietf-poly1305 - Add xchacha20-ietf-poly1305
+33 -13
View File
@@ -17,7 +17,7 @@ Shadowsocks for Windows
#### Download #### Download
Download the [latest release]. Download the latest release from [release page].
#### Requirements #### Requirements
@@ -63,7 +63,7 @@ copy Shadowsocks to a new directory and choose a different local port.
If you would like to connect to server via a plugin, please set the plugin's If you would like to connect to server via a plugin, please set the plugin's
path (relative or absolute) on Edit Servers form. path (relative or absolute) on Edit Servers form.
Note: Forward Proxy will not be used while a plugin is enabled. _Note_: Forward Proxy will not be used while a plugin is enabled.
#### Global hotkeys #### Global hotkeys
@@ -100,22 +100,42 @@ if you want to deactivate all, please clear all textboxes.
Please visit [Servers] for more information. Please visit [Servers] for more information.
#### Develop #### Development
[Visual Studio 2015] & [.NET Framework 4.6.2 Developer Pack] are required. 1. [Visual Studio 2015] & [.NET Framework 4.6.2 Developer Pack] are required.
2. It is recommended to share your idea on the Issue Board before you start to work,
especially for feature development.
#### License #### License
GPLv3 [GPLv3]
#### Open Source Components / Libraries
```
Caseless.Fody (MIT) https://github.com/Fody/Caseless
Costura.Fody (MIT) https://github.com/Fody/Costura
Fody (MIT) https://github.com/Fody/Fody
GlobalHotKey (GPLv3) https://github.com/kirmir/GlobalHotKey
Newtonsoft.Json (MIT) https://www.newtonsoft.com/json
StringEx.CS () https://github.com/LazyMode/StringEx
ZXing.Net (Apache 2.0) https://github.com/micjahn/ZXing.Net
libsscrypto (GPLv2) https://github.com/shadowsocks/libsscrypto
Privoxy (GPLv2) https://www.privoxy.org
Sysproxy () https://github.com/Noisyfox/sysproxy
```
[Appveyor]: https://ci.appveyor.com/project/celeron533/shadowsocks-windows
[Build Status]: https://ci.appveyor.com/api/projects/status/tfw57q6eecippsl5/branch/master?svg=true [Appveyor]: https://ci.appveyor.com/project/celeron533/shadowsocks-windows
[latest release]: https://github.com/shadowsocks/shadowsocks-csharp/releases [Build Status]: https://ci.appveyor.com/api/projects/status/tfw57q6eecippsl5/branch/master?svg=true
[GFWList]: https://github.com/gfwlist/gfwlist [release page]: https://github.com/shadowsocks/shadowsocks-csharp/releases
[Servers]: https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients#linux--server-side [GFWList]: https://github.com/gfwlist/gfwlist
[中文说明]: https://github.com/shadowsocks/shadowsocks-windows/wiki/Shadowsocks-Windows-%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E [Servers]: https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients#linux--server-side
[中文说明]: https://github.com/shadowsocks/shadowsocks-windows/wiki/Shadowsocks-Windows-%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E
[Visual Studio 2015]: https://www.visualstudio.com/downloads/
[.NET Framework 4.6.2]: https://www.microsoft.com/en-US/download/details.aspx?id=53344 [.NET Framework 4.6.2]: https://www.microsoft.com/en-US/download/details.aspx?id=53344
[Visual Studio 2015]: https://www.visualstudio.com/downloads/
[.NET Framework 4.6.2 Developer Pack]: https://www.microsoft.com/download/details.aspx?id=53321 [.NET Framework 4.6.2 Developer Pack]: https://www.microsoft.com/download/details.aspx?id=53321
[Visual C++ 2015 Redistributable]: https://www.microsoft.com/en-us/download/details.aspx?id=53840 [Visual C++ 2015 Redistributable]: https://www.microsoft.com/en-us/download/details.aspx?id=53840
[GPLv3]: https://github.com/shadowsocks/shadowsocks-windows/blob/master/LICENSE.txt
@@ -33,10 +33,10 @@ namespace Shadowsocks.Controller.Service
return null; return null;
} }
return new Sip003Plugin(server.plugin, server.plugin_opts, server.server, server.server_port); return new Sip003Plugin(server.plugin, server.plugin_opts, server.plugin_args, server.server, server.server_port);
} }
private Sip003Plugin(string plugin, string pluginOpts, string serverAddress, int serverPort) private Sip003Plugin(string plugin, string pluginOpts, string pluginArgs, string serverAddress, int serverPort)
{ {
if (plugin == null) throw new ArgumentNullException(nameof(plugin)); if (plugin == null) throw new ArgumentNullException(nameof(plugin));
if (string.IsNullOrWhiteSpace(serverAddress)) if (string.IsNullOrWhiteSpace(serverAddress))
@@ -55,6 +55,7 @@ namespace Shadowsocks.Controller.Service
StartInfo = new ProcessStartInfo StartInfo = new ProcessStartInfo
{ {
FileName = plugin, FileName = plugin,
Arguments = pluginArgs,
UseShellExecute = false, UseShellExecute = false,
CreateNoWindow = true, CreateNoWindow = true,
ErrorDialog = false, ErrorDialog = false,
@@ -24,7 +24,7 @@ namespace Shadowsocks.Controller
public string LatestVersionLocalName; public string LatestVersionLocalName;
public event EventHandler CheckUpdateCompleted; public event EventHandler CheckUpdateCompleted;
public const string Version = "4.0.9"; public const string Version = "4.0.10";
private class CheckUpdateTimer : System.Timers.Timer private class CheckUpdateTimer : System.Timers.Timer
{ {
@@ -182,6 +182,12 @@ namespace Shadowsocks.Controller
Configuration.Save(_config); Configuration.Save(_config);
} }
public void SaveTempFolder(string tempFolder)
{
_config.tempFolder = tempFolder;
Configuration.Save(_config);
}
public void SaveStrategyConfigurations(StatisticsStrategyConfiguration configuration) public void SaveStrategyConfigurations(StatisticsStrategyConfiguration configuration)
{ {
StatisticsConfiguration = configuration; StatisticsConfiguration = configuration;
@@ -250,7 +256,8 @@ namespace Shadowsocks.Controller
{ {
_config.isVerboseLogging = enabled; _config.isVerboseLogging = enabled;
SaveConfig(_config); SaveConfig(_config);
if ( VerboseLoggingStatusChanged != null ) { if (VerboseLoggingStatusChanged != null)
{
VerboseLoggingStatusChanged(this, new EventArgs()); VerboseLoggingStatusChanged(this, new EventArgs());
} }
} }
@@ -353,7 +360,7 @@ namespace Shadowsocks.Controller
url = string.Format( url = string.Format(
"{0}@{1}:{2}/?plugin={3}", "{0}@{1}:{2}/?plugin={3}",
websafeBase64, websafeBase64,
HttpUtility.UrlEncode(server.server, Encoding.UTF8), server.FormatHostName(server.server),
server.server_port, server.server_port,
HttpUtility.UrlEncode(pluginPart, Encoding.UTF8)); HttpUtility.UrlEncode(pluginPart, Encoding.UTF8));
} }
+3 -2
View File
@@ -13,7 +13,7 @@ Edit Servers...=サーバーの編集...
Statistics Config...=統計情報の設定... Statistics Config...=統計情報の設定...
Start on Boot=システムと同時に起動 Start on Boot=システムと同時に起動
Forward Proxy...=フォワードプロキシの設定... Forward Proxy...=フォワードプロキシの設定...
Allow Clients from LAN=LAN からのアクセスを許可 Allow other Devices to connect=他のデバイスからの接続を許可する
Local PAC=ローカル PAC Local PAC=ローカル PAC
Online PAC=オンライン PAC Online PAC=オンライン PAC
Edit Local PAC File...=ローカル PAC ファイルの編集... Edit Local PAC File...=ローカル PAC ファイルの編集...
@@ -51,8 +51,9 @@ Server Port=サーバーポート
Password=パスワード Password=パスワード
Show Password=パスワードを表示する Show Password=パスワードを表示する
Encryption=暗号化 Encryption=暗号化
Plugin=プラグイン Plugin Program=プラグインプログラム
Plugin Options=プラグインのオプション Plugin Options=プラグインのオプション
Plugin Arguments=プラグインの引数
Proxy Port=プロキシポート Proxy Port=プロキシポート
Remarks=付記 Remarks=付記
Timeout(Sec)=タイムアウト (秒) Timeout(Sec)=タイムアウト (秒)
+4 -2
View File
@@ -13,7 +13,7 @@ Edit Servers...=编辑服务器...
Statistics Config...=统计配置... Statistics Config...=统计配置...
Start on Boot=开机启动 Start on Boot=开机启动
Forward Proxy...=正向代理设置... Forward Proxy...=正向代理设置...
Allow Clients from LAN=允许来自局域网的连接 Allow other Devices to connect=允许其他设备连入
Local PAC=使用本地 PAC Local PAC=使用本地 PAC
Online PAC=使用在线 PAC Online PAC=使用在线 PAC
Edit Local PAC File...=编辑本地 PAC 文件... Edit Local PAC File...=编辑本地 PAC 文件...
@@ -51,8 +51,9 @@ Server Port=服务器端口
Password=密码 Password=密码
Show Password=显示密码 Show Password=显示密码
Encryption=加密 Encryption=加密
Plugin=插件 Plugin Program=插件程序
Plugin Options=插件选项 Plugin Options=插件选项
Plugin Arguments=插件参数
Proxy Port=代理端口 Proxy Port=代理端口
Remarks=备注 Remarks=备注
Timeout(Sec)=超时(秒) Timeout(Sec)=超时(秒)
@@ -61,6 +62,7 @@ Cancel=取消
New server=未配置的服务器 New server=未配置的服务器
Move &Up=上移(&U) Move &Up=上移(&U)
Move D&own=下移(&O) Move D&own=下移(&O)
Temp Folder=临时文件夹
# Proxy Form # Proxy Form
+6 -4
View File
@@ -13,7 +13,7 @@ Edit Servers...=編輯伺服器...
Statistics Config...=統計設定檔... Statistics Config...=統計設定檔...
Start on Boot=開機啟動 Start on Boot=開機啟動
Forward Proxy...=正向 Proxy 設定... Forward Proxy...=正向 Proxy 設定...
Allow Clients from LAN=允許來自區域網路的連線 Allow other Devices to connect=允許其他裝置連入
Local PAC=使用本機 PAC Local PAC=使用本機 PAC
Online PAC=使用線上 PAC Online PAC=使用線上 PAC
Edit Local PAC File...=編輯本機 PAC 檔案... Edit Local PAC File...=編輯本機 PAC 檔案...
@@ -51,8 +51,9 @@ Server Port=伺服器連接埠
Password=密碼 Password=密碼
Show Password=顯示密碼 Show Password=顯示密碼
Encryption=加密 Encryption=加密
Plugin=插件 Plugin Program=外掛程式
Plugin Options=插件選項 Plugin Options=外掛程式選項
Plugin Arguments=外掛程式參數
Proxy Port=Proxy 連接埠 Proxy Port=Proxy 連接埠
Remarks=註解 Remarks=註解
Timeout(Sec)=逾時 (秒) Timeout(Sec)=逾時 (秒)
@@ -61,6 +62,7 @@ Cancel=取消
New server=新伺服器 New server=新伺服器
Move &Up=上移 (&U) Move &Up=上移 (&U)
Move D&own=下移 (&O) Move D&own=下移 (&O)
Temp Folder=臨時資料夾
# Proxy Form # Proxy Form
@@ -69,7 +71,7 @@ Use Proxy=使用 Proxy
Proxy Type=Proxy 類型 Proxy Type=Proxy 類型
Proxy Addr=Proxy 位址 Proxy Addr=Proxy 位址
Proxy Port=Proxy 連接埠 Proxy Port=Proxy 連接埠
If server has a plugin, proxy will not be used=若伺服器含有插件,Proxy 將不被使用 If server has a plugin, proxy will not be used=若伺服器含有外掛程式,Proxy 將不被使用
# Log Form # Log Form
@@ -30,6 +30,7 @@ namespace Shadowsocks.Model
public LogViewerConfig logViewer; public LogViewerConfig logViewer;
public ProxyConfig proxy; public ProxyConfig proxy;
public HotkeyConfig hotkey; public HotkeyConfig hotkey;
public string tempFolder;
private static string CONFIG_FILE = "gui-config.json"; private static string CONFIG_FILE = "gui-config.json";
@@ -145,6 +146,13 @@ namespace Shadowsocks.Model
throw new ArgumentException(I18N.GetString("Port can't be 8123")); throw new ArgumentException(I18N.GetString("Port can't be 8123"));
} }
public static void CheckTempFolder(string tempPath)
{
if (string.IsNullOrWhiteSpace(tempPath))
return;
Path.GetFullPath(tempPath);
}
private static void CheckPassword(string password) private static void CheckPassword(string password)
{ {
if (password.IsNullOrEmpty()) if (password.IsNullOrEmpty())
+16 -14
View File
@@ -26,6 +26,7 @@ namespace Shadowsocks.Model
public string method; public string method;
public string plugin; public string plugin;
public string plugin_opts; public string plugin_opts;
public string plugin_args;
public string remarks; public string remarks;
public int timeout; public int timeout;
@@ -46,25 +47,25 @@ namespace Shadowsocks.Model
{ {
return I18N.GetString("New server"); return I18N.GetString("New server");
} }
string serverStr;
// CheckHostName() won't do a real DNS lookup
var hostType = Uri.CheckHostName(server);
switch (hostType) string serverStr = $"{FormatHostName(server)}:{server_port}";
{
case UriHostNameType.IPv6:
serverStr = $"[{server}]:{server_port}";
break;
default:
// IPv4 and domain name
serverStr = $"{server}:{server_port}";
break;
}
return remarks.IsNullOrEmpty() return remarks.IsNullOrEmpty()
? serverStr ? serverStr
: $"{remarks} ({serverStr})"; : $"{remarks} ({serverStr})";
} }
public string FormatHostName(string hostName)
{
// CheckHostName() won't do a real DNS lookup
switch (Uri.CheckHostName(hostName))
{
case UriHostNameType.IPv6: // Add square bracket when IPv6 (RFC3986)
return $"[{hostName}]";
default: // IPv4 or domain name
return hostName;
}
}
public Server() public Server()
{ {
server = ""; server = "";
@@ -72,6 +73,7 @@ namespace Shadowsocks.Model
method = "aes-256-cfb"; method = "aes-256-cfb";
plugin = ""; plugin = "";
plugin_opts = ""; plugin_opts = "";
plugin_args = "";
password = ""; password = "";
remarks = ""; remarks = "";
timeout = DefaultServerTimeoutSec; timeout = DefaultServerTimeoutSec;
@@ -141,7 +143,7 @@ namespace Shadowsocks.Model
Server server = new Server Server server = new Server
{ {
remarks = parsedUrl.GetComponents(UriComponents.Fragment, UriFormat.Unescaped), remarks = parsedUrl.GetComponents(UriComponents.Fragment, UriFormat.Unescaped),
server = parsedUrl.GetComponents(UriComponents.Host, UriFormat.Unescaped), server = parsedUrl.IdnHost,
server_port = parsedUrl.Port, server_port = parsedUrl.Port,
}; };
+23 -11
View File
@@ -35,7 +35,8 @@ namespace Shadowsocks.Util.SystemProxy
static Sysproxy() static Sysproxy()
{ {
try { try
{
FileManager.UncompressFile(Utils.GetTempPath("sysproxy.exe"), FileManager.UncompressFile(Utils.GetTempPath("sysproxy.exe"),
Environment.Is64BitOperatingSystem ? Resources.sysproxy64_exe : Resources.sysproxy_exe); Environment.Is64BitOperatingSystem ? Resources.sysproxy64_exe : Resources.sysproxy_exe);
} }
@@ -111,8 +112,10 @@ namespace Shadowsocks.Util.SystemProxy
throw new ProxyException(stderr); throw new ProxyException(stderr);
} }
if (arguments == "query") { if (arguments == "query")
if (stdout.IsNullOrWhiteSpace() || stdout.IsNullOrEmpty()) { {
if (stdout.IsNullOrWhiteSpace() || stdout.IsNullOrEmpty())
{
// we cannot get user settings // we cannot get user settings
throw new ProxyException("failed to query wininet settings"); throw new ProxyException("failed to query wininet settings");
} }
@@ -123,25 +126,34 @@ namespace Shadowsocks.Util.SystemProxy
private static void Save() private static void Save()
{ {
try { try
using (StreamWriter sw = new StreamWriter(File.Open(_userWininetConfigFile, FileMode.Create))) { {
using (StreamWriter sw = new StreamWriter(File.Open(Utils.GetTempPath(_userWininetConfigFile), FileMode.Create)))
{
string jsonString = JsonConvert.SerializeObject(_userSettings, Formatting.Indented); string jsonString = JsonConvert.SerializeObject(_userSettings, Formatting.Indented);
sw.Write(jsonString); sw.Write(jsonString);
sw.Flush(); sw.Flush();
} }
} catch (IOException e) { }
catch (IOException e)
{
Logging.LogUsefulException(e); Logging.LogUsefulException(e);
} }
} }
private static void Read() private static void Read()
{ {
try { try
string configContent = File.ReadAllText(_userWininetConfigFile); {
string configContent = File.ReadAllText(Utils.GetTempPath(_userWininetConfigFile));
_userSettings = JsonConvert.DeserializeObject<SysproxyConfig>(configContent); _userSettings = JsonConvert.DeserializeObject<SysproxyConfig>(configContent);
} catch(Exception) { }
// Suppress all exceptions. finally block will initialize new user config settings. catch (Exception)
} finally { {
// Suppress all exceptions. finally block will initialize new user config settings.
}
finally
{
if (_userSettings == null) _userSettings = new SysproxyConfig(); if (_userSettings == null) _userSettings = new SysproxyConfig();
} }
} }
+33 -3
View File
@@ -2,10 +2,12 @@
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
using Microsoft.Win32; using Microsoft.Win32;
using Shadowsocks.Controller; using Shadowsocks.Controller;
using Shadowsocks.Model;
namespace Shadowsocks.Util namespace Shadowsocks.Util
{ {
@@ -26,6 +28,24 @@ namespace Shadowsocks.Util
public static class Utils public static class Utils
{ {
private static string _tempPath = null; private static string _tempPath = null;
private const string TEMP_LOG = "temp.log";
private static readonly string[] COMMON_ENV =
{
"%Tmp%",
"%Temp%",
"%AppData%",
"%LocalAppData%",
"%Home%",
"%UserProfile%",
"%Public%",
"%CommonProgramFiles%",
"%CommonProgramFiles(x86)%",
"%CommonProgramW6432%",
"%ProgramFiles%",
"%ProgramFiles(x86)%",
"%ProgramW6432%",
"%ProgramData%",
};
// return path to store temporary files // return path to store temporary files
public static string GetTempPath() public static string GetTempPath()
@@ -34,9 +54,19 @@ namespace Shadowsocks.Util
{ {
try try
{ {
Directory.CreateDirectory(Path.Combine(Application.StartupPath, "ss_win_temp")); var tempFolder = Configuration.Load().tempFolder;
// don't use "/", it will fail when we call explorer /select xxx/ss_win_temp\xxx.log if (string.IsNullOrWhiteSpace(tempFolder))
_tempPath = Path.Combine(Application.StartupPath, "ss_win_temp"); // don't use "/", it will fail when we call explorer /select xxx/ss_win_temp\xxx.log
tempFolder = "ss_win_temp";
else if (COMMON_ENV.Contains(tempFolder, StringComparer.OrdinalIgnoreCase))
// add subfolder for these common folders
tempFolder += (@"\Shadowsocks\ss_win_temp_" + Application.ExecutablePath.GetHashCode());
tempFolder = Environment.ExpandEnvironmentVariables(tempFolder);
// If `tempFolder` is an absolute path, `Application.StartupPath` will be ignored.
var tempDirectory = Directory.CreateDirectory(Path.Combine(Application.StartupPath, tempFolder));
_tempPath = tempDirectory.FullName;
File.AppendAllText(Path.Combine(_tempPath, TEMP_LOG), $"[{DateTimeOffset.Now.ToString("u")}] Temp folder used by \"{Application.ExecutablePath}\"{Environment.NewLine}");
} }
catch (Exception e) catch (Exception e)
{ {
+126 -68
View File
@@ -28,11 +28,11 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.PluginOptionsLabel = new System.Windows.Forms.Label(); this.PluginOptionsLabel = new System.Windows.Forms.Label();
this.PluginTextBox = new System.Windows.Forms.TextBox(); this.PluginTextBox = new System.Windows.Forms.TextBox();
this.RemarksTextBox = new System.Windows.Forms.TextBox(); this.RemarksTextBox = new System.Windows.Forms.TextBox();
this.RemarksLabel = new System.Windows.Forms.Label();
this.IPLabel = new System.Windows.Forms.Label(); this.IPLabel = new System.Windows.Forms.Label();
this.ServerPortLabel = new System.Windows.Forms.Label(); this.ServerPortLabel = new System.Windows.Forms.Label();
this.PasswordLabel = new System.Windows.Forms.Label(); this.PasswordLabel = new System.Windows.Forms.Label();
@@ -46,6 +46,9 @@
this.PluginLabel = new System.Windows.Forms.Label(); this.PluginLabel = new System.Windows.Forms.Label();
this.PluginOptionsTextBox = new System.Windows.Forms.TextBox(); this.PluginOptionsTextBox = new System.Windows.Forms.TextBox();
this.ShowPasswdCheckBox = new System.Windows.Forms.CheckBox(); this.ShowPasswdCheckBox = new System.Windows.Forms.CheckBox();
this.PluginArgumentsTextBox = new System.Windows.Forms.TextBox();
this.PluginArgumentsLabel = new System.Windows.Forms.Label();
this.RemarksLabel = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel();
this.OKButton = new System.Windows.Forms.Button(); this.OKButton = new System.Windows.Forms.Button();
this.MyCancelButton = new System.Windows.Forms.Button(); this.MyCancelButton = new System.Windows.Forms.Button();
@@ -60,9 +63,12 @@
this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel();
this.ProxyPortTextBox = new System.Windows.Forms.TextBox(); this.ProxyPortTextBox = new System.Windows.Forms.TextBox();
this.ProxyPortLabel = new System.Windows.Forms.Label(); this.ProxyPortLabel = new System.Windows.Forms.Label();
this.TempFolderLabel = new System.Windows.Forms.Label();
this.TempFolderTextBox = new System.Windows.Forms.TextBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.DuplicateButton = new System.Windows.Forms.Button(); this.DuplicateButton = new System.Windows.Forms.Button();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.ServerGroupBox.SuspendLayout(); this.ServerGroupBox.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout();
@@ -81,8 +87,7 @@
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.PluginOptionsLabel, 0, 6); this.tableLayoutPanel1.Controls.Add(this.PluginOptionsLabel, 0, 6);
this.tableLayoutPanel1.Controls.Add(this.PluginTextBox, 1, 5); this.tableLayoutPanel1.Controls.Add(this.PluginTextBox, 1, 5);
this.tableLayoutPanel1.Controls.Add(this.RemarksTextBox, 1, 8); this.tableLayoutPanel1.Controls.Add(this.RemarksTextBox, 1, 9);
this.tableLayoutPanel1.Controls.Add(this.RemarksLabel, 0, 8);
this.tableLayoutPanel1.Controls.Add(this.IPLabel, 0, 0); this.tableLayoutPanel1.Controls.Add(this.IPLabel, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.ServerPortLabel, 0, 1); this.tableLayoutPanel1.Controls.Add(this.ServerPortLabel, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.PasswordLabel, 0, 2); this.tableLayoutPanel1.Controls.Add(this.PasswordLabel, 0, 2);
@@ -91,16 +96,19 @@
this.tableLayoutPanel1.Controls.Add(this.PasswordTextBox, 1, 2); this.tableLayoutPanel1.Controls.Add(this.PasswordTextBox, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.EncryptionLabel, 0, 4); this.tableLayoutPanel1.Controls.Add(this.EncryptionLabel, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.EncryptionSelect, 1, 4); this.tableLayoutPanel1.Controls.Add(this.EncryptionSelect, 1, 4);
this.tableLayoutPanel1.Controls.Add(this.TimeoutLabel, 0, 9); this.tableLayoutPanel1.Controls.Add(this.TimeoutLabel, 0, 10);
this.tableLayoutPanel1.Controls.Add(this.TimeoutTextBox, 1, 9); this.tableLayoutPanel1.Controls.Add(this.TimeoutTextBox, 1, 10);
this.tableLayoutPanel1.Controls.Add(this.PluginLabel, 0, 5); this.tableLayoutPanel1.Controls.Add(this.PluginLabel, 0, 5);
this.tableLayoutPanel1.Controls.Add(this.PluginOptionsTextBox, 1, 6); this.tableLayoutPanel1.Controls.Add(this.PluginOptionsTextBox, 1, 6);
this.tableLayoutPanel1.Controls.Add(this.ShowPasswdCheckBox, 1, 3); this.tableLayoutPanel1.Controls.Add(this.ShowPasswdCheckBox, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.PluginArgumentsTextBox, 1, 7);
this.tableLayoutPanel1.Controls.Add(this.PluginArgumentsLabel, 0, 7);
this.tableLayoutPanel1.Controls.Add(this.RemarksLabel, 0, 9);
this.tableLayoutPanel1.Location = new System.Drawing.Point(8, 21); this.tableLayoutPanel1.Location = new System.Drawing.Point(8, 21);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(3); this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(3);
this.tableLayoutPanel1.RowCount = 10; this.tableLayoutPanel1.RowCount = 11;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
@@ -111,54 +119,46 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(267, 243); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(279, 270);
this.tableLayoutPanel1.TabIndex = 0; this.tableLayoutPanel1.TabIndex = 0;
// //
// PluginOptionsLabel // PluginOptionsLabel
// //
this.PluginOptionsLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.PluginOptionsLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.PluginOptionsLabel.AutoSize = true; this.PluginOptionsLabel.AutoSize = true;
this.PluginOptionsLabel.Location = new System.Drawing.Point(6, 166); this.PluginOptionsLabel.Location = new System.Drawing.Point(18, 166);
this.PluginOptionsLabel.Name = "PluginOptionsLabel"; this.PluginOptionsLabel.Name = "PluginOptionsLabel";
this.PluginOptionsLabel.Size = new System.Drawing.Size(89, 12); this.PluginOptionsLabel.Size = new System.Drawing.Size(89, 12);
this.PluginOptionsLabel.TabIndex = 15; this.PluginOptionsLabel.TabIndex = 6;
this.PluginOptionsLabel.Text = "Plugin Options"; this.PluginOptionsLabel.Text = "Plugin Options";
this.toolTip1.SetToolTip(this.PluginOptionsLabel, "Environment variables");
// //
// PluginTextBox // PluginTextBox
// //
this.PluginTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.PluginTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.PluginTextBox.Location = new System.Drawing.Point(101, 135); this.PluginTextBox.Location = new System.Drawing.Point(113, 135);
this.PluginTextBox.MaxLength = 256; this.PluginTextBox.MaxLength = 256;
this.PluginTextBox.Name = "PluginTextBox"; this.PluginTextBox.Name = "PluginTextBox";
this.PluginTextBox.Size = new System.Drawing.Size(160, 21); this.PluginTextBox.Size = new System.Drawing.Size(160, 21);
this.PluginTextBox.TabIndex = 4; this.PluginTextBox.TabIndex = 5;
this.PluginTextBox.WordWrap = false; this.PluginTextBox.WordWrap = false;
// //
// RemarksTextBox // RemarksTextBox
// //
this.RemarksTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.RemarksTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.RemarksTextBox.Location = new System.Drawing.Point(101, 189); this.RemarksTextBox.Location = new System.Drawing.Point(113, 216);
this.RemarksTextBox.MaxLength = 32; this.RemarksTextBox.MaxLength = 32;
this.RemarksTextBox.Name = "RemarksTextBox"; this.RemarksTextBox.Name = "RemarksTextBox";
this.RemarksTextBox.Size = new System.Drawing.Size(160, 21); this.RemarksTextBox.Size = new System.Drawing.Size(160, 21);
this.RemarksTextBox.TabIndex = 6; this.RemarksTextBox.TabIndex = 8;
this.RemarksTextBox.WordWrap = false; this.RemarksTextBox.WordWrap = false;
// //
// RemarksLabel
//
this.RemarksLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.RemarksLabel.AutoSize = true;
this.RemarksLabel.Location = new System.Drawing.Point(48, 193);
this.RemarksLabel.Name = "RemarksLabel";
this.RemarksLabel.Size = new System.Drawing.Size(47, 12);
this.RemarksLabel.TabIndex = 9;
this.RemarksLabel.Text = "Remarks";
//
// IPLabel // IPLabel
// //
this.IPLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.IPLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.IPLabel.AutoSize = true; this.IPLabel.AutoSize = true;
this.IPLabel.Location = new System.Drawing.Point(36, 10); this.IPLabel.Location = new System.Drawing.Point(48, 10);
this.IPLabel.Name = "IPLabel"; this.IPLabel.Name = "IPLabel";
this.IPLabel.Size = new System.Drawing.Size(59, 12); this.IPLabel.Size = new System.Drawing.Size(59, 12);
this.IPLabel.TabIndex = 0; this.IPLabel.TabIndex = 0;
@@ -168,7 +168,7 @@
// //
this.ServerPortLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.ServerPortLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.ServerPortLabel.AutoSize = true; this.ServerPortLabel.AutoSize = true;
this.ServerPortLabel.Location = new System.Drawing.Point(24, 37); this.ServerPortLabel.Location = new System.Drawing.Point(36, 37);
this.ServerPortLabel.Name = "ServerPortLabel"; this.ServerPortLabel.Name = "ServerPortLabel";
this.ServerPortLabel.Size = new System.Drawing.Size(71, 12); this.ServerPortLabel.Size = new System.Drawing.Size(71, 12);
this.ServerPortLabel.TabIndex = 1; this.ServerPortLabel.TabIndex = 1;
@@ -178,7 +178,7 @@
// //
this.PasswordLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.PasswordLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.PasswordLabel.AutoSize = true; this.PasswordLabel.AutoSize = true;
this.PasswordLabel.Location = new System.Drawing.Point(42, 64); this.PasswordLabel.Location = new System.Drawing.Point(54, 64);
this.PasswordLabel.Name = "PasswordLabel"; this.PasswordLabel.Name = "PasswordLabel";
this.PasswordLabel.Size = new System.Drawing.Size(53, 12); this.PasswordLabel.Size = new System.Drawing.Size(53, 12);
this.PasswordLabel.TabIndex = 2; this.PasswordLabel.TabIndex = 2;
@@ -188,7 +188,7 @@
// IPTextBox // IPTextBox
// //
this.IPTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.IPTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.IPTextBox.Location = new System.Drawing.Point(101, 6); this.IPTextBox.Location = new System.Drawing.Point(113, 6);
this.IPTextBox.MaxLength = 512; this.IPTextBox.MaxLength = 512;
this.IPTextBox.Name = "IPTextBox"; this.IPTextBox.Name = "IPTextBox";
this.IPTextBox.Size = new System.Drawing.Size(160, 21); this.IPTextBox.Size = new System.Drawing.Size(160, 21);
@@ -198,7 +198,7 @@
// ServerPortTextBox // ServerPortTextBox
// //
this.ServerPortTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.ServerPortTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.ServerPortTextBox.Location = new System.Drawing.Point(101, 33); this.ServerPortTextBox.Location = new System.Drawing.Point(113, 33);
this.ServerPortTextBox.MaxLength = 10; this.ServerPortTextBox.MaxLength = 10;
this.ServerPortTextBox.Name = "ServerPortTextBox"; this.ServerPortTextBox.Name = "ServerPortTextBox";
this.ServerPortTextBox.Size = new System.Drawing.Size(160, 21); this.ServerPortTextBox.Size = new System.Drawing.Size(160, 21);
@@ -208,7 +208,7 @@
// PasswordTextBox // PasswordTextBox
// //
this.PasswordTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.PasswordTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.PasswordTextBox.Location = new System.Drawing.Point(101, 60); this.PasswordTextBox.Location = new System.Drawing.Point(113, 60);
this.PasswordTextBox.MaxLength = 256; this.PasswordTextBox.MaxLength = 256;
this.PasswordTextBox.Name = "PasswordTextBox"; this.PasswordTextBox.Name = "PasswordTextBox";
this.PasswordTextBox.Size = new System.Drawing.Size(160, 21); this.PasswordTextBox.Size = new System.Drawing.Size(160, 21);
@@ -220,10 +220,10 @@
// //
this.EncryptionLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.EncryptionLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.EncryptionLabel.AutoSize = true; this.EncryptionLabel.AutoSize = true;
this.EncryptionLabel.Location = new System.Drawing.Point(30, 113); this.EncryptionLabel.Location = new System.Drawing.Point(42, 113);
this.EncryptionLabel.Name = "EncryptionLabel"; this.EncryptionLabel.Name = "EncryptionLabel";
this.EncryptionLabel.Size = new System.Drawing.Size(65, 12); this.EncryptionLabel.Size = new System.Drawing.Size(65, 12);
this.EncryptionLabel.TabIndex = 8; this.EncryptionLabel.TabIndex = 4;
this.EncryptionLabel.Text = "Encryption"; this.EncryptionLabel.Text = "Encryption";
// //
// EncryptionSelect // EncryptionSelect
@@ -254,49 +254,49 @@
"aes-256-gcm", "aes-256-gcm",
"chacha20-ietf-poly1305", "chacha20-ietf-poly1305",
"xchacha20-ietf-poly1305"}); "xchacha20-ietf-poly1305"});
this.EncryptionSelect.Location = new System.Drawing.Point(101, 109); this.EncryptionSelect.Location = new System.Drawing.Point(113, 109);
this.EncryptionSelect.Name = "EncryptionSelect"; this.EncryptionSelect.Name = "EncryptionSelect";
this.EncryptionSelect.Size = new System.Drawing.Size(160, 20); this.EncryptionSelect.Size = new System.Drawing.Size(160, 20);
this.EncryptionSelect.TabIndex = 3; this.EncryptionSelect.TabIndex = 4;
// //
// TimeoutLabel // TimeoutLabel
// //
this.TimeoutLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.TimeoutLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.TimeoutLabel.AutoSize = true; this.TimeoutLabel.AutoSize = true;
this.TimeoutLabel.Location = new System.Drawing.Point(18, 220); this.TimeoutLabel.Location = new System.Drawing.Point(30, 247);
this.TimeoutLabel.Name = "TimeoutLabel"; this.TimeoutLabel.Name = "TimeoutLabel";
this.TimeoutLabel.RightToLeft = System.Windows.Forms.RightToLeft.No; this.TimeoutLabel.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.TimeoutLabel.Size = new System.Drawing.Size(77, 12); this.TimeoutLabel.Size = new System.Drawing.Size(77, 12);
this.TimeoutLabel.TabIndex = 10; this.TimeoutLabel.TabIndex = 9;
this.TimeoutLabel.Text = "Timeout(Sec)"; this.TimeoutLabel.Text = "Timeout(Sec)";
// //
// TimeoutTextBox // TimeoutTextBox
// //
this.TimeoutTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.TimeoutTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.TimeoutTextBox.Location = new System.Drawing.Point(101, 216); this.TimeoutTextBox.Location = new System.Drawing.Point(113, 243);
this.TimeoutTextBox.MaxLength = 5; this.TimeoutTextBox.MaxLength = 5;
this.TimeoutTextBox.Name = "TimeoutTextBox"; this.TimeoutTextBox.Name = "TimeoutTextBox";
this.TimeoutTextBox.Size = new System.Drawing.Size(160, 21); this.TimeoutTextBox.Size = new System.Drawing.Size(160, 21);
this.TimeoutTextBox.TabIndex = 7; this.TimeoutTextBox.TabIndex = 9;
// //
// PluginLabel // PluginLabel
// //
this.PluginLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.PluginLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.PluginLabel.AutoSize = true; this.PluginLabel.AutoSize = true;
this.PluginLabel.Location = new System.Drawing.Point(54, 139); this.PluginLabel.Location = new System.Drawing.Point(18, 139);
this.PluginLabel.Name = "PluginLabel"; this.PluginLabel.Name = "PluginLabel";
this.PluginLabel.Size = new System.Drawing.Size(41, 12); this.PluginLabel.Size = new System.Drawing.Size(89, 12);
this.PluginLabel.TabIndex = 12; this.PluginLabel.TabIndex = 5;
this.PluginLabel.Text = "Plugin"; this.PluginLabel.Text = "Plugin Program";
// //
// PluginOptionsTextBox // PluginOptionsTextBox
// //
this.PluginOptionsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.PluginOptionsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.PluginOptionsTextBox.Location = new System.Drawing.Point(101, 162); this.PluginOptionsTextBox.Location = new System.Drawing.Point(113, 162);
this.PluginOptionsTextBox.MaxLength = 256; this.PluginOptionsTextBox.MaxLength = 256;
this.PluginOptionsTextBox.Name = "PluginOptionsTextBox"; this.PluginOptionsTextBox.Name = "PluginOptionsTextBox";
this.PluginOptionsTextBox.Size = new System.Drawing.Size(160, 21); this.PluginOptionsTextBox.Size = new System.Drawing.Size(160, 21);
this.PluginOptionsTextBox.TabIndex = 5; this.PluginOptionsTextBox.TabIndex = 6;
this.PluginOptionsTextBox.WordWrap = false; this.PluginOptionsTextBox.WordWrap = false;
// //
// ShowPasswdCheckBox // ShowPasswdCheckBox
@@ -304,21 +304,53 @@
this.ShowPasswdCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.ShowPasswdCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left))); | System.Windows.Forms.AnchorStyles.Left)));
this.ShowPasswdCheckBox.AutoSize = true; this.ShowPasswdCheckBox.AutoSize = true;
this.ShowPasswdCheckBox.Location = new System.Drawing.Point(101, 87); this.ShowPasswdCheckBox.Location = new System.Drawing.Point(113, 87);
this.ShowPasswdCheckBox.Name = "ShowPasswdCheckBox"; this.ShowPasswdCheckBox.Name = "ShowPasswdCheckBox";
this.ShowPasswdCheckBox.Size = new System.Drawing.Size(102, 16); this.ShowPasswdCheckBox.Size = new System.Drawing.Size(102, 16);
this.ShowPasswdCheckBox.TabIndex = 16; this.ShowPasswdCheckBox.TabIndex = 3;
this.ShowPasswdCheckBox.Text = "Show Password"; this.ShowPasswdCheckBox.Text = "Show Password";
this.ShowPasswdCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.ShowPasswdCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.ShowPasswdCheckBox.UseVisualStyleBackColor = true; this.ShowPasswdCheckBox.UseVisualStyleBackColor = true;
this.ShowPasswdCheckBox.CheckedChanged += new System.EventHandler(this.ShowPasswdCheckBox_CheckedChanged); this.ShowPasswdCheckBox.CheckedChanged += new System.EventHandler(this.ShowPasswdCheckBox_CheckedChanged);
// //
// PluginArgumentsTextBox
//
this.PluginArgumentsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.PluginArgumentsTextBox.Location = new System.Drawing.Point(113, 189);
this.PluginArgumentsTextBox.MaxLength = 512;
this.PluginArgumentsTextBox.Name = "PluginArgumentsTextBox";
this.PluginArgumentsTextBox.Size = new System.Drawing.Size(160, 21);
this.PluginArgumentsTextBox.TabIndex = 7;
this.PluginArgumentsTextBox.WordWrap = false;
//
// PluginArgumentsLabel
//
this.PluginArgumentsLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.PluginArgumentsLabel.AutoSize = true;
this.PluginArgumentsLabel.Location = new System.Drawing.Point(6, 193);
this.PluginArgumentsLabel.Name = "PluginArgumentsLabel";
this.PluginArgumentsLabel.Size = new System.Drawing.Size(101, 12);
this.PluginArgumentsLabel.TabIndex = 7;
this.PluginArgumentsLabel.Text = "Plugin Arguments";
this.toolTip1.SetToolTip(this.PluginArgumentsLabel, "Not SIP003 standard. Used as CLI arguments.\r\nMandatory:\r\n%SS_LOCAL_HOST%, %SS_LOC" +
"SL_PORT%, %SS_REMOTE_HOST%, %SS_REMOTE_PORT%\r\nOptional:\r\n%SS_PLUGIN_OPTIONS%");
//
// RemarksLabel
//
this.RemarksLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.RemarksLabel.AutoSize = true;
this.RemarksLabel.Location = new System.Drawing.Point(60, 220);
this.RemarksLabel.Name = "RemarksLabel";
this.RemarksLabel.Size = new System.Drawing.Size(47, 12);
this.RemarksLabel.TabIndex = 8;
this.RemarksLabel.Text = "Remarks";
//
// panel2 // panel2
// //
this.panel2.Anchor = System.Windows.Forms.AnchorStyles.Top; this.panel2.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.panel2.AutoSize = true; this.panel2.AutoSize = true;
this.panel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.panel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel2.Location = new System.Drawing.Point(207, 187); this.panel2.Location = new System.Drawing.Point(165, 187);
this.panel2.Name = "panel2"; this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(0, 0); this.panel2.Size = new System.Drawing.Size(0, 0);
this.panel2.TabIndex = 1; this.panel2.TabIndex = 1;
@@ -331,7 +363,7 @@
this.OKButton.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); this.OKButton.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
this.OKButton.Name = "OKButton"; this.OKButton.Name = "OKButton";
this.OKButton.Size = new System.Drawing.Size(75, 23); this.OKButton.Size = new System.Drawing.Size(75, 23);
this.OKButton.TabIndex = 15; this.OKButton.TabIndex = 17;
this.OKButton.Text = "OK"; this.OKButton.Text = "OK";
this.OKButton.UseVisualStyleBackColor = true; this.OKButton.UseVisualStyleBackColor = true;
this.OKButton.Click += new System.EventHandler(this.OKButton_Click); this.OKButton.Click += new System.EventHandler(this.OKButton_Click);
@@ -344,7 +376,7 @@
this.MyCancelButton.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0); this.MyCancelButton.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
this.MyCancelButton.Name = "MyCancelButton"; this.MyCancelButton.Name = "MyCancelButton";
this.MyCancelButton.Size = new System.Drawing.Size(75, 23); this.MyCancelButton.Size = new System.Drawing.Size(75, 23);
this.MyCancelButton.TabIndex = 16; this.MyCancelButton.TabIndex = 18;
this.MyCancelButton.Text = "Cancel"; this.MyCancelButton.Text = "Cancel";
this.MyCancelButton.UseVisualStyleBackColor = true; this.MyCancelButton.UseVisualStyleBackColor = true;
this.MyCancelButton.Click += new System.EventHandler(this.CancelButton_Click); this.MyCancelButton.Click += new System.EventHandler(this.CancelButton_Click);
@@ -356,7 +388,7 @@
this.DeleteButton.Margin = new System.Windows.Forms.Padding(3, 6, 0, 3); this.DeleteButton.Margin = new System.Windows.Forms.Padding(3, 6, 0, 3);
this.DeleteButton.Name = "DeleteButton"; this.DeleteButton.Name = "DeleteButton";
this.DeleteButton.Size = new System.Drawing.Size(80, 23); this.DeleteButton.Size = new System.Drawing.Size(80, 23);
this.DeleteButton.TabIndex = 11; this.DeleteButton.TabIndex = 13;
this.DeleteButton.Text = "&Delete"; this.DeleteButton.Text = "&Delete";
this.DeleteButton.UseVisualStyleBackColor = true; this.DeleteButton.UseVisualStyleBackColor = true;
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click); this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
@@ -368,7 +400,7 @@
this.AddButton.Margin = new System.Windows.Forms.Padding(0, 6, 3, 3); this.AddButton.Margin = new System.Windows.Forms.Padding(0, 6, 3, 3);
this.AddButton.Name = "AddButton"; this.AddButton.Name = "AddButton";
this.AddButton.Size = new System.Drawing.Size(80, 23); this.AddButton.Size = new System.Drawing.Size(80, 23);
this.AddButton.TabIndex = 10; this.AddButton.TabIndex = 12;
this.AddButton.Text = "&Add"; this.AddButton.Text = "&Add";
this.AddButton.UseVisualStyleBackColor = true; this.AddButton.UseVisualStyleBackColor = true;
this.AddButton.Click += new System.EventHandler(this.AddButton_Click); this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
@@ -381,7 +413,7 @@
this.ServerGroupBox.Location = new System.Drawing.Point(178, 0); this.ServerGroupBox.Location = new System.Drawing.Point(178, 0);
this.ServerGroupBox.Margin = new System.Windows.Forms.Padding(12, 0, 0, 0); this.ServerGroupBox.Margin = new System.Windows.Forms.Padding(12, 0, 0, 0);
this.ServerGroupBox.Name = "ServerGroupBox"; this.ServerGroupBox.Name = "ServerGroupBox";
this.ServerGroupBox.Size = new System.Drawing.Size(278, 281); this.ServerGroupBox.Size = new System.Drawing.Size(290, 308);
this.ServerGroupBox.TabIndex = 0; this.ServerGroupBox.TabIndex = 0;
this.ServerGroupBox.TabStop = false; this.ServerGroupBox.TabStop = false;
this.ServerGroupBox.Text = "Server"; this.ServerGroupBox.Text = "Server";
@@ -395,7 +427,7 @@
this.ServersListBox.Margin = new System.Windows.Forms.Padding(0); this.ServersListBox.Margin = new System.Windows.Forms.Padding(0);
this.ServersListBox.Name = "ServersListBox"; this.ServersListBox.Name = "ServersListBox";
this.ServersListBox.Size = new System.Drawing.Size(166, 148); this.ServersListBox.Size = new System.Drawing.Size(166, 148);
this.ServersListBox.TabIndex = 9; this.ServersListBox.TabIndex = 11;
this.ServersListBox.SelectedIndexChanged += new System.EventHandler(this.ServersListBox_SelectedIndexChanged); this.ServersListBox.SelectedIndexChanged += new System.EventHandler(this.ServersListBox_SelectedIndexChanged);
// //
// tableLayoutPanel2 // tableLayoutPanel2
@@ -418,7 +450,7 @@
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.Size = new System.Drawing.Size(456, 377); this.tableLayoutPanel2.Size = new System.Drawing.Size(468, 404);
this.tableLayoutPanel2.TabIndex = 7; this.tableLayoutPanel2.TabIndex = 7;
// //
// tableLayoutPanel6 // tableLayoutPanel6
@@ -431,7 +463,7 @@
this.tableLayoutPanel6.Controls.Add(this.MoveDownButton, 1, 0); this.tableLayoutPanel6.Controls.Add(this.MoveDownButton, 1, 0);
this.tableLayoutPanel6.Controls.Add(this.MoveUpButton, 0, 0); this.tableLayoutPanel6.Controls.Add(this.MoveUpButton, 0, 0);
this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Top; this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Top;
this.tableLayoutPanel6.Location = new System.Drawing.Point(0, 345); this.tableLayoutPanel6.Location = new System.Drawing.Point(0, 372);
this.tableLayoutPanel6.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel6.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel6.Name = "tableLayoutPanel6"; this.tableLayoutPanel6.Name = "tableLayoutPanel6";
this.tableLayoutPanel6.RowCount = 1; this.tableLayoutPanel6.RowCount = 1;
@@ -446,7 +478,7 @@
this.MoveDownButton.Margin = new System.Windows.Forms.Padding(3, 6, 0, 3); this.MoveDownButton.Margin = new System.Windows.Forms.Padding(3, 6, 0, 3);
this.MoveDownButton.Name = "MoveDownButton"; this.MoveDownButton.Name = "MoveDownButton";
this.MoveDownButton.Size = new System.Drawing.Size(80, 23); this.MoveDownButton.Size = new System.Drawing.Size(80, 23);
this.MoveDownButton.TabIndex = 14; this.MoveDownButton.TabIndex = 16;
this.MoveDownButton.Text = "Move D&own"; this.MoveDownButton.Text = "Move D&own";
this.MoveDownButton.UseVisualStyleBackColor = true; this.MoveDownButton.UseVisualStyleBackColor = true;
this.MoveDownButton.Click += new System.EventHandler(this.MoveDownButton_Click); this.MoveDownButton.Click += new System.EventHandler(this.MoveDownButton_Click);
@@ -458,7 +490,7 @@
this.MoveUpButton.Margin = new System.Windows.Forms.Padding(0, 6, 3, 3); this.MoveUpButton.Margin = new System.Windows.Forms.Padding(0, 6, 3, 3);
this.MoveUpButton.Name = "MoveUpButton"; this.MoveUpButton.Name = "MoveUpButton";
this.MoveUpButton.Size = new System.Drawing.Size(80, 23); this.MoveUpButton.Size = new System.Drawing.Size(80, 23);
this.MoveUpButton.TabIndex = 13; this.MoveUpButton.TabIndex = 15;
this.MoveUpButton.Text = "Move &Up"; this.MoveUpButton.Text = "Move &Up";
this.MoveUpButton.UseVisualStyleBackColor = true; this.MoveUpButton.UseVisualStyleBackColor = true;
this.MoveUpButton.Click += new System.EventHandler(this.MoveUpButton_Click); this.MoveUpButton.Click += new System.EventHandler(this.MoveUpButton_Click);
@@ -466,7 +498,7 @@
// tableLayoutPanel5 // tableLayoutPanel5
// //
this.tableLayoutPanel5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.tableLayoutPanel5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Left)));
this.tableLayoutPanel5.AutoSize = true; this.tableLayoutPanel5.AutoSize = true;
this.tableLayoutPanel5.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.tableLayoutPanel5.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel5.ColumnCount = 2; this.tableLayoutPanel5.ColumnCount = 2;
@@ -474,39 +506,60 @@
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel5.Controls.Add(this.ProxyPortTextBox, 1, 0); this.tableLayoutPanel5.Controls.Add(this.ProxyPortTextBox, 1, 0);
this.tableLayoutPanel5.Controls.Add(this.ProxyPortLabel, 0, 0); this.tableLayoutPanel5.Controls.Add(this.ProxyPortLabel, 0, 0);
this.tableLayoutPanel5.Location = new System.Drawing.Point(260, 281); this.tableLayoutPanel5.Controls.Add(this.TempFolderLabel, 0, 1);
this.tableLayoutPanel5.Controls.Add(this.TempFolderTextBox, 1, 1);
this.tableLayoutPanel5.Location = new System.Drawing.Point(166, 308);
this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel5.Name = "tableLayoutPanel5"; this.tableLayoutPanel5.Name = "tableLayoutPanel5";
this.tableLayoutPanel5.Padding = new System.Windows.Forms.Padding(3); this.tableLayoutPanel5.Padding = new System.Windows.Forms.Padding(3);
this.tableLayoutPanel5.RowCount = 1; this.tableLayoutPanel5.RowCount = 2;
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F)); this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F));
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F)); this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F));
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F)); this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F));
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F)); this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F));
this.tableLayoutPanel5.Size = new System.Drawing.Size(196, 64); this.tableLayoutPanel5.Size = new System.Drawing.Size(202, 64);
this.tableLayoutPanel5.TabIndex = 9; this.tableLayoutPanel5.TabIndex = 9;
// //
// ProxyPortTextBox // ProxyPortTextBox
// //
this.ProxyPortTextBox.Anchor = System.Windows.Forms.AnchorStyles.Left; this.ProxyPortTextBox.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.ProxyPortTextBox.Location = new System.Drawing.Point(77, 21); this.ProxyPortTextBox.Location = new System.Drawing.Point(83, 6);
this.ProxyPortTextBox.MaxLength = 10; this.ProxyPortTextBox.MaxLength = 10;
this.ProxyPortTextBox.Name = "ProxyPortTextBox"; this.ProxyPortTextBox.Name = "ProxyPortTextBox";
this.ProxyPortTextBox.Size = new System.Drawing.Size(113, 21); this.ProxyPortTextBox.Size = new System.Drawing.Size(113, 21);
this.ProxyPortTextBox.TabIndex = 8; this.ProxyPortTextBox.TabIndex = 10;
this.ProxyPortTextBox.WordWrap = false; this.ProxyPortTextBox.WordWrap = false;
// //
// ProxyPortLabel // ProxyPortLabel
// //
this.ProxyPortLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.ProxyPortLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.ProxyPortLabel.AutoSize = true; this.ProxyPortLabel.AutoSize = true;
this.ProxyPortLabel.Location = new System.Drawing.Point(6, 26); this.ProxyPortLabel.Location = new System.Drawing.Point(12, 10);
this.ProxyPortLabel.Name = "ProxyPortLabel"; this.ProxyPortLabel.Name = "ProxyPortLabel";
this.ProxyPortLabel.Size = new System.Drawing.Size(65, 12); this.ProxyPortLabel.Size = new System.Drawing.Size(65, 12);
this.ProxyPortLabel.TabIndex = 3; this.ProxyPortLabel.TabIndex = 10;
this.ProxyPortLabel.Text = "Proxy Port"; this.ProxyPortLabel.Text = "Proxy Port";
// //
// TempFolderLabel
//
this.TempFolderLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.TempFolderLabel.AutoSize = true;
this.TempFolderLabel.Location = new System.Drawing.Point(6, 39);
this.TempFolderLabel.Name = "TempFolderLabel";
this.TempFolderLabel.Size = new System.Drawing.Size(71, 12);
this.TempFolderLabel.TabIndex = 9;
this.TempFolderLabel.Text = "Temp Folder";
//
// TempFolderTextBox
//
this.TempFolderTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.TempFolderTextBox.Location = new System.Drawing.Point(83, 35);
this.TempFolderTextBox.Name = "TempFolderTextBox";
this.TempFolderTextBox.Size = new System.Drawing.Size(113, 21);
this.TempFolderTextBox.TabIndex = 11;
//
// tableLayoutPanel3 // tableLayoutPanel3
// //
this.tableLayoutPanel3.AutoSize = true; this.tableLayoutPanel3.AutoSize = true;
@@ -518,7 +571,7 @@
this.tableLayoutPanel3.Controls.Add(this.MyCancelButton, 1, 0); this.tableLayoutPanel3.Controls.Add(this.MyCancelButton, 1, 0);
this.tableLayoutPanel3.Controls.Add(this.OKButton, 0, 0); this.tableLayoutPanel3.Controls.Add(this.OKButton, 0, 0);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Right; this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Right;
this.tableLayoutPanel3.Location = new System.Drawing.Point(297, 348); this.tableLayoutPanel3.Location = new System.Drawing.Point(309, 375);
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1; this.tableLayoutPanel3.RowCount = 1;
@@ -537,7 +590,7 @@
this.tableLayoutPanel4.Controls.Add(this.DeleteButton, 1, 0); this.tableLayoutPanel4.Controls.Add(this.DeleteButton, 1, 0);
this.tableLayoutPanel4.Controls.Add(this.AddButton, 0, 0); this.tableLayoutPanel4.Controls.Add(this.AddButton, 0, 0);
this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Top; this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Top;
this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 281); this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 308);
this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel4.Name = "tableLayoutPanel4"; this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 2; this.tableLayoutPanel4.RowCount = 2;
@@ -553,7 +606,7 @@
this.DuplicateButton.Margin = new System.Windows.Forms.Padding(0, 6, 3, 3); this.DuplicateButton.Margin = new System.Windows.Forms.Padding(0, 6, 3, 3);
this.DuplicateButton.Name = "DuplicateButton"; this.DuplicateButton.Name = "DuplicateButton";
this.DuplicateButton.Size = new System.Drawing.Size(80, 23); this.DuplicateButton.Size = new System.Drawing.Size(80, 23);
this.DuplicateButton.TabIndex = 12; this.DuplicateButton.TabIndex = 14;
this.DuplicateButton.Text = "Dupli&cate"; this.DuplicateButton.Text = "Dupli&cate";
this.DuplicateButton.UseVisualStyleBackColor = true; this.DuplicateButton.UseVisualStyleBackColor = true;
this.DuplicateButton.Click += new System.EventHandler(this.DuplicateButton_Click); this.DuplicateButton.Click += new System.EventHandler(this.DuplicateButton_Click);
@@ -566,7 +619,7 @@
this.AutoSize = true; this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.CancelButton = this.MyCancelButton; this.CancelButton = this.MyCancelButton;
this.ClientSize = new System.Drawing.Size(574, 398); this.ClientSize = new System.Drawing.Size(491, 438);
this.Controls.Add(this.tableLayoutPanel2); this.Controls.Add(this.tableLayoutPanel2);
this.Controls.Add(this.panel2); this.Controls.Add(this.panel2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
@@ -633,6 +686,11 @@
private System.Windows.Forms.TextBox PluginOptionsTextBox; private System.Windows.Forms.TextBox PluginOptionsTextBox;
private System.Windows.Forms.CheckBox ShowPasswdCheckBox; private System.Windows.Forms.CheckBox ShowPasswdCheckBox;
private System.Windows.Forms.TextBox PasswordTextBox; private System.Windows.Forms.TextBox PasswordTextBox;
private System.Windows.Forms.Label TempFolderLabel;
private System.Windows.Forms.TextBox PluginArgumentsTextBox;
private System.Windows.Forms.Label PluginArgumentsLabel;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.TextBox TempFolderTextBox;
} }
} }
+14 -5
View File
@@ -9,6 +9,7 @@ using Microsoft.Win32;
using Shadowsocks.Controller; using Shadowsocks.Controller;
using Shadowsocks.Model; using Shadowsocks.Model;
using Shadowsocks.Properties; using Shadowsocks.Properties;
using System.Threading.Tasks;
namespace Shadowsocks.View namespace Shadowsocks.View
{ {
@@ -22,11 +23,12 @@ namespace Shadowsocks.View
public ConfigForm(ShadowsocksController controller) public ConfigForm(ShadowsocksController controller)
{ {
this.Font = System.Drawing.SystemFonts.MessageBoxFont; this.Font = SystemFonts.MessageBoxFont;
InitializeComponent(); InitializeComponent();
// a dirty hack // a dirty hack
this.ServersListBox.Dock = System.Windows.Forms.DockStyle.Fill; this.ServersListBox.Dock = DockStyle.Fill;
this.tableLayoutPanel5.Dock = DockStyle.Fill;
this.PerformLayout(); this.PerformLayout();
UpdateTexts(); UpdateTexts();
@@ -48,9 +50,11 @@ namespace Shadowsocks.View
PasswordLabel.Text = I18N.GetString("Password"); PasswordLabel.Text = I18N.GetString("Password");
ShowPasswdCheckBox.Text = I18N.GetString("Show Password"); ShowPasswdCheckBox.Text = I18N.GetString("Show Password");
EncryptionLabel.Text = I18N.GetString("Encryption"); EncryptionLabel.Text = I18N.GetString("Encryption");
PluginLabel.Text = I18N.GetString("Plugin"); PluginLabel.Text = I18N.GetString("Plugin Program");
PluginOptionsLabel.Text = I18N.GetString("Plugin Options"); PluginOptionsLabel.Text = I18N.GetString("Plugin Options");
PluginArgumentsLabel.Text = I18N.GetString("Plugin Arguments");
ProxyPortLabel.Text = I18N.GetString("Proxy Port"); ProxyPortLabel.Text = I18N.GetString("Proxy Port");
TempFolderLabel.Text = I18N.GetString("Temp Folder");
RemarksLabel.Text = I18N.GetString("Remarks"); RemarksLabel.Text = I18N.GetString("Remarks");
TimeoutLabel.Text = I18N.GetString("Timeout(Sec)"); TimeoutLabel.Text = I18N.GetString("Timeout(Sec)");
ServerGroupBox.Text = I18N.GetString("Server"); ServerGroupBox.Text = I18N.GetString("Server");
@@ -99,6 +103,7 @@ namespace Shadowsocks.View
server.method = EncryptionSelect.Text; server.method = EncryptionSelect.Text;
server.plugin = PluginTextBox.Text; server.plugin = PluginTextBox.Text;
server.plugin_opts = PluginOptionsTextBox.Text; server.plugin_opts = PluginOptionsTextBox.Text;
server.plugin_args = PluginArgumentsTextBox.Text;
server.remarks = RemarksTextBox.Text; server.remarks = RemarksTextBox.Text;
if (!int.TryParse(TimeoutTextBox.Text, out server.timeout)) if (!int.TryParse(TimeoutTextBox.Text, out server.timeout))
{ {
@@ -107,6 +112,7 @@ namespace Shadowsocks.View
return false; return false;
} }
int localPort = int.Parse(ProxyPortTextBox.Text); int localPort = int.Parse(ProxyPortTextBox.Text);
Configuration.CheckTempFolder(TempFolderTextBox.Text);
Configuration.CheckServer(server); Configuration.CheckServer(server);
Configuration.CheckLocalPort(localPort); Configuration.CheckLocalPort(localPort);
_modifiedConfiguration.configs[_lastSelectedIndex] = server; _modifiedConfiguration.configs[_lastSelectedIndex] = server;
@@ -134,6 +140,7 @@ namespace Shadowsocks.View
EncryptionSelect.Text = server.method ?? "aes-256-cfb"; EncryptionSelect.Text = server.method ?? "aes-256-cfb";
PluginTextBox.Text = server.plugin; PluginTextBox.Text = server.plugin;
PluginOptionsTextBox.Text = server.plugin_opts; PluginOptionsTextBox.Text = server.plugin_opts;
PluginArgumentsTextBox.Text = server.plugin_args;
RemarksTextBox.Text = server.remarks; RemarksTextBox.Text = server.remarks;
TimeoutTextBox.Text = server.timeout.ToString(); TimeoutTextBox.Text = server.timeout.ToString();
} }
@@ -160,6 +167,7 @@ namespace Shadowsocks.View
ServersListBox.SelectedIndex = _lastSelectedIndex; ServersListBox.SelectedIndex = _lastSelectedIndex;
UpdateMoveUpAndDownButton(); UpdateMoveUpAndDownButton();
LoadSelectedServer(); LoadSelectedServer();
TempFolderTextBox.Text = _modifiedConfiguration.tempFolder;
} }
private void ConfigForm_Load(object sender, EventArgs e) private void ConfigForm_Load(object sender, EventArgs e)
@@ -228,14 +236,14 @@ namespace Shadowsocks.View
_lastSelectedIndex = ServersListBox.SelectedIndex; _lastSelectedIndex = ServersListBox.SelectedIndex;
} }
private void DuplicateButton_Click( object sender, EventArgs e ) private void DuplicateButton_Click(object sender, EventArgs e)
{ {
if (!SaveOldSelectedServer()) if (!SaveOldSelectedServer())
{ {
return; return;
} }
Server currServer = _modifiedConfiguration.configs[_lastSelectedIndex]; Server currServer = _modifiedConfiguration.configs[_lastSelectedIndex];
var currIndex = _modifiedConfiguration.configs.IndexOf( currServer ); var currIndex = _modifiedConfiguration.configs.IndexOf(currServer);
_modifiedConfiguration.configs.Insert(currIndex + 1, currServer); _modifiedConfiguration.configs.Insert(currIndex + 1, currServer);
LoadConfiguration(_modifiedConfiguration); LoadConfiguration(_modifiedConfiguration);
ServersListBox.SelectedIndex = currIndex + 1; ServersListBox.SelectedIndex = currIndex + 1;
@@ -272,6 +280,7 @@ namespace Shadowsocks.View
return; return;
} }
controller.SaveServers(_modifiedConfiguration.configs, _modifiedConfiguration.localPort); controller.SaveServers(_modifiedConfiguration.configs, _modifiedConfiguration.localPort);
controller.SaveTempFolder(TempFolderTextBox.Text);
// SelectedIndex remains valid // SelectedIndex remains valid
// We handled this in event handlers, e.g. Add/DeleteButton, SelectedIndexChanged // We handled this in event handlers, e.g. Add/DeleteButton, SelectedIndexChanged
// and move operations // and move operations
+2 -107
View File
@@ -117,112 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="tableLayoutPanel1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>True</value> <value>17, 17</value>
</metadata>
<metadata name="PluginOptionsLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PluginTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RemarksTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RemarksLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="IPLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ServerPortLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PasswordLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="IPTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ServerPortTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PasswordTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="EncryptionLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="EncryptionSelect.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TimeoutLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TimeoutTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PluginLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PluginOptionsTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ShowPasswdCheckBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="panel2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="OKButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="MyCancelButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="DeleteButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="AddButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ServerGroupBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ServersListBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tableLayoutPanel2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tableLayoutPanel6.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="MoveDownButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="MoveUpButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tableLayoutPanel5.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ProxyPortTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ProxyPortLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tableLayoutPanel3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tableLayoutPanel4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="DuplicateButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata> </metadata>
</root> </root>
@@ -187,6 +187,10 @@ namespace Shadowsocks.View
I18N.GetString("System Proxy On: ") + (global ? I18N.GetString("Global") : I18N.GetString("PAC")) : I18N.GetString("System Proxy On: ") + (global ? I18N.GetString("Global") : I18N.GetString("PAC")) :
String.Format(I18N.GetString("Running: Port {0}"), config.localPort)) // this feedback is very important because they need to know Shadowsocks is running String.Format(I18N.GetString("Running: Port {0}"), config.localPort)) // this feedback is very important because they need to know Shadowsocks is running
+ "\n" + serverInfo; + "\n" + serverInfo;
if (text.Length > 127)
{
text = text.Substring(0, 126 - 3) + "...";
}
ViewUtils.SetNotifyIconText(_notifyIcon, text); ViewUtils.SetNotifyIconText(_notifyIcon, text);
} }
@@ -286,7 +290,7 @@ namespace Shadowsocks.View
this.proxyItem = CreateMenuItem("Forward Proxy...", new EventHandler(this.proxyItem_Click)), this.proxyItem = CreateMenuItem("Forward Proxy...", new EventHandler(this.proxyItem_Click)),
new MenuItem("-"), new MenuItem("-"),
this.AutoStartupItem = CreateMenuItem("Start on Boot", new EventHandler(this.AutoStartupItem_Click)), this.AutoStartupItem = CreateMenuItem("Start on Boot", new EventHandler(this.AutoStartupItem_Click)),
this.ShareOverLANItem = CreateMenuItem("Allow Clients from LAN", new EventHandler(this.ShareOverLANItem_Click)), this.ShareOverLANItem = CreateMenuItem("Allow other Devices to connect", new EventHandler(this.ShareOverLANItem_Click)),
new MenuItem("-"), new MenuItem("-"),
this.hotKeyItem = CreateMenuItem("Edit Hotkeys...", new EventHandler(this.hotKeyItem_Click)), this.hotKeyItem = CreateMenuItem("Edit Hotkeys...", new EventHandler(this.hotKeyItem_Click)),
CreateMenuGroup("Help", new MenuItem[] { CreateMenuGroup("Help", new MenuItem[] {
@@ -707,7 +711,7 @@ namespace Shadowsocks.View
{ {
splash.FormClosed += splash_FormClosed; splash.FormClosed += splash_FormClosed;
} }
else if (result.Text.StartsWith("http://") || result.Text.StartsWith("https://")) else if (result.Text.ToLower().StartsWith("http://") || result.Text.ToLower().StartsWith("https://"))
{ {
_urlToOpen = result.Text; _urlToOpen = result.Text;
splash.FormClosed += openURLFromQRCode; splash.FormClosed += openURLFromQRCode;
@@ -738,7 +742,7 @@ namespace Shadowsocks.View
splash.Location = new Point(screen.Bounds.X, screen.Bounds.Y); splash.Location = new Point(screen.Bounds.X, screen.Bounds.Y);
// we need a panel because a window has a minimal size // we need a panel because a window has a minimal size
// TODO: test on high DPI // TODO: test on high DPI
splash.TargetRect = new Rectangle((int)minX + screen.Bounds.X, (int)minY + screen.Bounds.Y, (int)maxX - (int)minX, (int)maxY - (int)minY); splash.TargetRect = new Rectangle((int)minX, (int)minY, (int)maxX - (int)minX, (int)maxY - (int)minY);
splash.Size = new Size(fullImage.Width, fullImage.Height); splash.Size = new Size(fullImage.Width, fullImage.Height);
splash.Show(); splash.Show();
return; return;
+65 -84
View File
@@ -12,12 +12,13 @@ using System.Diagnostics;
namespace Shadowsocks.View namespace Shadowsocks.View
{ {
public class QRCodeSplashForm : PerPixelAlphaForm public class QRCodeSplashForm : Form
{ {
public Rectangle TargetRect; public Rectangle TargetRect;
public QRCodeSplashForm() public QRCodeSplashForm()
{ {
FormBorderStyle = FormBorderStyle.None;
this.Load += QRCodeSplashForm_Load; this.Load += QRCodeSplashForm_Load;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White; this.BackColor = System.Drawing.Color.White;
@@ -69,16 +70,6 @@ namespace Shadowsocks.View
brush = new SolidBrush(Color.FromArgb(30, Color.Red)); brush = new SolidBrush(Color.FromArgb(30, Color.Red));
} }
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x00080000; // This form has to have the WS_EX_LAYERED extended style
return cp;
}
}
void timer_Tick(object sender, EventArgs e) void timer_Tick(object sender, EventArgs e)
{ {
double percent = (double)sw.ElapsedMilliseconds / 1000.0 / (double)ANIMATION_TIME; double percent = (double)sw.ElapsedMilliseconds / 1000.0 / (double)ANIMATION_TIME;
@@ -148,6 +139,69 @@ namespace Shadowsocks.View
flashStep++; flashStep++;
} }
} }
// PerPixelAlphaForm.cs
// http://www.codeproject.com/Articles/1822/Per-Pixel-Alpha-Blend-in-C
// Rui Lopes
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x00080000; // This form has to have the WS_EX_LAYERED extended style
return cp;
}
}
public void SetBitmap(Bitmap bitmap)
{
SetBitmap(bitmap, 255);
}
/// <para>Changes the current bitmap with a custom opacity level. Here is where all happens!</para>
public void SetBitmap(Bitmap bitmap, byte opacity)
{
if (bitmap.PixelFormat != PixelFormat.Format32bppArgb)
throw new ApplicationException("The bitmap must be 32ppp with alpha-channel.");
// The idea of this is very simple,
// 1. Create a compatible DC with screen;
// 2. Select the bitmap with 32bpp with alpha-channel in the compatible DC;
// 3. Call the UpdateLayeredWindow.
IntPtr screenDc = Win32.GetDC(IntPtr.Zero);
IntPtr memDc = Win32.CreateCompatibleDC(screenDc);
IntPtr hBitmap = IntPtr.Zero;
IntPtr oldBitmap = IntPtr.Zero;
try
{
hBitmap = bitmap.GetHbitmap(Color.FromArgb(0)); // grab a GDI handle from this GDI+ bitmap
oldBitmap = Win32.SelectObject(memDc, hBitmap);
Win32.Size size = new Win32.Size(bitmap.Width, bitmap.Height);
Win32.Point pointSource = new Win32.Point(0, 0);
Win32.Point topPos = new Win32.Point(Left, Top);
Win32.BLENDFUNCTION blend = new Win32.BLENDFUNCTION();
blend.BlendOp = Win32.AC_SRC_OVER;
blend.BlendFlags = 0;
blend.SourceConstantAlpha = opacity;
blend.AlphaFormat = Win32.AC_SRC_ALPHA;
Win32.UpdateLayeredWindow(Handle, screenDc, ref topPos, ref size, memDc, ref pointSource, 0, ref blend, Win32.ULW_ALPHA);
}
finally
{
Win32.ReleaseDC(IntPtr.Zero, screenDc);
if (hBitmap != IntPtr.Zero)
{
Win32.SelectObject(memDc, oldBitmap);
//Windows.DeleteObject(hBitmap); // The documentation says that we have to use the Windows.DeleteObject... but since there is no such method I use the normal DeleteObject from Win32 GDI and it's working fine without any resource leak.
Win32.DeleteObject(hBitmap);
}
Win32.DeleteDC(memDc);
}
}
} }
@@ -224,77 +278,4 @@ namespace Shadowsocks.View
[DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)] [DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)]
public static extern int DeleteObject(IntPtr hObject); public static extern int DeleteObject(IntPtr hObject);
} }
public class PerPixelAlphaForm : Form
{
// http://www.codeproject.com/Articles/1822/Per-Pixel-Alpha-Blend-in-C
// Rui Lopes
public PerPixelAlphaForm()
{
// This form should not have a border or else Windows will clip it.
FormBorderStyle = FormBorderStyle.None;
}
public void SetBitmap(Bitmap bitmap)
{
SetBitmap(bitmap, 255);
}
/// <para>Changes the current bitmap with a custom opacity level. Here is where all happens!</para>
public void SetBitmap(Bitmap bitmap, byte opacity)
{
if (bitmap.PixelFormat != PixelFormat.Format32bppArgb)
throw new ApplicationException("The bitmap must be 32ppp with alpha-channel.");
// The idea of this is very simple,
// 1. Create a compatible DC with screen;
// 2. Select the bitmap with 32bpp with alpha-channel in the compatible DC;
// 3. Call the UpdateLayeredWindow.
IntPtr screenDc = Win32.GetDC(IntPtr.Zero);
IntPtr memDc = Win32.CreateCompatibleDC(screenDc);
IntPtr hBitmap = IntPtr.Zero;
IntPtr oldBitmap = IntPtr.Zero;
try
{
hBitmap = bitmap.GetHbitmap(Color.FromArgb(0)); // grab a GDI handle from this GDI+ bitmap
oldBitmap = Win32.SelectObject(memDc, hBitmap);
Win32.Size size = new Win32.Size(bitmap.Width, bitmap.Height);
Win32.Point pointSource = new Win32.Point(0, 0);
Win32.Point topPos = new Win32.Point(Left, Top);
Win32.BLENDFUNCTION blend = new Win32.BLENDFUNCTION();
blend.BlendOp = Win32.AC_SRC_OVER;
blend.BlendFlags = 0;
blend.SourceConstantAlpha = opacity;
blend.AlphaFormat = Win32.AC_SRC_ALPHA;
Win32.UpdateLayeredWindow(Handle, screenDc, ref topPos, ref size, memDc, ref pointSource, 0, ref blend, Win32.ULW_ALPHA);
}
finally
{
Win32.ReleaseDC(IntPtr.Zero, screenDc);
if (hBitmap != IntPtr.Zero)
{
Win32.SelectObject(memDc, oldBitmap);
//Windows.DeleteObject(hBitmap); // The documentation says that we have to use the Windows.DeleteObject... but since there is no such method I use the normal DeleteObject from Win32 GDI and it's working fine without any resource leak.
Win32.DeleteObject(hBitmap);
}
Win32.DeleteDC(memDc);
}
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x00080000; // This form has to have the WS_EX_LAYERED extended style
return cp;
}
}
}
} }