Domain and IP are automatically sorted when saving

This commit is contained in:
2dust 2022-04-18 18:57:56 +08:00
parent 9894aa053f
commit 1d4e5baafb
4 changed files with 572 additions and 521 deletions

View file

@ -42,6 +42,7 @@
this.label4 = new System.Windows.Forms.Label();
this.cmbOutboundTag = new System.Windows.Forms.ComboBox();
this.panel4 = new System.Windows.Forms.Panel();
this.chkAutoSort = new System.Windows.Forms.CheckBox();
this.btnClose = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel();
@ -63,7 +64,6 @@
//
// panel3
//
resources.ApplyResources(this.panel3, "panel3");
this.panel3.Controls.Add(this.chkEnabled);
this.panel3.Controls.Add(this.clbInboundTag);
this.panel3.Controls.Add(this.label2);
@ -74,6 +74,7 @@
this.panel3.Controls.Add(this.labRoutingTips);
this.panel3.Controls.Add(this.label4);
this.panel3.Controls.Add(this.cmbOutboundTag);
resources.ApplyResources(this.panel3, "panel3");
this.panel3.Name = "panel3";
//
// chkEnabled
@ -84,8 +85,8 @@
//
// clbInboundTag
//
resources.ApplyResources(this.clbInboundTag, "clbInboundTag");
this.clbInboundTag.CheckOnClick = true;
resources.ApplyResources(this.clbInboundTag, "clbInboundTag");
this.clbInboundTag.FormattingEnabled = true;
this.clbInboundTag.Items.AddRange(new object[] {
resources.GetString("clbInboundTag.Items"),
@ -100,8 +101,8 @@
//
// clbProtocol
//
resources.ApplyResources(this.clbProtocol, "clbProtocol");
this.clbProtocol.CheckOnClick = true;
resources.ApplyResources(this.clbProtocol, "clbProtocol");
this.clbProtocol.FormattingEnabled = true;
this.clbProtocol.Items.AddRange(new object[] {
resources.GetString("clbProtocol.Items"),
@ -127,8 +128,8 @@
//
// labRoutingTips
//
resources.ApplyResources(this.labRoutingTips, "labRoutingTips");
this.labRoutingTips.ForeColor = System.Drawing.Color.Brown;
resources.ApplyResources(this.labRoutingTips, "labRoutingTips");
this.labRoutingTips.Name = "labRoutingTips";
//
// label4
@ -138,26 +139,33 @@
//
// cmbOutboundTag
//
resources.ApplyResources(this.cmbOutboundTag, "cmbOutboundTag");
this.cmbOutboundTag.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbOutboundTag.FormattingEnabled = true;
this.cmbOutboundTag.Items.AddRange(new object[] {
resources.GetString("cmbOutboundTag.Items"),
resources.GetString("cmbOutboundTag.Items1"),
resources.GetString("cmbOutboundTag.Items2")});
resources.ApplyResources(this.cmbOutboundTag, "cmbOutboundTag");
this.cmbOutboundTag.Name = "cmbOutboundTag";
//
// panel4
//
resources.ApplyResources(this.panel4, "panel4");
this.panel4.Controls.Add(this.chkAutoSort);
this.panel4.Controls.Add(this.btnClose);
this.panel4.Controls.Add(this.btnOK);
resources.ApplyResources(this.panel4, "panel4");
this.panel4.Name = "panel4";
//
// chkAutoSort
//
resources.ApplyResources(this.chkAutoSort, "chkAutoSort");
this.chkAutoSort.Name = "chkAutoSort";
this.chkAutoSort.UseVisualStyleBackColor = true;
//
// btnClose
//
resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.Name = "btnClose";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
@ -171,15 +179,15 @@
//
// panel2
//
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Controls.Add(this.groupBox2);
this.panel2.Controls.Add(this.groupBox1);
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Name = "panel2";
//
// groupBox2
//
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Controls.Add(this.txtIP);
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false;
//
@ -190,8 +198,8 @@
//
// groupBox1
//
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.txtDomain);
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false;
//
@ -214,6 +222,7 @@
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.panel4.ResumeLayout(false);
this.panel4.PerformLayout();
this.panel2.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
@ -245,5 +254,6 @@
private System.Windows.Forms.CheckedListBox clbInboundTag;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox chkEnabled;
private System.Windows.Forms.CheckBox chkAutoSort;
}
}

View file

@ -48,8 +48,16 @@ namespace v2rayN.Forms
}
rulesItem.inboundTag = inboundTag;
rulesItem.outboundTag = cmbOutboundTag.Text;
rulesItem.domain = Utils.String2ListSorted(txtDomain.Text);
rulesItem.ip = Utils.String2ListSorted(txtIP.Text);
if (chkAutoSort.Checked)
{
rulesItem.domain = Utils.String2ListSorted(txtDomain.Text);
rulesItem.ip = Utils.String2ListSorted(txtIP.Text);
}
else
{
rulesItem.domain = Utils.String2List(txtDomain.Text);
rulesItem.ip = Utils.String2List(txtIP.Text);
}
var protocol = new List<string>();
for (int i = 0; i < clbProtocol.Items.Count; i++)

File diff suppressed because it is too large Load diff

View file

@ -170,4 +170,7 @@
<data name="$this.Text" xml:space="preserve">
<value>路由规则详情设置</value>
</data>
<data name="chkAutoSort.Text" xml:space="preserve">
<value>保存时Domain和IP自动排序</value>
</data>
</root>