rule add enabled

This commit is contained in:
2dust 2021-10-03 20:19:54 +08:00
parent 64e6d6d038
commit eac7361a0b
9 changed files with 547 additions and 493 deletions

View file

@ -31,6 +31,7 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RoutingRuleSettingDetailsForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RoutingRuleSettingDetailsForm));
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel();
this.chkEnabled = new System.Windows.Forms.CheckBox();
this.clbInboundTag = new System.Windows.Forms.CheckedListBox(); this.clbInboundTag = new System.Windows.Forms.CheckedListBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.clbProtocol = new System.Windows.Forms.CheckedListBox(); this.clbProtocol = new System.Windows.Forms.CheckedListBox();
@ -62,6 +63,8 @@
// //
// panel3 // panel3
// //
resources.ApplyResources(this.panel3, "panel3");
this.panel3.Controls.Add(this.chkEnabled);
this.panel3.Controls.Add(this.clbInboundTag); this.panel3.Controls.Add(this.clbInboundTag);
this.panel3.Controls.Add(this.label2); this.panel3.Controls.Add(this.label2);
this.panel3.Controls.Add(this.clbProtocol); this.panel3.Controls.Add(this.clbProtocol);
@ -71,13 +74,18 @@
this.panel3.Controls.Add(this.labRoutingTips); this.panel3.Controls.Add(this.labRoutingTips);
this.panel3.Controls.Add(this.label4); this.panel3.Controls.Add(this.label4);
this.panel3.Controls.Add(this.cmbOutboundTag); this.panel3.Controls.Add(this.cmbOutboundTag);
resources.ApplyResources(this.panel3, "panel3");
this.panel3.Name = "panel3"; this.panel3.Name = "panel3";
// //
// chkEnabled
//
resources.ApplyResources(this.chkEnabled, "chkEnabled");
this.chkEnabled.Name = "chkEnabled";
this.chkEnabled.UseVisualStyleBackColor = true;
//
// clbInboundTag // clbInboundTag
// //
this.clbInboundTag.CheckOnClick = true;
resources.ApplyResources(this.clbInboundTag, "clbInboundTag"); resources.ApplyResources(this.clbInboundTag, "clbInboundTag");
this.clbInboundTag.CheckOnClick = true;
this.clbInboundTag.FormattingEnabled = true; this.clbInboundTag.FormattingEnabled = true;
this.clbInboundTag.Items.AddRange(new object[] { this.clbInboundTag.Items.AddRange(new object[] {
resources.GetString("clbInboundTag.Items"), resources.GetString("clbInboundTag.Items"),
@ -92,8 +100,8 @@
// //
// clbProtocol // clbProtocol
// //
this.clbProtocol.CheckOnClick = true;
resources.ApplyResources(this.clbProtocol, "clbProtocol"); resources.ApplyResources(this.clbProtocol, "clbProtocol");
this.clbProtocol.CheckOnClick = true;
this.clbProtocol.FormattingEnabled = true; this.clbProtocol.FormattingEnabled = true;
this.clbProtocol.Items.AddRange(new object[] { this.clbProtocol.Items.AddRange(new object[] {
resources.GetString("clbProtocol.Items"), resources.GetString("clbProtocol.Items"),
@ -119,8 +127,8 @@
// //
// labRoutingTips // labRoutingTips
// //
this.labRoutingTips.ForeColor = System.Drawing.Color.Brown;
resources.ApplyResources(this.labRoutingTips, "labRoutingTips"); resources.ApplyResources(this.labRoutingTips, "labRoutingTips");
this.labRoutingTips.ForeColor = System.Drawing.Color.Brown;
this.labRoutingTips.Name = "labRoutingTips"; this.labRoutingTips.Name = "labRoutingTips";
// //
// label4 // label4
@ -130,26 +138,26 @@
// //
// cmbOutboundTag // cmbOutboundTag
// //
resources.ApplyResources(this.cmbOutboundTag, "cmbOutboundTag");
this.cmbOutboundTag.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbOutboundTag.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbOutboundTag.FormattingEnabled = true; this.cmbOutboundTag.FormattingEnabled = true;
this.cmbOutboundTag.Items.AddRange(new object[] { this.cmbOutboundTag.Items.AddRange(new object[] {
resources.GetString("cmbOutboundTag.Items"), resources.GetString("cmbOutboundTag.Items"),
resources.GetString("cmbOutboundTag.Items1"), resources.GetString("cmbOutboundTag.Items1"),
resources.GetString("cmbOutboundTag.Items2")}); resources.GetString("cmbOutboundTag.Items2")});
resources.ApplyResources(this.cmbOutboundTag, "cmbOutboundTag");
this.cmbOutboundTag.Name = "cmbOutboundTag"; this.cmbOutboundTag.Name = "cmbOutboundTag";
// //
// panel4 // panel4
// //
resources.ApplyResources(this.panel4, "panel4");
this.panel4.Controls.Add(this.btnClose); this.panel4.Controls.Add(this.btnClose);
this.panel4.Controls.Add(this.btnOK); this.panel4.Controls.Add(this.btnOK);
resources.ApplyResources(this.panel4, "panel4");
this.panel4.Name = "panel4"; this.panel4.Name = "panel4";
// //
// btnClose // btnClose
// //
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.btnClose, "btnClose"); resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnClose.Name = "btnClose"; this.btnClose.Name = "btnClose";
this.btnClose.UseVisualStyleBackColor = true; this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click); this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
@ -163,15 +171,15 @@
// //
// panel2 // panel2
// //
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Controls.Add(this.groupBox2); this.panel2.Controls.Add(this.groupBox2);
this.panel2.Controls.Add(this.groupBox1); this.panel2.Controls.Add(this.groupBox1);
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Name = "panel2"; this.panel2.Name = "panel2";
// //
// groupBox2 // groupBox2
// //
this.groupBox2.Controls.Add(this.txtIP);
resources.ApplyResources(this.groupBox2, "groupBox2"); resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Controls.Add(this.txtIP);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
// //
@ -182,8 +190,8 @@
// //
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.txtDomain);
resources.ApplyResources(this.groupBox1, "groupBox1"); resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.txtDomain);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
// //
@ -236,5 +244,6 @@
private System.Windows.Forms.CheckedListBox clbProtocol; private System.Windows.Forms.CheckedListBox clbProtocol;
private System.Windows.Forms.CheckedListBox clbInboundTag; private System.Windows.Forms.CheckedListBox clbInboundTag;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox chkEnabled;
} }
} }

View file

@ -59,6 +59,7 @@ namespace v2rayN.Forms
} }
} }
rulesItem.protocol = protocol; rulesItem.protocol = protocol;
rulesItem.enabled = chkEnabled.Checked;
} }
} }
private void BindingData() private void BindingData()
@ -91,6 +92,7 @@ namespace v2rayN.Forms
} }
} }
} }
chkEnabled.Checked = rulesItem.enabled;
} }
} }
private void ClearBind() private void ClearBind()
@ -99,6 +101,7 @@ namespace v2rayN.Forms
cmbOutboundTag.Text = Global.agentTag; cmbOutboundTag.Text = Global.agentTag;
txtDomain.Text = string.Empty; txtDomain.Text = string.Empty;
txtIP.Text = string.Empty; txtIP.Text = string.Empty;
chkEnabled.Checked = true;
} }
private void btnOK_Click(object sender, EventArgs e) private void btnOK_Click(object sender, EventArgs e)
{ {

File diff suppressed because it is too large Load diff

View file

@ -118,6 +118,9 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.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> </resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.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="chkEnabled.Location" type="System.Drawing.Point, System.Drawing">
<value>670, 18</value>
</data>
<data name="clbInboundTag.Location" type="System.Drawing.Point, System.Drawing"> <data name="clbInboundTag.Location" type="System.Drawing.Point, System.Drawing">
<value>372, 16</value> <value>372, 16</value>
</data> </data>

View file

@ -55,12 +55,13 @@ namespace v2rayN.Forms
lvRoutings.HeaderStyle = ColumnHeaderStyle.Clickable; lvRoutings.HeaderStyle = ColumnHeaderStyle.Clickable;
lvRoutings.Columns.Add("", 30); lvRoutings.Columns.Add("", 30);
lvRoutings.Columns.Add("outboundTag", 100); lvRoutings.Columns.Add("outboundTag", 80);
lvRoutings.Columns.Add("port", 80); lvRoutings.Columns.Add("port", 80);
lvRoutings.Columns.Add("protocol", 100); lvRoutings.Columns.Add("protocol", 80);
lvRoutings.Columns.Add("inboundTag", 100); lvRoutings.Columns.Add("inboundTag", 80);
lvRoutings.Columns.Add("domain", 160); lvRoutings.Columns.Add("domain", 160);
lvRoutings.Columns.Add("ip", 160); lvRoutings.Columns.Add("ip", 160);
lvRoutings.Columns.Add("enable", 60);
lvRoutings.EndUpdate(); lvRoutings.EndUpdate();
} }
@ -81,6 +82,7 @@ namespace v2rayN.Forms
Utils.AddSubItem(lvItem, "inboundTag", Utils.List2String(item.inboundTag)); Utils.AddSubItem(lvItem, "inboundTag", Utils.List2String(item.inboundTag));
Utils.AddSubItem(lvItem, "domain", Utils.List2String(item.domain)); Utils.AddSubItem(lvItem, "domain", Utils.List2String(item.domain));
Utils.AddSubItem(lvItem, "ip", Utils.List2String(item.ip)); Utils.AddSubItem(lvItem, "ip", Utils.List2String(item.ip));
Utils.AddSubItem(lvItem, "enable", item.enabled.ToString());
if (lvItem != null) lvRoutings.Items.Add(lvItem); if (lvItem != null) lvRoutings.Items.Add(lvItem);
} }

View file

@ -51,7 +51,9 @@ namespace v2rayN.Handler
enableStatistics = false, enableStatistics = false,
// 默认中等刷新率 // 默认中等刷新率
statisticsFreshRate = (int)Global.StatisticsFreshRate.medium statisticsFreshRate = (int)Global.StatisticsFreshRate.medium,
enableRoutingAdvanced = true
}; };
} }

View file

@ -197,7 +197,10 @@ namespace v2rayN.Handler
{ {
foreach (var item in config.routings[config.routingIndex].rules) foreach (var item in config.routings[config.routingIndex].rules)
{ {
routingUserRule(item, ref v2rayConfig); if (item.enabled)
{
routingUserRule(item, ref v2rayConfig);
}
} }
} }
} }

View file

@ -20,6 +20,8 @@ namespace v2rayN.Mode
public List<string> protocol { get; set; } public List<string> protocol { get; set; }
public bool enabled { get; set; } = true;
} }
} }

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartArguments>C:\Githubb\v2rayN\v2rayN\新建ee 文件夹\bin\Debug\v2ray-windows.zip</StartArguments> <StartArguments>C:\Githubb\v2rayN\v2rayN\v2rayUpgrade\bin\Debug\v2ray-windows.zip</StartArguments>
</PropertyGroup> </PropertyGroup>
</Project> </Project>