diff --git a/shadowsocks-csharp/Controller/ShadowsocksController.cs b/shadowsocks-csharp/Controller/ShadowsocksController.cs index 9837dc38..05a55898 100755 --- a/shadowsocks-csharp/Controller/ShadowsocksController.cs +++ b/shadowsocks-csharp/Controller/ShadowsocksController.cs @@ -64,9 +64,10 @@ namespace Shadowsocks.Controller return Configuration.Load(); } - public void SaveServers(List servers) + public void SaveServers(List servers, bool noChange) { _config.configs = servers; + _config.noChange = noChange; SaveConfig(_config); } @@ -84,6 +85,7 @@ namespace Shadowsocks.Controller public void ToggleShareOverLAN(bool enabled) { _config.shareOverLan = enabled; + _config.noChange = false; SaveConfig(_config); if (ShareOverLANStatusChanged != null) { @@ -133,6 +135,10 @@ namespace Shadowsocks.Controller public void SaveConfig(Configuration newConfig) { Configuration.Save(newConfig); + if (newConfig.noChange) + { + return; + } // some logic in configuration updated the config when saving, we need to read it again _config = Configuration.Load(); diff --git a/shadowsocks-csharp/View/ConfigForm.Designer.cs b/shadowsocks-csharp/View/ConfigForm.Designer.cs index f8aa54cf..cf874286 100755 --- a/shadowsocks-csharp/View/ConfigForm.Designer.cs +++ b/shadowsocks-csharp/View/ConfigForm.Designer.cs @@ -418,7 +418,6 @@ this.ServersListBox.TabIndex = 5; this.ServersListBox.SelectedIndexChanged += new System.EventHandler(this.ServersListBox_SelectedIndexChanged); // - // // ConfigForm // this.AcceptButton = this.OKButton; diff --git a/shadowsocks-csharp/View/ConfigForm.cs b/shadowsocks-csharp/View/ConfigForm.cs index ec2cc728..464780ed 100755 --- a/shadowsocks-csharp/View/ConfigForm.cs +++ b/shadowsocks-csharp/View/ConfigForm.cs @@ -301,7 +301,7 @@ namespace Shadowsocks.View MessageBox.Show("Please add at least one server"); return; } - controller.SaveConfig(_modifiedConfiguration); + controller.SaveServers(_modifiedConfiguration.configs, _modifiedConfiguration.noChange); this.Hide(); ShowFirstTimeBalloon(); }