v1.1.1
This commit is contained in:
parent
b5f2820097
commit
861434fd72
|
@ -32,6 +32,7 @@
|
|||
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label_version = new System.Windows.Forms.Label();
|
||||
this.label_Star = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// linkLabel1
|
||||
|
@ -51,10 +52,16 @@
|
|||
resources.ApplyResources(this.label_version, "label_version");
|
||||
this.label_version.Name = "label_version";
|
||||
//
|
||||
// label_Star
|
||||
//
|
||||
resources.ApplyResources(this.label_Star, "label_Star");
|
||||
this.label_Star.Name = "label_Star";
|
||||
//
|
||||
// About
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.label_Star);
|
||||
this.Controls.Add(this.label_version);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.linkLabel1);
|
||||
|
@ -73,5 +80,6 @@
|
|||
private System.Windows.Forms.LinkLabel linkLabel1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label_version;
|
||||
private System.Windows.Forms.Label label_Star;
|
||||
}
|
||||
}
|
|
@ -112,19 +112,19 @@
|
|||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="linkLabel1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>10, 78</value>
|
||||
<value>12, 101</value>
|
||||
</data>
|
||||
<data name="linkLabel1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>275, 25</value>
|
||||
<value>320, 25</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="linkLabel1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
|
@ -132,31 +132,31 @@
|
|||
<value>https://github.com/zmjack/PortProxyGUI</value>
|
||||
</data>
|
||||
<data name="linkLabel1.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>TopCenter</value>
|
||||
<value>MiddleCenter</value>
|
||||
</data>
|
||||
<data name=">>linkLabel1.Name" xml:space="preserve">
|
||||
<value>linkLabel1</value>
|
||||
</data>
|
||||
<data name=">>linkLabel1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>linkLabel1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>linkLabel1.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>10, 31</value>
|
||||
<value>12, 31</value>
|
||||
</data>
|
||||
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>275, 47</value>
|
||||
<value>320, 47</value>
|
||||
</data>
|
||||
<data name="label1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="label1.Text" xml:space="preserve">
|
||||
<value>This is free software,
|
||||
<value>This is a free software.
|
||||
You can browse the source code on GitHub.</value>
|
||||
</data>
|
||||
<data name="label1.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
|
@ -166,19 +166,19 @@ You can browse the source code on GitHub.</value>
|
|||
<value>label1</value>
|
||||
</data>
|
||||
<data name=">>label1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="label_version.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>10, 6</value>
|
||||
<value>12, 6</value>
|
||||
</data>
|
||||
<data name="label_version.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>275, 24</value>
|
||||
<value>320, 24</value>
|
||||
</data>
|
||||
<data name="label_version.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
|
@ -193,22 +193,49 @@ You can browse the source code on GitHub.</value>
|
|||
<value>label_version</value>
|
||||
</data>
|
||||
<data name=">>label_version.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label_version.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label_version.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="label_Star.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 78</value>
|
||||
</data>
|
||||
<data name="label_Star.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>320, 23</value>
|
||||
</data>
|
||||
<data name="label_Star.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="label_Star.Text" xml:space="preserve">
|
||||
<value>Star me at:</value>
|
||||
</data>
|
||||
<data name="label_Star.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleCenter</value>
|
||||
</data>
|
||||
<data name=">>label_Star.Name" xml:space="preserve">
|
||||
<value>label_Star</value>
|
||||
</data>
|
||||
<data name=">>label_Star.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label_Star.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label_Star.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 12</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>296, 109</value>
|
||||
<value>344, 141</value>
|
||||
</data>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
@ -2368,7 +2395,7 @@ You can browse the source code on GitHub.</value>
|
|||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
||||
</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 2, 3, 2</value>
|
||||
</data>
|
||||
|
@ -2382,6 +2409,6 @@ You can browse the source code on GitHub.</value>
|
|||
<value>About</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
File diff suppressed because it is too large
Load Diff
|
@ -63,7 +63,12 @@ namespace PortProxyGUI
|
|||
{
|
||||
var item = listViewProxies.SelectedItems.OfType<ListViewItem>().FirstOrDefault();
|
||||
var subItems = item.SubItems.OfType<ListViewSubItem>().ToArray();
|
||||
form.UseUpdateMode(item, subItems[1].Text, subItems[2].Text, subItems[3].Text, subItems[4].Text, subItems[5].Text);
|
||||
|
||||
if (int.TryParse(subItems[3].Text, out var listenPort) && 0 < listenPort && listenPort < 65536)
|
||||
{
|
||||
form.UseUpdateMode(item, subItems[1].Text, subItems[2].Text, listenPort, subItems[4].Text, subItems[5].Text);
|
||||
}
|
||||
else MessageBox.Show("无效端口号。", "无效端口号", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
|
||||
public void RefreshProxyList()
|
||||
|
@ -110,13 +115,13 @@ namespace PortProxyGUI
|
|||
case ToolStripMenuItem item when item == toolStripMenuItem_New:
|
||||
if (SetProxyForm == null) SetProxyForm = new SetProxyForm(this);
|
||||
SetProxyForm.UseNormalMode();
|
||||
SetProxyForm.Show();
|
||||
SetProxyForm.ShowDialog();
|
||||
break;
|
||||
|
||||
case ToolStripMenuItem item when item == toolStripMenuItem_Modify:
|
||||
if (SetProxyForm == null) SetProxyForm = new SetProxyForm(this);
|
||||
SetProxyForUpdate(SetProxyForm);
|
||||
SetProxyForm.Show();
|
||||
SetProxyForm.ShowDialog();
|
||||
break;
|
||||
|
||||
case ToolStripMenuItem item when item == toolStripMenuItem_Refresh:
|
||||
|
@ -158,7 +163,7 @@ namespace PortProxyGUI
|
|||
{
|
||||
if (SetProxyForm == null) SetProxyForm = new SetProxyForm(this);
|
||||
SetProxyForUpdate(SetProxyForm);
|
||||
SetProxyForm.Show();
|
||||
SetProxyForm.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
|
|||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("PortProxyGUI - NET")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyDescription("A manager of the netsh interface portproxy which is to evaluate TCP/IP port redirect on windows.")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("nstandard.net")]
|
||||
[assembly: AssemblyProduct("PortProxyGUI - NET")]
|
||||
|
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
[assembly: AssemblyVersion("1.1.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.1.0")]
|
||||
|
|
|
@ -8,22 +8,30 @@ namespace PortProxyGUI
|
|||
{
|
||||
public partial class SetProxyForm : Form
|
||||
{
|
||||
public readonly PortProxyGUI PortProxyGUI;
|
||||
public readonly PortProxyGUI ParentWindow;
|
||||
private string AutoTypeString { get; }
|
||||
private ListViewItem _updateLiveViewItem;
|
||||
|
||||
public SetProxyForm(PortProxyGUI portProxyGUI)
|
||||
private bool _updateMode;
|
||||
private ListViewItem _updateLiveViewItem;
|
||||
private string _oldType;
|
||||
private string _oldListenOn;
|
||||
private int _oldListenPort;
|
||||
|
||||
public SetProxyForm(PortProxyGUI parent)
|
||||
{
|
||||
PortProxyGUI = portProxyGUI;
|
||||
ParentWindow = parent;
|
||||
InitializeComponent();
|
||||
AutoTypeString = comboBox_type.Text = comboBox_type.Items.OfType<string>().First();
|
||||
}
|
||||
|
||||
public void UseNormalMode()
|
||||
{
|
||||
comboBox_type.Enabled = true;
|
||||
textBox_listenOn.Enabled = true;
|
||||
textBox_listenPort.Enabled = true;
|
||||
_updateMode = false;
|
||||
_updateLiveViewItem = null;
|
||||
_oldType = null;
|
||||
_oldListenOn = null;
|
||||
_oldListenPort = 0;
|
||||
|
||||
comboBox_type.Text = AutoTypeString;
|
||||
textBox_listenOn.Text = "*";
|
||||
textBox_listenPort.Text = "";
|
||||
|
@ -31,15 +39,17 @@ namespace PortProxyGUI
|
|||
textBox_connectPort.Text = "";
|
||||
}
|
||||
|
||||
public void UseUpdateMode(ListViewItem item, string type, string listenOn, string listenPort, string connectTo, string connectPort)
|
||||
public void UseUpdateMode(ListViewItem item, string type, string listenOn, int listenPort, string connectTo, string connectPort)
|
||||
{
|
||||
_updateMode = true;
|
||||
_updateLiveViewItem = item;
|
||||
comboBox_type.Enabled = false;
|
||||
textBox_listenOn.Enabled = false;
|
||||
textBox_listenPort.Enabled = false;
|
||||
_oldType = type;
|
||||
_oldListenOn = listenOn.Trim().ToLower();
|
||||
_oldListenPort = listenPort;
|
||||
|
||||
comboBox_type.Text = type;
|
||||
textBox_listenOn.Text = listenOn;
|
||||
textBox_listenPort.Text = listenPort;
|
||||
textBox_listenOn.Text = listenOn.ToString();
|
||||
textBox_listenPort.Text = listenPort.ToString();
|
||||
textBox_connectTo.Text = connectTo;
|
||||
textBox_connectPort.Text = connectPort;
|
||||
}
|
||||
|
@ -84,13 +94,20 @@ namespace PortProxyGUI
|
|||
return;
|
||||
}
|
||||
|
||||
if (_updateLiveViewItem != null)
|
||||
if (_updateMode)
|
||||
{
|
||||
var rule = Program.SqliteDbScope.GetRule(type, listenOn, _listenPort);
|
||||
var rule = Program.SqliteDbScope.GetRule(_oldType, _oldListenOn, _oldListenPort);
|
||||
CmdUtil.DeleteProxy(_oldType, _oldListenOn, _oldListenPort);
|
||||
Program.SqliteDbScope.Remove(rule);
|
||||
|
||||
rule.Type = type;
|
||||
rule.ListenOn = listenOn;
|
||||
rule.ListenPort = _listenPort;
|
||||
rule.ConnectTo = connectTo;
|
||||
rule.ConnectPort = _connectPort;
|
||||
Program.SqliteDbScope.Update(rule);
|
||||
CmdUtil.AddProxy("set", type, listenOn, _listenPort, connectTo, _connectPort);
|
||||
|
||||
CmdUtil.AddProxy("add", type, listenOn, _listenPort, connectTo, _connectPort);
|
||||
Program.SqliteDbScope.Add(rule);
|
||||
|
||||
_updateLiveViewItem.ImageIndex = 1;
|
||||
var subItems = _updateLiveViewItem.SubItems;
|
||||
|
@ -103,7 +120,7 @@ namespace PortProxyGUI
|
|||
else
|
||||
{
|
||||
CmdUtil.AddProxy("add", type, listenOn, _listenPort, connectTo, _connectPort);
|
||||
PortProxyGUI.RefreshProxyList();
|
||||
ParentWindow.RefreshProxyList();
|
||||
}
|
||||
|
||||
Close();
|
||||
|
@ -111,13 +128,13 @@ namespace PortProxyGUI
|
|||
|
||||
private void SetProxyForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Top = PortProxyGUI.Top + (PortProxyGUI.Height - Height) / 2;
|
||||
Left = PortProxyGUI.Left + (PortProxyGUI.Width - Width) / 2;
|
||||
Top = ParentWindow.Top + (ParentWindow.Height - Height) / 2;
|
||||
Left = ParentWindow.Left + (ParentWindow.Width - Width) / 2;
|
||||
}
|
||||
|
||||
private void SetProxyForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
PortProxyGUI.SetProxyForm = null;
|
||||
ParentWindow.SetProxyForm = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label_version = new System.Windows.Forms.Label();
|
||||
this.label_Star = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// linkLabel1
|
||||
|
@ -51,10 +52,16 @@
|
|||
resources.ApplyResources(this.label_version, "label_version");
|
||||
this.label_version.Name = "label_version";
|
||||
//
|
||||
// label_Star
|
||||
//
|
||||
resources.ApplyResources(this.label_Star, "label_Star");
|
||||
this.label_Star.Name = "label_Star";
|
||||
//
|
||||
// About
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.label_Star);
|
||||
this.Controls.Add(this.label_version);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.linkLabel1);
|
||||
|
@ -73,5 +80,6 @@
|
|||
private System.Windows.Forms.LinkLabel linkLabel1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label_version;
|
||||
private System.Windows.Forms.Label label_Star;
|
||||
}
|
||||
}
|
|
@ -112,19 +112,19 @@
|
|||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="linkLabel1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>10, 78</value>
|
||||
<value>12, 101</value>
|
||||
</data>
|
||||
<data name="linkLabel1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>275, 25</value>
|
||||
<value>320, 25</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="linkLabel1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
|
@ -132,31 +132,31 @@
|
|||
<value>https://github.com/zmjack/PortProxyGUI</value>
|
||||
</data>
|
||||
<data name="linkLabel1.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>TopCenter</value>
|
||||
<value>MiddleCenter</value>
|
||||
</data>
|
||||
<data name=">>linkLabel1.Name" xml:space="preserve">
|
||||
<value>linkLabel1</value>
|
||||
</data>
|
||||
<data name=">>linkLabel1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>linkLabel1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>linkLabel1.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>10, 31</value>
|
||||
<value>12, 31</value>
|
||||
</data>
|
||||
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>275, 47</value>
|
||||
<value>320, 47</value>
|
||||
</data>
|
||||
<data name="label1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="label1.Text" xml:space="preserve">
|
||||
<value>This is free software,
|
||||
<value>This is a free software.
|
||||
You can browse the source code on GitHub.</value>
|
||||
</data>
|
||||
<data name="label1.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
|
@ -166,19 +166,19 @@ You can browse the source code on GitHub.</value>
|
|||
<value>label1</value>
|
||||
</data>
|
||||
<data name=">>label1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="label_version.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>10, 6</value>
|
||||
<value>12, 6</value>
|
||||
</data>
|
||||
<data name="label_version.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>275, 24</value>
|
||||
<value>320, 24</value>
|
||||
</data>
|
||||
<data name="label_version.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
|
@ -193,22 +193,49 @@ You can browse the source code on GitHub.</value>
|
|||
<value>label_version</value>
|
||||
</data>
|
||||
<data name=">>label_version.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label_version.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label_version.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="label_Star.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 78</value>
|
||||
</data>
|
||||
<data name="label_Star.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>320, 23</value>
|
||||
</data>
|
||||
<data name="label_Star.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="label_Star.Text" xml:space="preserve">
|
||||
<value>Star me at:</value>
|
||||
</data>
|
||||
<data name="label_Star.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleCenter</value>
|
||||
</data>
|
||||
<data name=">>label_Star.Name" xml:space="preserve">
|
||||
<value>label_Star</value>
|
||||
</data>
|
||||
<data name=">>label_Star.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label_Star.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label_Star.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 12</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>296, 109</value>
|
||||
<value>344, 141</value>
|
||||
</data>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
@ -2368,7 +2395,7 @@ You can browse the source code on GitHub.</value>
|
|||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
||||
</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 2, 3, 2</value>
|
||||
</data>
|
||||
|
@ -2382,6 +2409,6 @@ You can browse the source code on GitHub.</value>
|
|||
<value>About</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
File diff suppressed because it is too large
Load Diff
|
@ -63,7 +63,12 @@ namespace PortProxyGUI
|
|||
{
|
||||
var item = listViewProxies.SelectedItems.OfType<ListViewItem>().FirstOrDefault();
|
||||
var subItems = item.SubItems.OfType<ListViewSubItem>().ToArray();
|
||||
form.UseUpdateMode(item, subItems[1].Text, subItems[2].Text, subItems[3].Text, subItems[4].Text, subItems[5].Text);
|
||||
|
||||
if (int.TryParse(subItems[3].Text, out var listenPort) && 0 < listenPort && listenPort < 65536)
|
||||
{
|
||||
form.UseUpdateMode(item, subItems[1].Text, subItems[2].Text, listenPort, subItems[4].Text, subItems[5].Text);
|
||||
}
|
||||
else MessageBox.Show("无效端口号。", "无效端口号", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
|
||||
public void RefreshProxyList()
|
||||
|
@ -110,13 +115,13 @@ namespace PortProxyGUI
|
|||
case ToolStripMenuItem item when item == toolStripMenuItem_New:
|
||||
if (SetProxyForm == null) SetProxyForm = new SetProxyForm(this);
|
||||
SetProxyForm.UseNormalMode();
|
||||
SetProxyForm.Show();
|
||||
SetProxyForm.ShowDialog();
|
||||
break;
|
||||
|
||||
case ToolStripMenuItem item when item == toolStripMenuItem_Modify:
|
||||
if (SetProxyForm == null) SetProxyForm = new SetProxyForm(this);
|
||||
SetProxyForUpdate(SetProxyForm);
|
||||
SetProxyForm.Show();
|
||||
SetProxyForm.ShowDialog();
|
||||
break;
|
||||
|
||||
case ToolStripMenuItem item when item == toolStripMenuItem_Refresh:
|
||||
|
@ -158,7 +163,7 @@ namespace PortProxyGUI
|
|||
{
|
||||
if (SetProxyForm == null) SetProxyForm = new SetProxyForm(this);
|
||||
SetProxyForUpdate(SetProxyForm);
|
||||
SetProxyForm.Show();
|
||||
SetProxyForm.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
|
|||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("PortProxyGUI - NET")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyDescription("A manager of the netsh interface portproxy which is to evaluate TCP/IP port redirect on windows.")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("nstandard.net")]
|
||||
[assembly: AssemblyProduct("PortProxyGUI - NET")]
|
||||
|
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
[assembly: AssemblyVersion("1.1.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.1.0")]
|
||||
|
|
|
@ -8,22 +8,30 @@ namespace PortProxyGUI
|
|||
{
|
||||
public partial class SetProxyForm : Form
|
||||
{
|
||||
public readonly PortProxyGUI PortProxyGUI;
|
||||
public readonly PortProxyGUI ParentWindow;
|
||||
private string AutoTypeString { get; }
|
||||
private ListViewItem _updateLiveViewItem;
|
||||
|
||||
public SetProxyForm(PortProxyGUI portProxyGUI)
|
||||
private bool _updateMode;
|
||||
private ListViewItem _updateLiveViewItem;
|
||||
private string _oldType;
|
||||
private string _oldListenOn;
|
||||
private int _oldListenPort;
|
||||
|
||||
public SetProxyForm(PortProxyGUI parent)
|
||||
{
|
||||
PortProxyGUI = portProxyGUI;
|
||||
ParentWindow = parent;
|
||||
InitializeComponent();
|
||||
AutoTypeString = comboBox_type.Text = comboBox_type.Items.OfType<string>().First();
|
||||
}
|
||||
|
||||
public void UseNormalMode()
|
||||
{
|
||||
comboBox_type.Enabled = true;
|
||||
textBox_listenOn.Enabled = true;
|
||||
textBox_listenPort.Enabled = true;
|
||||
_updateMode = false;
|
||||
_updateLiveViewItem = null;
|
||||
_oldType = null;
|
||||
_oldListenOn = null;
|
||||
_oldListenPort = 0;
|
||||
|
||||
comboBox_type.Text = AutoTypeString;
|
||||
textBox_listenOn.Text = "*";
|
||||
textBox_listenPort.Text = "";
|
||||
|
@ -31,15 +39,17 @@ namespace PortProxyGUI
|
|||
textBox_connectPort.Text = "";
|
||||
}
|
||||
|
||||
public void UseUpdateMode(ListViewItem item, string type, string listenOn, string listenPort, string connectTo, string connectPort)
|
||||
public void UseUpdateMode(ListViewItem item, string type, string listenOn, int listenPort, string connectTo, string connectPort)
|
||||
{
|
||||
_updateMode = true;
|
||||
_updateLiveViewItem = item;
|
||||
comboBox_type.Enabled = false;
|
||||
textBox_listenOn.Enabled = false;
|
||||
textBox_listenPort.Enabled = false;
|
||||
_oldType = type;
|
||||
_oldListenOn = listenOn.Trim().ToLower();
|
||||
_oldListenPort = listenPort;
|
||||
|
||||
comboBox_type.Text = type;
|
||||
textBox_listenOn.Text = listenOn;
|
||||
textBox_listenPort.Text = listenPort;
|
||||
textBox_listenOn.Text = listenOn.ToString();
|
||||
textBox_listenPort.Text = listenPort.ToString();
|
||||
textBox_connectTo.Text = connectTo;
|
||||
textBox_connectPort.Text = connectPort;
|
||||
}
|
||||
|
@ -84,13 +94,20 @@ namespace PortProxyGUI
|
|||
return;
|
||||
}
|
||||
|
||||
if (_updateLiveViewItem != null)
|
||||
if (_updateMode)
|
||||
{
|
||||
var rule = Program.SqliteDbScope.GetRule(type, listenOn, _listenPort);
|
||||
var rule = Program.SqliteDbScope.GetRule(_oldType, _oldListenOn, _oldListenPort);
|
||||
CmdUtil.DeleteProxy(_oldType, _oldListenOn, _oldListenPort);
|
||||
Program.SqliteDbScope.Remove(rule);
|
||||
|
||||
rule.Type = type;
|
||||
rule.ListenOn = listenOn;
|
||||
rule.ListenPort = _listenPort;
|
||||
rule.ConnectTo = connectTo;
|
||||
rule.ConnectPort = _connectPort;
|
||||
Program.SqliteDbScope.Update(rule);
|
||||
CmdUtil.AddProxy("set", type, listenOn, _listenPort, connectTo, _connectPort);
|
||||
|
||||
CmdUtil.AddProxy("add", type, listenOn, _listenPort, connectTo, _connectPort);
|
||||
Program.SqliteDbScope.Add(rule);
|
||||
|
||||
_updateLiveViewItem.ImageIndex = 1;
|
||||
var subItems = _updateLiveViewItem.SubItems;
|
||||
|
@ -103,7 +120,7 @@ namespace PortProxyGUI
|
|||
else
|
||||
{
|
||||
CmdUtil.AddProxy("add", type, listenOn, _listenPort, connectTo, _connectPort);
|
||||
PortProxyGUI.RefreshProxyList();
|
||||
ParentWindow.RefreshProxyList();
|
||||
}
|
||||
|
||||
Close();
|
||||
|
@ -111,13 +128,13 @@ namespace PortProxyGUI
|
|||
|
||||
private void SetProxyForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Top = PortProxyGUI.Top + (PortProxyGUI.Height - Height) / 2;
|
||||
Left = PortProxyGUI.Left + (PortProxyGUI.Width - Width) / 2;
|
||||
Top = ParentWindow.Top + (ParentWindow.Height - Height) / 2;
|
||||
Left = ParentWindow.Left + (ParentWindow.Width - Width) / 2;
|
||||
}
|
||||
|
||||
private void SetProxyForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
PortProxyGUI.SetProxyForm = null;
|
||||
ParentWindow.SetProxyForm = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label_version = new System.Windows.Forms.Label();
|
||||
this.label_Star = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// linkLabel1
|
||||
|
@ -51,10 +52,16 @@
|
|||
resources.ApplyResources(this.label_version, "label_version");
|
||||
this.label_version.Name = "label_version";
|
||||
//
|
||||
// label_Star
|
||||
//
|
||||
resources.ApplyResources(this.label_Star, "label_Star");
|
||||
this.label_Star.Name = "label_Star";
|
||||
//
|
||||
// About
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.label_Star);
|
||||
this.Controls.Add(this.label_version);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.linkLabel1);
|
||||
|
@ -73,5 +80,6 @@
|
|||
private System.Windows.Forms.LinkLabel linkLabel1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label_version;
|
||||
private System.Windows.Forms.Label label_Star;
|
||||
}
|
||||
}
|
|
@ -112,19 +112,19 @@
|
|||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="linkLabel1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>10, 78</value>
|
||||
<value>12, 101</value>
|
||||
</data>
|
||||
<data name="linkLabel1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>275, 25</value>
|
||||
<value>320, 25</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="linkLabel1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
|
@ -132,31 +132,31 @@
|
|||
<value>https://github.com/zmjack/PortProxyGUI</value>
|
||||
</data>
|
||||
<data name="linkLabel1.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>TopCenter</value>
|
||||
<value>MiddleCenter</value>
|
||||
</data>
|
||||
<data name=">>linkLabel1.Name" xml:space="preserve">
|
||||
<value>linkLabel1</value>
|
||||
</data>
|
||||
<data name=">>linkLabel1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>linkLabel1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>linkLabel1.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>10, 31</value>
|
||||
<value>12, 31</value>
|
||||
</data>
|
||||
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>275, 47</value>
|
||||
<value>320, 47</value>
|
||||
</data>
|
||||
<data name="label1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="label1.Text" xml:space="preserve">
|
||||
<value>This is free software,
|
||||
<value>This is a free software.
|
||||
You can browse the source code on GitHub.</value>
|
||||
</data>
|
||||
<data name="label1.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
|
@ -166,19 +166,19 @@ You can browse the source code on GitHub.</value>
|
|||
<value>label1</value>
|
||||
</data>
|
||||
<data name=">>label1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="label_version.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>10, 6</value>
|
||||
<value>12, 6</value>
|
||||
</data>
|
||||
<data name="label_version.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>275, 24</value>
|
||||
<value>320, 24</value>
|
||||
</data>
|
||||
<data name="label_version.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
|
@ -193,22 +193,49 @@ You can browse the source code on GitHub.</value>
|
|||
<value>label_version</value>
|
||||
</data>
|
||||
<data name=">>label_version.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label_version.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label_version.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="label_Star.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 78</value>
|
||||
</data>
|
||||
<data name="label_Star.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>320, 23</value>
|
||||
</data>
|
||||
<data name="label_Star.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="label_Star.Text" xml:space="preserve">
|
||||
<value>Star me at:</value>
|
||||
</data>
|
||||
<data name="label_Star.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleCenter</value>
|
||||
</data>
|
||||
<data name=">>label_Star.Name" xml:space="preserve">
|
||||
<value>label_Star</value>
|
||||
</data>
|
||||
<data name=">>label_Star.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label_Star.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label_Star.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 12</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>296, 109</value>
|
||||
<value>344, 141</value>
|
||||
</data>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
@ -2368,7 +2395,7 @@ You can browse the source code on GitHub.</value>
|
|||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
||||
</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 2, 3, 2</value>
|
||||
</data>
|
||||
|
@ -2382,6 +2409,6 @@ You can browse the source code on GitHub.</value>
|
|||
<value>About</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
File diff suppressed because it is too large
Load Diff
|
@ -63,7 +63,12 @@ namespace PortProxyGUI
|
|||
{
|
||||
var item = listViewProxies.SelectedItems.OfType<ListViewItem>().FirstOrDefault();
|
||||
var subItems = item.SubItems.OfType<ListViewSubItem>().ToArray();
|
||||
form.UseUpdateMode(item, subItems[1].Text, subItems[2].Text, subItems[3].Text, subItems[4].Text, subItems[5].Text);
|
||||
|
||||
if (int.TryParse(subItems[3].Text, out var listenPort) && 0 < listenPort && listenPort < 65536)
|
||||
{
|
||||
form.UseUpdateMode(item, subItems[1].Text, subItems[2].Text, listenPort, subItems[4].Text, subItems[5].Text);
|
||||
}
|
||||
else MessageBox.Show("无效端口号。", "无效端口号", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
|
||||
public void RefreshProxyList()
|
||||
|
@ -110,13 +115,13 @@ namespace PortProxyGUI
|
|||
case ToolStripMenuItem item when item == toolStripMenuItem_New:
|
||||
if (SetProxyForm == null) SetProxyForm = new SetProxyForm(this);
|
||||
SetProxyForm.UseNormalMode();
|
||||
SetProxyForm.Show();
|
||||
SetProxyForm.ShowDialog();
|
||||
break;
|
||||
|
||||
case ToolStripMenuItem item when item == toolStripMenuItem_Modify:
|
||||
if (SetProxyForm == null) SetProxyForm = new SetProxyForm(this);
|
||||
SetProxyForUpdate(SetProxyForm);
|
||||
SetProxyForm.Show();
|
||||
SetProxyForm.ShowDialog();
|
||||
break;
|
||||
|
||||
case ToolStripMenuItem item when item == toolStripMenuItem_Refresh:
|
||||
|
@ -158,7 +163,7 @@ namespace PortProxyGUI
|
|||
{
|
||||
if (SetProxyForm == null) SetProxyForm = new SetProxyForm(this);
|
||||
SetProxyForUpdate(SetProxyForm);
|
||||
SetProxyForm.Show();
|
||||
SetProxyForm.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<PackageTags>portproxy TCP/IP redirector</PackageTags>
|
||||
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
|
||||
<Copyright>Copyright © nstandard.net 2020</Copyright>
|
||||
<Version>1.1.0</Version>
|
||||
<Version>1.1.1</Version>
|
||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -8,22 +8,30 @@ namespace PortProxyGUI
|
|||
{
|
||||
public partial class SetProxyForm : Form
|
||||
{
|
||||
public readonly PortProxyGUI PortProxyGUI;
|
||||
public readonly PortProxyGUI ParentWindow;
|
||||
private string AutoTypeString { get; }
|
||||
private ListViewItem _updateLiveViewItem;
|
||||
|
||||
public SetProxyForm(PortProxyGUI portProxyGUI)
|
||||
private bool _updateMode;
|
||||
private ListViewItem _updateLiveViewItem;
|
||||
private string _oldType;
|
||||
private string _oldListenOn;
|
||||
private int _oldListenPort;
|
||||
|
||||
public SetProxyForm(PortProxyGUI parent)
|
||||
{
|
||||
PortProxyGUI = portProxyGUI;
|
||||
ParentWindow = parent;
|
||||
InitializeComponent();
|
||||
AutoTypeString = comboBox_type.Text = comboBox_type.Items.OfType<string>().First();
|
||||
}
|
||||
|
||||
public void UseNormalMode()
|
||||
{
|
||||
comboBox_type.Enabled = true;
|
||||
textBox_listenOn.Enabled = true;
|
||||
textBox_listenPort.Enabled = true;
|
||||
_updateMode = false;
|
||||
_updateLiveViewItem = null;
|
||||
_oldType = null;
|
||||
_oldListenOn = null;
|
||||
_oldListenPort = 0;
|
||||
|
||||
comboBox_type.Text = AutoTypeString;
|
||||
textBox_listenOn.Text = "*";
|
||||
textBox_listenPort.Text = "";
|
||||
|
@ -31,15 +39,17 @@ namespace PortProxyGUI
|
|||
textBox_connectPort.Text = "";
|
||||
}
|
||||
|
||||
public void UseUpdateMode(ListViewItem item, string type, string listenOn, string listenPort, string connectTo, string connectPort)
|
||||
public void UseUpdateMode(ListViewItem item, string type, string listenOn, int listenPort, string connectTo, string connectPort)
|
||||
{
|
||||
_updateMode = true;
|
||||
_updateLiveViewItem = item;
|
||||
comboBox_type.Enabled = false;
|
||||
textBox_listenOn.Enabled = false;
|
||||
textBox_listenPort.Enabled = false;
|
||||
_oldType = type;
|
||||
_oldListenOn = listenOn.Trim().ToLower();
|
||||
_oldListenPort = listenPort;
|
||||
|
||||
comboBox_type.Text = type;
|
||||
textBox_listenOn.Text = listenOn;
|
||||
textBox_listenPort.Text = listenPort;
|
||||
textBox_listenOn.Text = listenOn.ToString();
|
||||
textBox_listenPort.Text = listenPort.ToString();
|
||||
textBox_connectTo.Text = connectTo;
|
||||
textBox_connectPort.Text = connectPort;
|
||||
}
|
||||
|
@ -84,13 +94,20 @@ namespace PortProxyGUI
|
|||
return;
|
||||
}
|
||||
|
||||
if (_updateLiveViewItem != null)
|
||||
if (_updateMode)
|
||||
{
|
||||
var rule = Program.SqliteDbScope.GetRule(type, listenOn, _listenPort);
|
||||
var rule = Program.SqliteDbScope.GetRule(_oldType, _oldListenOn, _oldListenPort);
|
||||
CmdUtil.DeleteProxy(_oldType, _oldListenOn, _oldListenPort);
|
||||
Program.SqliteDbScope.Remove(rule);
|
||||
|
||||
rule.Type = type;
|
||||
rule.ListenOn = listenOn;
|
||||
rule.ListenPort = _listenPort;
|
||||
rule.ConnectTo = connectTo;
|
||||
rule.ConnectPort = _connectPort;
|
||||
Program.SqliteDbScope.Update(rule);
|
||||
CmdUtil.AddProxy("set", type, listenOn, _listenPort, connectTo, _connectPort);
|
||||
|
||||
CmdUtil.AddProxy("add", type, listenOn, _listenPort, connectTo, _connectPort);
|
||||
Program.SqliteDbScope.Add(rule);
|
||||
|
||||
_updateLiveViewItem.ImageIndex = 1;
|
||||
var subItems = _updateLiveViewItem.SubItems;
|
||||
|
@ -103,7 +120,7 @@ namespace PortProxyGUI
|
|||
else
|
||||
{
|
||||
CmdUtil.AddProxy("add", type, listenOn, _listenPort, connectTo, _connectPort);
|
||||
PortProxyGUI.RefreshProxyList();
|
||||
ParentWindow.RefreshProxyList();
|
||||
}
|
||||
|
||||
Close();
|
||||
|
@ -111,13 +128,13 @@ namespace PortProxyGUI
|
|||
|
||||
private void SetProxyForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Top = PortProxyGUI.Top + (PortProxyGUI.Height - Height) / 2;
|
||||
Left = PortProxyGUI.Left + (PortProxyGUI.Width - Width) / 2;
|
||||
Top = ParentWindow.Top + (ParentWindow.Height - Height) / 2;
|
||||
Left = ParentWindow.Left + (ParentWindow.Width - Width) / 2;
|
||||
}
|
||||
|
||||
private void SetProxyForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
PortProxyGUI.SetProxyForm = null;
|
||||
ParentWindow.SetProxyForm = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue