From 282e000beb4c02fa25b017547224418fe6a30110 Mon Sep 17 00:00:00 2001 From: Amazing_DM Date: Thu, 13 Feb 2020 17:13:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BF=AB=E6=8D=B7=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=A8=A1=E5=BC=8F=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Netch/Forms/MainForm.cs | 30 +++++++++++++++++++++++++ Netch/Models/Mode.cs | 15 +++++++++++++ Netch/Netch.csproj | 15 +++++++++++++ Netch/Properties/Resources.Designer.cs | 10 +++++++++ Netch/Properties/Resources.resx | 13 ++++++----- Netch/Resources/CopyLink.png | Bin 0 -> 637 bytes modes | 2 +- 7 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 Netch/Resources/CopyLink.png diff --git a/Netch/Forms/MainForm.cs b/Netch/Forms/MainForm.cs index 6911edc9..d89354d5 100644 --- a/Netch/Forms/MainForm.cs +++ b/Netch/Forms/MainForm.cs @@ -1142,5 +1142,35 @@ namespace Netch.Forms MessageBox.Show(Utils.i18N.Translate("Please select an mode first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } + + private void CopyServerLinkPictureBox_Click(object sender, EventArgs e) + { + + } + + private void DeleteModePictureBox_Click(object sender, EventArgs e) + { + // 当前ModeComboBox中至少有一项 + if (ModeComboBox.Items.Count > 0 && ModeComboBox.SelectedIndex != -1) + { + var selectedMode = (Models.Mode)ModeComboBox.SelectedItem; + + //删除模式文件 + selectedMode.DeleteFile("mode"); + + ModeComboBox.Items.Clear(); + Global.ModeFiles.Remove(selectedMode); + var array = Global.ModeFiles.ToArray(); + Array.Sort(array, (a, b) => string.Compare(a.Remark, b.Remark, StringComparison.Ordinal)); + ModeComboBox.Items.AddRange(array); + + SelectLastMode(); + Utils.Configuration.Save(); + } + else + { + MessageBox.Show(Utils.i18N.Translate("Please select an mode first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } } } diff --git a/Netch/Models/Mode.cs b/Netch/Models/Mode.cs index 0b7ed6cc..e65d6ab6 100644 --- a/Netch/Models/Mode.cs +++ b/Netch/Models/Mode.cs @@ -115,5 +115,20 @@ namespace Netch.Models // 写入到模式文件里 System.IO.File.WriteAllText(NewPath, ToFileString()); } + + /// + /// 删除模式文件 + /// + public void DeleteFile(string Dir) + { + if (System.IO.Directory.Exists(Dir)) + { + var NewPath = System.IO.Path.Combine(Dir, FileName); + if (System.IO.File.Exists(NewPath + ".txt")) + { + System.IO.File.Delete(NewPath + ".txt"); + } + } + } } } diff --git a/Netch/Netch.csproj b/Netch/Netch.csproj index 13e1bdfb..7990343a 100644 --- a/Netch/Netch.csproj +++ b/Netch/Netch.csproj @@ -67,6 +67,21 @@ + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + diff --git a/Netch/Properties/Resources.Designer.cs b/Netch/Properties/Resources.Designer.cs index b2a2ee2d..36ea6966 100644 --- a/Netch/Properties/Resources.Designer.cs +++ b/Netch/Properties/Resources.Designer.cs @@ -70,6 +70,16 @@ namespace Netch.Properties { } } + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap CopyLink { + get { + object obj = ResourceManager.GetObject("CopyLink", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 查找 System.Byte[] 类型的本地化资源。 /// diff --git a/Netch/Properties/Resources.resx b/Netch/Properties/Resources.resx index b0205f6f..530e6971 100644 --- a/Netch/Properties/Resources.resx +++ b/Netch/Properties/Resources.resx @@ -121,12 +121,12 @@ ..\Resources\defaultTUNTAP;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\Netch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\zh-CN;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\speed.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -136,10 +136,13 @@ ..\Resources\CNIP;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\speed.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Netch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\N3RO.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\CopyLink.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Netch/Resources/CopyLink.png b/Netch/Resources/CopyLink.png new file mode 100644 index 0000000000000000000000000000000000000000..b4da6f9a2f9a06fb1cd0445598fd691bfc892cbc GIT binary patch literal 637 zcmV-@0)qXCP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!~g&e!~vBn z4jTXf0s=`yK~y+TrIXJ~6k!<0zq7M5>o&X7YMJ7qX3>JAE z%D{h+;Lm@iX$E%}bUa+%L3bvJLoFiIR05ZeW^t)c;TAQ1ajD$>3io zjWZa3yN%QNG<3&@?grR2eVpk^`4L$%q&~ zR!?oJWZ<3dVtT`j4o}W}#fbwl=Dyi5jC$4a6l{+RoPb@UooQ^D9+t{39tS1hJ z!<`uo1Jxo%1dWX{+9AG)j)i-(pYcU%jaIf>NupPgkXJasH)nq%9PEKxG*gT8x}?Bhlh2x)@vqkwj+Vzt}LuTh@wi81X->%w&~CGcK|;D X_IUzALODEe00000NkvXXu0mjffJPGx literal 0 HcmV?d00001 diff --git a/modes b/modes index 6c2c7445..9b3ce74b 160000 --- a/modes +++ b/modes @@ -1 +1 @@ -Subproject commit 6c2c744529403b311d3e4fbbe84656942aabaab5 +Subproject commit 9b3ce74bd646f40b6ffdf9e3ada5fde89ad71561