Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a4f724653 | ||
|
|
fcb0adfc3f | ||
|
|
eb2e5cc242 |
@@ -18,6 +18,10 @@ namespace Shadowsocks.Controller
|
||||
string[] lines = Regex.Split(Resources.cn, "\r\n|\r|\n");
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (line.StartsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string[] kv = Regex.Split(line, "=");
|
||||
if (kv.Length == 2)
|
||||
{
|
||||
|
||||
@@ -96,6 +96,19 @@ namespace Shadowsocks.Controller
|
||||
}
|
||||
}
|
||||
|
||||
internal string TouchUserRuleFile()
|
||||
{
|
||||
if (File.Exists(USER_RULE_FILE))
|
||||
{
|
||||
return USER_RULE_FILE;
|
||||
}
|
||||
else
|
||||
{
|
||||
File.WriteAllText(USER_RULE_FILE, Resources.user_rule);
|
||||
return USER_RULE_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetPACContent()
|
||||
{
|
||||
if (File.Exists(PAC_FILE))
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace Shadowsocks.Controller
|
||||
|
||||
// when user clicked Edit PAC, and PAC file has already created
|
||||
public event EventHandler<PathEventArgs> PACFileReadyToOpen;
|
||||
public event EventHandler<PathEventArgs> UserRuleFileReadyToOpen;
|
||||
|
||||
public event EventHandler<GFWListUpdater.ResultEventArgs> UpdatePACFromGFWListCompleted;
|
||||
|
||||
@@ -166,6 +167,15 @@ namespace Shadowsocks.Controller
|
||||
}
|
||||
}
|
||||
|
||||
public void TouchUserRuleFile()
|
||||
{
|
||||
string userRuleFilename = _pacServer.TouchUserRuleFile();
|
||||
if (UserRuleFileReadyToOpen != null)
|
||||
{
|
||||
UserRuleFileReadyToOpen(this, new PathEventArgs() { Path = userRuleFilename });
|
||||
}
|
||||
}
|
||||
|
||||
public string GetQRCodeForCurrentServer()
|
||||
{
|
||||
Server server = GetCurrentServer();
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Shadowsocks.Controller
|
||||
public string LatestVersionURL;
|
||||
public event EventHandler NewVersionFound;
|
||||
|
||||
public const string Version = "2.3";
|
||||
public const string Version = "2.3.1";
|
||||
|
||||
public void CheckUpdate(Configuration config)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
# translation for Simplified Chinese
|
||||
|
||||
Shadowsocks=Shadowsocks
|
||||
|
||||
# Menu items
|
||||
|
||||
Enable System Proxy=启用系统代理
|
||||
Mode=系统代理模式
|
||||
PAC=PAC 模式
|
||||
@@ -8,12 +13,16 @@ Edit Servers...=编辑服务器...
|
||||
Start on Boot=开机启动
|
||||
Allow Clients from LAN=允许来自局域网的连接
|
||||
Edit PAC File...=编辑 PAC 文件...
|
||||
Edit User Rule for GFWList...=编辑 GFWList 的用户规则...
|
||||
Show QRCode...=显示二维码...
|
||||
Scan QRCode from Screen...=扫描屏幕上的二维码...
|
||||
Show Logs...=显示日志...
|
||||
About...=关于...
|
||||
Quit=退出
|
||||
Edit Servers=编辑服务器
|
||||
|
||||
# Config Form
|
||||
|
||||
&Add=添加(&A)
|
||||
&Delete=删除(&D)
|
||||
Server=服务器
|
||||
@@ -26,7 +35,13 @@ Remarks=备注
|
||||
OK=确定
|
||||
Cancel=取消
|
||||
New server=未配置的服务器
|
||||
|
||||
# QRCode Form
|
||||
|
||||
QRCode=二维码
|
||||
|
||||
# Messages
|
||||
|
||||
Shadowsocks Error: {0}=Shadowsocks 错误: {0}
|
||||
Port already in use=端口已被占用
|
||||
Illegal port number format=非法端口格式
|
||||
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
! Put user rules line by line in this file.
|
||||
! See https://adblockplus.org/en/filter-cheatsheet
|
||||
+13
-5
@@ -81,6 +81,7 @@ namespace Shadowsocks.Properties {
|
||||
///Start on Boot=开机启动
|
||||
///Allow Clients from LAN=允许来自局域网的连接
|
||||
///Edit PAC File...=编辑 PAC 文件...
|
||||
///Edit User Rule for GFWList...=编辑 GFWList 的用户规则...
|
||||
///Show QRCode...=显示二维码...
|
||||
///Scan QRCode from Screen...=扫描屏幕上的二维码...
|
||||
///Show Logs...=显示日志...
|
||||
@@ -96,11 +97,7 @@ namespace Shadowsocks.Properties {
|
||||
///Encryption=加密
|
||||
///Proxy Port=代理端口
|
||||
///Remarks=备注
|
||||
///OK=确定
|
||||
///Cancel=取消
|
||||
///New server=未配置的服务器
|
||||
///QRCode=二维码
|
||||
///Shadows [rest of string was truncated]";.
|
||||
///OK= [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string cn {
|
||||
get {
|
||||
@@ -195,5 +192,16 @@ namespace Shadowsocks.Properties {
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ! Put user rules line by line in this file.
|
||||
///! See https://adblockplus.org/en/filter-cheatsheet
|
||||
///.
|
||||
/// </summary>
|
||||
internal static string user_rule {
|
||||
get {
|
||||
return ResourceManager.GetString("user_rule", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,4 +148,7 @@
|
||||
<data name="ssw128" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ssw128.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="user_rule" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\data\user-rule.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -46,7 +46,8 @@ namespace Shadowsocks.View
|
||||
|
||||
controller.EnableStatusChanged += controller_EnableStatusChanged;
|
||||
controller.ConfigChanged += controller_ConfigChanged;
|
||||
controller.PACFileReadyToOpen += controller_PACFileReadyToOpen;
|
||||
controller.PACFileReadyToOpen += controller_FileReadyToOpen;
|
||||
controller.UserRuleFileReadyToOpen += controller_FileReadyToOpen;
|
||||
controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged;
|
||||
controller.EnableGlobalChanged += controller_EnableGlobalChanged;
|
||||
controller.Errored += controller_Errored;
|
||||
@@ -151,10 +152,12 @@ namespace Shadowsocks.View
|
||||
CreateMenuItem("Scan QRCode from Screen...", new EventHandler(this.ScanQRCodeItem_Click))
|
||||
}),
|
||||
new MenuItem("-"),
|
||||
this.AutoStartupItem = CreateMenuItem("Start on Boot", new EventHandler(this.AutoStartupItem_Click)),
|
||||
this.ShareOverLANItem = CreateMenuItem("Allow Clients from LAN", new EventHandler(this.ShareOverLANItem_Click)),
|
||||
CreateMenuItem("Edit PAC File...", new EventHandler(this.EditPACFileItem_Click)),
|
||||
CreateMenuItem("Update PAC from GFWList", new EventHandler(this.UpdatePACFromGFWListItem_Click)),
|
||||
CreateMenuItem("Edit User Rule for GFWList...", new EventHandler(this.EditUserRuleFileForGFWListItem_Click)),
|
||||
new MenuItem("-"),
|
||||
this.AutoStartupItem = CreateMenuItem("Start on Boot", new EventHandler(this.AutoStartupItem_Click)),
|
||||
this.ShareOverLANItem = CreateMenuItem("Allow Clients from LAN", new EventHandler(this.ShareOverLANItem_Click)),
|
||||
new MenuItem("-"),
|
||||
CreateMenuItem("Show Logs...", new EventHandler(this.ShowLogItem_Click)),
|
||||
CreateMenuItem("About...", new EventHandler(this.AboutItem_Click)),
|
||||
@@ -186,7 +189,7 @@ namespace Shadowsocks.View
|
||||
PACModeItem.Checked = !globalModeItem.Checked;
|
||||
}
|
||||
|
||||
void controller_PACFileReadyToOpen(object sender, ShadowsocksController.PathEventArgs e)
|
||||
void controller_FileReadyToOpen(object sender, ShadowsocksController.PathEventArgs e)
|
||||
{
|
||||
string argument = @"/select, " + e.Path;
|
||||
|
||||
@@ -352,6 +355,11 @@ namespace Shadowsocks.View
|
||||
controller.UpdatePACFromGFWList();
|
||||
}
|
||||
|
||||
private void EditUserRuleFileForGFWListItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
controller.TouchUserRuleFile();
|
||||
}
|
||||
|
||||
private void AServerItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MenuItem item = (MenuItem)sender;
|
||||
|
||||
@@ -198,6 +198,7 @@
|
||||
<None Include="Resources\ss24.png" />
|
||||
<None Include="Resources\ssw128.png" />
|
||||
<Content Include="Data\cn.txt" />
|
||||
<Content Include="Data\user-rule.txt" />
|
||||
<Content Include="shadowsocks.ico" />
|
||||
<None Include="Data\polipo_config.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user