mirror of
https://github.com/netchx/netch.git
synced 2026-04-05 19:45:05 +08:00
添加快捷删除模式按钮
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,5 +115,20 @@ namespace Netch.Models
|
||||
// 写入到模式文件里
|
||||
System.IO.File.WriteAllText(NewPath, ToFileString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除模式文件
|
||||
/// </summary>
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,21 @@
|
||||
<Reference Include="System.Web" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="@ECHO OFF
RD /S /Q $(TargetDir)bin > NUL 2>&1
RD /S /Q $(TargetDir)i18n > NUL 2>&1
RD /S /Q $(TargetDir)mode > NUL 2>&1

MKDIR $(TargetDir)bin > NUL 2>&1
MKDIR $(TargetDir)i18n > NUL 2>&1
MKDIR $(TargetDir)mode > NUL 2>&1

COPY /Y $(SolutionDir)binaries\$(PlatformName)\* $(TargetDir)bin > NUL 2>&1
COPY /Y $(SolutionDir)binaries\* $(TargetDir)bin > NUL 2>&1
MOVE /Y $(TargetDir)bin\nfapinet.dll $(TargetDir)nfapinet.dll > NUL 2>&1
COPY /Y $(SolutionDir)translations\i18n\* $(TargetDir)i18n > NUL 2>&1
COPY /Y $(SolutionDir)modes\mode\*.txt $(TargetDir)mode > NUL 2>&1
MKDIR $(TargetDir)bin\tap-driver > NUL 2>&1
COPY /Y $(SolutionDir)binaries\$(PlatformName)\tap-driver\* $(TargetDir)bin\tap-driver > NUL 2>&1" />
|
||||
</Target>
|
||||
|
||||
10
Netch/Properties/Resources.Designer.cs
generated
10
Netch/Properties/Resources.Designer.cs
generated
@@ -70,6 +70,16 @@ namespace Netch.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap CopyLink {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("CopyLink", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Byte[] 类型的本地化资源。
|
||||
/// </summary>
|
||||
|
||||
@@ -121,12 +121,12 @@
|
||||
<data name="defaultTUNTAP" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\defaultTUNTAP;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="Netch" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Netch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="zh_CN" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\zh-CN;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="speed" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\speed.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
@@ -136,10 +136,13 @@
|
||||
<data name="CNIP" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\CNIP;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="speed" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\speed.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="Netch" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Netch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="N3RO" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\N3RO.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="CopyLink" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\CopyLink.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
Netch/Resources/CopyLink.png
Normal file
BIN
Netch/Resources/CopyLink.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 637 B |
2
modes
2
modes
Submodule modes updated: 6c2c744529...9b3ce74bd6
Reference in New Issue
Block a user