diff --git a/shadowsocks-csharp/Controller/ShadowsocksController.cs b/shadowsocks-csharp/Controller/ShadowsocksController.cs index 3335a712..f161ca0d 100755 --- a/shadowsocks-csharp/Controller/ShadowsocksController.cs +++ b/shadowsocks-csharp/Controller/ShadowsocksController.cs @@ -34,21 +34,6 @@ namespace Shadowsocks.Controller public ShadowsocksController() { - _config = Configuration.Load(); - if (_config.enableLog) - { - SetLog(); - } -<<<<<<< HEAD -======= - - openOnLan = _config.openOnLan; - polipoRunner = new PolipoRunner(); - polipoRunner.openOnLan = openOnLan; - polipoRunner.Start(_config.GetCurrentServer()); - local = new Local(_config.GetCurrentServer()); - local.openOnLan = openOnLan; ->>>>>>> 835265b... add log switch and modify detector polipoRunner = new PolipoRunner(); polipoRunner.Start(_config); @@ -68,39 +53,6 @@ namespace Shadowsocks.Controller UpdateSystemProxy(); } -<<<<<<< HEAD -======= - public void SaveConfig(Configuration newConfig) - { - Configuration.Save(newConfig); - if (newConfig.noChange && newConfig.openOnLan == openOnLan) - { - return; - } - // some logic in configuration updated the config when saving, we need to read it again - _config = Configuration.Load(); - openOnLan = _config.openOnLan; - - local.Stop(); - polipoRunner.Stop(); - polipoRunner.openOnLan = openOnLan; - polipoRunner.Start(_config.GetCurrentServer()); - - local = new Local(_config.GetCurrentServer()); - local.openOnLan = openOnLan; - local.Start(); - - pacServer.Stop(); - pacServer.openOnLan = openOnLan; - pacServer.Start(); - - if (ConfigChanged != null) - { - ConfigChanged(this, new EventArgs()); - } - } - ->>>>>>> 835265b... add log switch and modify detector public Server GetCurrentServer() { return _config.GetCurrentServer(); @@ -227,23 +179,5 @@ namespace Shadowsocks.Controller { UpdateSystemProxy(); } - - private void SetLog() - { - try - { - FileStream fs = new FileStream("shadowsocks.log", FileMode.Append); - TextWriter tmp = Console.Out; - StreamWriter sw = new StreamWriter(fs); - sw.AutoFlush = true; - Console.SetOut(sw); - Console.SetError(sw); - } - catch (IOException e) - { - Console.WriteLine(e.ToString()); - } - } - } } diff --git a/shadowsocks-csharp/Program.cs b/shadowsocks-csharp/Program.cs index 22d049f1..c90f089b 100755 --- a/shadowsocks-csharp/Program.cs +++ b/shadowsocks-csharp/Program.cs @@ -46,12 +46,8 @@ namespace Shadowsocks Console.WriteLine(e.ToString()); } LoadLibrary(dllPath); -<<<<<<< HEAD - - Logging.OpenLogFile(); -======= ->>>>>>> 835265b... add log switch and modify detector + Logging.OpenLogFile(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ShadowsocksController controller = new ShadowsocksController(); diff --git a/shadowsocks-csharp/View/ConfigForm.Designer.cs b/shadowsocks-csharp/View/ConfigForm.Designer.cs index 2183f9ab..cf874286 100755 --- a/shadowsocks-csharp/View/ConfigForm.Designer.cs +++ b/shadowsocks-csharp/View/ConfigForm.Designer.cs @@ -66,14 +66,6 @@ this.AddButton = new System.Windows.Forms.Button(); this.ServerGroupBox = new System.Windows.Forms.GroupBox(); this.ServersListBox = new System.Windows.Forms.ListBox(); -<<<<<<< HEAD -<<<<<<< HEAD -======= - this.openOnLanBox = new System.Windows.Forms.CheckBox(); - this.enableLogBox = new System.Windows.Forms.CheckBox(); ->>>>>>> 835265b... add log switch and modify detector -======= ->>>>>>> 7d539d3... add modify detector this.tableLayoutPanel1.SuspendLayout(); this.panel1.SuspendLayout(); this.panel3.SuspendLayout(); @@ -426,33 +418,6 @@ this.ServersListBox.TabIndex = 5; this.ServersListBox.SelectedIndexChanged += new System.EventHandler(this.ServersListBox_SelectedIndexChanged); // -<<<<<<< HEAD -<<<<<<< HEAD -======= - // openOnLanBox - // - this.openOnLanBox.AutoSize = true; - this.openOnLanBox.Location = new System.Drawing.Point(16, 260); - this.openOnLanBox.Name = "openOnLanBox"; - this.openOnLanBox.Size = new System.Drawing.Size(90, 17); - this.openOnLanBox.TabIndex = 7; - this.openOnLanBox.Text = "Open On Lan"; - this.openOnLanBox.UseVisualStyleBackColor = true; - // - // enableLogBox - // - this.enableLogBox.AutoSize = true; - this.enableLogBox.Location = new System.Drawing.Point(112, 260); - this.enableLogBox.Name = "enableLogBox"; - this.enableLogBox.Size = new System.Drawing.Size(80, 17); - this.enableLogBox.TabIndex = 7; - this.enableLogBox.Text = "Enable Log"; - this.enableLogBox.UseVisualStyleBackColor = true; - this.enableLogBox.CheckedChanged += new System.EventHandler(this.enableLogBox_CheckedChanged); - // ->>>>>>> 835265b... add log switch and modify detector -======= ->>>>>>> 7d539d3... add modify detector // ConfigForm // this.AcceptButton = this.OKButton; @@ -461,14 +426,6 @@ this.AutoSize = true; this.CancelButton = this.MyCancelButton; this.ClientSize = new System.Drawing.Size(489, 286); -<<<<<<< HEAD -<<<<<<< HEAD -======= - this.Controls.Add(this.enableLogBox); - this.Controls.Add(this.openOnLanBox); ->>>>>>> 835265b... add log switch and modify detector -======= ->>>>>>> 7d539d3... add modify detector this.Controls.Add(this.ServersListBox); this.Controls.Add(this.ServerGroupBox); this.Controls.Add(this.panel1); @@ -530,18 +487,8 @@ private System.Windows.Forms.TextBox RemarksTextBox; private System.Windows.Forms.Label label6; private System.Windows.Forms.MenuItem QRCodeItem; -<<<<<<< HEAD -<<<<<<< HEAD private System.Windows.Forms.MenuItem ShowLogItem; private System.Windows.Forms.MenuItem ShareOverLANItem; -======= - private System.Windows.Forms.CheckBox openOnLanBox; - private System.Windows.Forms.CheckBox enableLogBox; ->>>>>>> 835265b... add log switch and modify detector -======= - private System.Windows.Forms.MenuItem ShowLogItem; - private System.Windows.Forms.MenuItem ShareOverLANItem; ->>>>>>> 7d539d3... add modify detector } } diff --git a/shadowsocks-csharp/View/ConfigForm.cs b/shadowsocks-csharp/View/ConfigForm.cs index 96e5c723..4b1bdda6 100755 --- a/shadowsocks-csharp/View/ConfigForm.cs +++ b/shadowsocks-csharp/View/ConfigForm.cs @@ -12,9 +12,9 @@ namespace Shadowsocks.View { public partial class ConfigForm : Form { - private ShadowsocksController controller; - private UpdateChecker updateChecker; - private AboutForm aboutForm; + private ShadowsocksController controller; + private UpdateChecker updateChecker; + private AboutForm aboutForm; // this is a copy of configuration that we are working on private Configuration _modifiedConfiguration; @@ -68,7 +68,7 @@ namespace Shadowsocks.View notifyIcon1.BalloonTipIcon = ToolTipIcon.Info; notifyIcon1.BalloonTipClicked += notifyIcon1_BalloonTipClicked; notifyIcon1.ShowBalloonTip(5000); - isFirstRun = false; + _isFirstRun = false; } void notifyIcon1_BalloonTipClicked(object sender, EventArgs e) @@ -176,8 +176,8 @@ namespace Shadowsocks.View LoadSelectedServer(); UpdateServersMenu(); - enableItem.Checked = _modifiedConfiguration.enabled; - ShareOverLANItem.Checked = _modifiedConfiguration.shareOverLan; + enableItem.Checked = _modifiedConfiguration.enabled; + ShareOverLANItem.Checked = _modifiedConfiguration.shareOverLan; } private void UpdateServersMenu() @@ -300,9 +300,9 @@ namespace Shadowsocks.View if (_modifiedConfiguration.configs.Count == 0) { MessageBox.Show("Please add at least one server"); - return; + return; } - controller.SaveServers(_modifiedConfiguration.configs, _modifiedConfiguration.noChange); + controller.SaveServers(_modifiedConfiguration.configs, _modifiedConfiguration.noChange); this.Hide(); ShowFirstTimeBalloon(); } diff --git a/shadowsocks-csharp/View/QRCodeForm.cs b/shadowsocks-csharp/View/QRCodeForm.cs index c2ed8304..12c5b6fd 100755 --- a/shadowsocks-csharp/View/QRCodeForm.cs +++ b/shadowsocks-csharp/View/QRCodeForm.cs @@ -24,22 +24,12 @@ namespace Shadowsocks.View private void GenQR(string ssconfig) { -<<<<<<< HEAD - string qrText = ssconfig; + string qrText = ssconfig; QRCode4CS.Options options = new QRCode4CS.Options(); options.Text = qrText; QRCode4CS.QRCode qrCoded = null; bool success = false; - foreach (var level in new QRErrorCorrectLevel[]{QRErrorCorrectLevel.H, QRErrorCorrectLevel.Q, QRErrorCorrectLevel.M, QRErrorCorrectLevel.L}) -======= - string qrText = ssconfig; - QRCode4CS.QRCode qrCoded = new QRCode4CS.QRCode(6, QRErrorCorrectLevel.L); - qrCoded.AddData(qrText); - qrCoded.Make(); - int blockSize = 5; - Bitmap drawArea = new Bitmap((qrCoded.GetModuleCount() * blockSize), (qrCoded.GetModuleCount() * blockSize)); - for (int row = 0; row < qrCoded.GetModuleCount(); row++) ->>>>>>> 7d539d3... add modify detector + foreach (var level in new QRErrorCorrectLevel[]{QRErrorCorrectLevel.H, QRErrorCorrectLevel.Q, QRErrorCorrectLevel.M, QRErrorCorrectLevel.L}) { for (int i = 3; i < 10; i++) {