Browse Source

minor fixes

tags/2.3
clowwindy 10 years ago
parent
commit
eaaacd398d
7 changed files with 29 additions and 14 deletions
  1. +3
    -1
      shadowsocks-csharp/Controller/UpdateChecker.cs
  2. +3
    -1
      shadowsocks-csharp/Data/cn.txt
  3. +8
    -0
      shadowsocks-csharp/Model/Server.cs
  4. +3
    -2
      shadowsocks-csharp/Properties/AssemblyInfo.cs
  5. +3
    -3
      shadowsocks-csharp/View/ConfigForm.Designer.cs
  6. +1
    -1
      shadowsocks-csharp/View/ConfigForm.cs
  7. +8
    -6
      shadowsocks-csharp/View/MenuViewController.cs

+ 3
- 1
shadowsocks-csharp/Controller/UpdateChecker.cs View File

@@ -17,6 +17,8 @@ namespace Shadowsocks.Controller
public string LatestVersionURL;
public event EventHandler NewVersionFound;
public const string Version = "2.1.3";
public void CheckUpdate()
{
// TODO test failures
@@ -100,7 +102,7 @@ namespace Shadowsocks.Controller
{
return false;
}
string currentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
string currentVersion = Version;
return CompareVersion(version, currentVersion) > 0;
}


+ 3
- 1
shadowsocks-csharp/Data/cn.txt View File

@@ -33,4 +33,6 @@ Please add at least one server=请添加至少一个服务器
Shadowsocks {0} Update Found=Shadowsocks {0} 更新
Click here to download=点击这里下载
Shadowsocks is here=Shadowsocks 在这里
You can turn on/off Shadowsocks in the context menu=可以在右键菜单中开关 Shadowsocks
You can turn on/off Shadowsocks in the context menu=可以在右键菜单中开关 Shadowsocks
Enabled=已启用代理
Disabled=已禁用代理

+ 8
- 0
shadowsocks-csharp/Model/Server.cs View File

@@ -16,5 +16,13 @@ namespace Shadowsocks.Model
public string password;
public string method;
public string remarks;
public string FriendlyName
{
get
{
return string.IsNullOrEmpty(remarks) ? server + ":" + server_port : server + ":" + server_port + " (" + remarks + ")";
}
}
}
}

+ 3
- 2
shadowsocks-csharp/Properties/AssemblyInfo.cs View File

@@ -1,4 +1,5 @@
using System.Reflection;
using Shadowsocks.Controller;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -32,5 +33,5 @@ using System.Runtime.InteropServices;
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.2")]
[assembly: AssemblyVersion(UpdateChecker.Version)]
// [assembly: AssemblyFileVersion("2.0.0")]

+ 3
- 3
shadowsocks-csharp/View/ConfigForm.Designer.cs View File

@@ -295,9 +295,9 @@
// ServerGroupBox
//
this.ServerGroupBox.Controls.Add(this.tableLayoutPanel1);
this.ServerGroupBox.Location = new System.Drawing.Point(223, 12);
this.ServerGroupBox.Location = new System.Drawing.Point(220, 12);
this.ServerGroupBox.Name = "ServerGroupBox";
this.ServerGroupBox.Size = new System.Drawing.Size(255, 205);
this.ServerGroupBox.Size = new System.Drawing.Size(258, 199);
this.ServerGroupBox.TabIndex = 6;
this.ServerGroupBox.TabStop = false;
this.ServerGroupBox.Text = "Server";
@@ -307,7 +307,7 @@
this.ServersListBox.FormattingEnabled = true;
this.ServersListBox.Location = new System.Drawing.Point(12, 12);
this.ServersListBox.Name = "ServersListBox";
this.ServersListBox.Size = new System.Drawing.Size(192, 173);
this.ServersListBox.Size = new System.Drawing.Size(192, 199);
this.ServersListBox.TabIndex = 5;
this.ServersListBox.SelectedIndexChanged += new System.EventHandler(this.ServersListBox_SelectedIndexChanged);
//


+ 1
- 1
shadowsocks-csharp/View/ConfigForm.cs View File

@@ -119,7 +119,7 @@ namespace Shadowsocks.View
ServersListBox.Items.Clear();
foreach (Server server in _modifiedConfiguration.configs)
{
ServersListBox.Items.Add(string.IsNullOrEmpty(server.server) ? I18N.GetString("New server") : string.IsNullOrEmpty(server.remarks)? server.server + ":" + server.server_port : server.server + ":" + server.server_port + " (" + server.remarks + ")");
ServersListBox.Items.Add(string.IsNullOrEmpty(server.server) ? I18N.GetString("New server") : server.FriendlyName);
}
}


+ 8
- 6
shadowsocks-csharp/View/MenuViewController.cs View File

@@ -56,9 +56,8 @@ namespace Shadowsocks.View
controller.Errored += controller_Errored;
_notifyIcon = new NotifyIcon();
LoadTrayIcon();
UpdateTrayIcon();
_notifyIcon.Visible = true;
_notifyIcon.Text = I18N.GetString("Shadowsocks");
_notifyIcon.ContextMenu = contextMenu1;
_notifyIcon.DoubleClick += notifyIcon1_DoubleClick;
@@ -81,7 +80,7 @@ namespace Shadowsocks.View
MessageBox.Show(e.GetException().ToString(), String.Format(I18N.GetString("Shadowsocks Error: {0}"), e.GetException().Message));
}
private void LoadTrayIcon()
private void UpdateTrayIcon()
{
int dpi;
Graphics graphics = Graphics.FromHwnd(IntPtr.Zero);
@@ -102,7 +101,8 @@ namespace Shadowsocks.View
{
icon = Resources.ss24;
}
if (!controller.GetConfiguration().enabled)
bool enabled = controller.GetConfiguration().enabled;
if (!enabled)
{
Bitmap iconCopy = new Bitmap(icon);
for (int x = 0; x < iconCopy.Width; x++)
@@ -116,6 +116,8 @@ namespace Shadowsocks.View
icon = iconCopy;
}
_notifyIcon.Icon = Icon.FromHandle(icon.GetHicon());
_notifyIcon.Text = I18N.GetString("Shadowsocks") + " " + UpdateChecker.Version + "\n" + (enabled ? I18N.GetString("Enabled") : I18N.GetString("Disabled")) + "\n" + controller.GetCurrentServer().FriendlyName;
}
private void LoadMenu()
@@ -263,12 +265,12 @@ namespace Shadowsocks.View
private void controller_ConfigChanged(object sender, EventArgs e)
{
LoadCurrentConfiguration();
UpdateTrayIcon();
}
private void controller_EnableStatusChanged(object sender, EventArgs e)
{
enableItem.Checked = controller.GetConfiguration().enabled;
LoadTrayIcon();
}
void controller_ShareOverLANStatusChanged(object sender, EventArgs e)
@@ -326,7 +328,7 @@ namespace Shadowsocks.View
for (int i = 0; i < configuration.configs.Count; i++)
{
Server server = configuration.configs[i];
MenuItem item = new MenuItem(string.IsNullOrEmpty(server.remarks) ? server.server + ":" + server.server_port : server.server + ":" + server.server_port + " (" + server.remarks + ")");
MenuItem item = new MenuItem(server.FriendlyName);
item.Tag = i;
item.Click += AServerItem_Click;
items.Add(item);


Loading…
Cancel
Save