diff --git a/v2rayN/v2rayN/Forms/MainForm.Designer.cs b/v2rayN/v2rayN/Forms/MainForm.Designer.cs index 93b3aedb02c..b69bff7e353 100644 --- a/v2rayN/v2rayN/Forms/MainForm.Designer.cs +++ b/v2rayN/v2rayN/Forms/MainForm.Designer.cs @@ -84,6 +84,11 @@ private void InitializeComponent() this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.txtMsgBox = new System.Windows.Forms.TextBox(); + this.cmsMsgBox = new System.Windows.Forms.ContextMenuStrip(this.components); + this.menuMsgBoxSelectAll = new System.Windows.Forms.ToolStripMenuItem(); + this.menuMsgBoxCopy = new System.Windows.Forms.ToolStripMenuItem(); + this.menuMsgBoxCopyAll = new System.Windows.Forms.ToolStripMenuItem(); + this.menuMsgBoxAddRoutingRule = new System.Windows.Forms.ToolStripMenuItem(); this.ssMain = new System.Windows.Forms.StatusStrip(); this.toolSslSocksPortLab = new System.Windows.Forms.ToolStripStatusLabel(); this.toolSslSocksPort = new System.Windows.Forms.ToolStripStatusLabel(); @@ -130,6 +135,7 @@ private void InitializeComponent() this.cmsMain.SuspendLayout(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); + this.cmsMsgBox.SuspendLayout(); this.ssMain.SuspendLayout(); this.tsMain.SuspendLayout(); this.SuspendLayout(); @@ -208,6 +214,7 @@ private void InitializeComponent() this.menuExport2ShareUrl, this.menuExport2SubContent}); this.cmsLv.Name = "cmsLv"; + this.cmsLv.OwnerItem = this.tsbServer; // // menuAddVmessServer // @@ -525,9 +532,45 @@ private void InitializeComponent() resources.ApplyResources(this.txtMsgBox, "txtMsgBox"); this.txtMsgBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(41)))), ((int)(((byte)(49)))), ((int)(((byte)(52))))); this.txtMsgBox.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.txtMsgBox.ContextMenuStrip = this.cmsMsgBox; this.txtMsgBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(226)))), ((int)(((byte)(228))))); this.txtMsgBox.Name = "txtMsgBox"; this.txtMsgBox.ReadOnly = true; + this.txtMsgBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtMsgBox_KeyDown); + // + // cmsMsgBox + // + resources.ApplyResources(this.cmsMsgBox, "cmsMsgBox"); + this.cmsMsgBox.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuMsgBoxSelectAll, + this.menuMsgBoxCopy, + this.menuMsgBoxCopyAll, + this.menuMsgBoxAddRoutingRule}); + this.cmsMsgBox.Name = "cmsMsgBox"; + // + // menuMsgBoxSelectAll + // + resources.ApplyResources(this.menuMsgBoxSelectAll, "menuMsgBoxSelectAll"); + this.menuMsgBoxSelectAll.Name = "menuMsgBoxSelectAll"; + this.menuMsgBoxSelectAll.Click += new System.EventHandler(this.menuMsgBoxSelectAll_Click); + // + // menuMsgBoxCopy + // + resources.ApplyResources(this.menuMsgBoxCopy, "menuMsgBoxCopy"); + this.menuMsgBoxCopy.Name = "menuMsgBoxCopy"; + this.menuMsgBoxCopy.Click += new System.EventHandler(this.menuMsgBoxCopy_Click); + // + // menuMsgBoxCopyAll + // + resources.ApplyResources(this.menuMsgBoxCopyAll, "menuMsgBoxCopyAll"); + this.menuMsgBoxCopyAll.Name = "menuMsgBoxCopyAll"; + this.menuMsgBoxCopyAll.Click += new System.EventHandler(this.menuMsgBoxCopyAll_Click); + // + // menuMsgBoxAddRoutingRule + // + resources.ApplyResources(this.menuMsgBoxAddRoutingRule, "menuMsgBoxAddRoutingRule"); + this.menuMsgBoxAddRoutingRule.Name = "menuMsgBoxAddRoutingRule"; + this.menuMsgBoxAddRoutingRule.Click += new System.EventHandler(this.menuMsgBoxAddRoutingRule_Click); // // ssMain // @@ -818,6 +861,7 @@ private void InitializeComponent() this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); + this.cmsMsgBox.ResumeLayout(false); this.ssMain.ResumeLayout(false); this.ssMain.PerformLayout(); this.tsMain.ResumeLayout(false); @@ -921,6 +965,11 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem menuClearServerStatistics; private System.Windows.Forms.ToolStripMenuItem menuRoutings; private System.Windows.Forms.ToolStripSeparator toolStripSeparator13; + private System.Windows.Forms.ContextMenuStrip cmsMsgBox; + private System.Windows.Forms.ToolStripMenuItem menuMsgBoxSelectAll; + private System.Windows.Forms.ToolStripMenuItem menuMsgBoxCopy; + private System.Windows.Forms.ToolStripMenuItem menuMsgBoxAddRoutingRule; + private System.Windows.Forms.ToolStripMenuItem menuMsgBoxCopyAll; } } diff --git a/v2rayN/v2rayN/Forms/MainForm.cs b/v2rayN/v2rayN/Forms/MainForm.cs index 5ef402c0f23..6b293a83e2b 100644 --- a/v2rayN/v2rayN/Forms/MainForm.cs +++ b/v2rayN/v2rayN/Forms/MainForm.cs @@ -1507,6 +1507,10 @@ private void RefreshRoutingsMenu() for (int k = 0; k < config.routings.Count; k++) { var item = config.routings[k]; + if (item.locked == true) + { + continue; + } string name = item.remarks; ToolStripMenuItem ts = new ToolStripMenuItem(name) @@ -1542,5 +1546,52 @@ private void ts_Routing_Click(object sender, EventArgs e) } #endregion + #region MsgBoxMenu + private void menuMsgBoxSelectAll_Click(object sender, EventArgs e) + { + this.txtMsgBox.Focus(); + this.txtMsgBox.SelectAll(); + } + + private void menuMsgBoxCopy_Click(object sender, EventArgs e) + { + var data = this.txtMsgBox.SelectedText.TrimEx(); + Utils.SetClipboardData(data); + } + + private void menuMsgBoxCopyAll_Click(object sender, EventArgs e) + { + var data = this.txtMsgBox.Text; + Utils.SetClipboardData(data); + } + private void menuMsgBoxAddRoutingRule_Click(object sender, EventArgs e) + { + menuMsgBoxCopy_Click(null, null); + tsbRoutingSetting_Click(null, null); + } + + private void txtMsgBox_KeyDown(object sender, KeyEventArgs e) + { + if (e.Control) + { + switch (e.KeyCode) + { + case Keys.A: + menuMsgBoxSelectAll_Click(null, null); + break; + case Keys.C: + menuMsgBoxCopy_Click(null, null); + break; + case Keys.V: + menuMsgBoxAddRoutingRule_Click(null, null); + break; + + } + } + + } + + #endregion + } } diff --git a/v2rayN/v2rayN/Forms/MainForm.resx b/v2rayN/v2rayN/Forms/MainForm.resx index 46211facea6..df1bd0d654d 100644 --- a/v2rayN/v2rayN/Forms/MainForm.resx +++ b/v2rayN/v2rayN/Forms/MainForm.resx @@ -140,7 +140,7 @@ Add [VLESS] server - 2 + 3 System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -176,6 +176,9 @@ System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 227, 22 + 语言-[中文简体] @@ -201,6 +204,9 @@ 355, 22 + + menuMoveDown + 99, 53 @@ -264,8 +270,8 @@ Share - - Subscriptions + + 227, 22 952, 327 @@ -273,6 +279,9 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Add Routing Rule (Ctrl+V) + 355, 22 @@ -288,9 +297,15 @@ System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Copy All + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 227, 22 + Export selected server for server configuration @@ -321,9 +336,6 @@ System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 356, 622 - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -345,6 +357,9 @@ 203, 22 + + menuMsgBoxCopy + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -387,7 +402,7 @@ Servers - 3 + 4 3, 17 @@ -416,8 +431,8 @@ menuAddCustomServer - - menuMoveDown + + txtMsgBox System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -425,8 +440,8 @@ Import bulk URL from clipboard - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 184, 6 Move to bottom (B) @@ -633,7 +648,7 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 4 + 5 System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -656,6 +671,9 @@ Help + + menuMsgBoxSelectAll + menuSelectAll @@ -695,6 +713,9 @@ menuRemoveDuplicateServer + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + BottomCenter @@ -729,10 +750,10 @@ 0, 66 - 5 + 6 - - tsbV2rayWebsite + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Server @@ -743,9 +764,6 @@ menuAddShadowsocksServer - - txtMsgBox - toolSslBlank4 @@ -800,6 +818,9 @@ 352, 6 + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -812,6 +833,12 @@ 1 + + tsbV2rayWebsite + + + cmsMsgBox + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -821,8 +848,8 @@ menuMoveTop - - tsbCheckUpdateCore + + Copy (Ctrl+C) @@ -841,6 +868,9 @@ ZW0uRHJhd2luZy5HcmFwaGljc1VuaXQBAAAAB3ZhbHVlX18ACAMAAAADAAAACw== + + menuMsgBoxAddRoutingRule + menuScanScreen @@ -928,6 +958,9 @@ System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Subscriptions + tsbQRCodeSwitch @@ -958,6 +991,9 @@ toolStripSeparator8 + + menuMsgBoxCopyAll + 89, 53 @@ -1027,6 +1063,9 @@ menuExit + + 227, 22 + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1057,6 +1096,9 @@ 2 + + Magenta + 4, 4, 4, 4 @@ -1090,6 +1132,9 @@ System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tsbCheckUpdateCore + menuSpeedServer @@ -1150,6 +1195,9 @@ 0, 0 + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + 355, 22 @@ -1189,6 +1237,9 @@ System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + $this @@ -1231,8 +1282,8 @@ 203, 22 - - 184, 6 + + 356, 622 0, 0 @@ -1255,6 +1306,9 @@ MiddleRight + + Select All (Ctrl+A) + tsbOptionSetting @@ -1273,8 +1327,8 @@ 64, 53 - - Magenta + + 228, 92 946, 26 @@ -1354,6 +1408,9 @@ System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + Magenta @@ -1451,8 +1508,8 @@ System.Windows.Forms.StatusStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 228, 18 + + 603, 17 zh-Hans @@ -1460,6 +1517,9 @@ True + + 228, 18 + 65 diff --git a/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx index 42204a5fa75..c4e9f00ccd1 100644 --- a/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx +++ b/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx @@ -292,6 +292,12 @@ 批量导出订阅内容至剪贴板(多选) + + 73, 53 + + + 服务器 + 301, 622 @@ -312,12 +318,6 @@ ZW0uRHJhd2luZy5HcmFwaGljc1VuaXQBAAAAB3ZhbHVlX18ACAMAAAADAAAACw== - - 73, 53 - - - 服务器 - 172, 22 @@ -385,11 +385,38 @@ 退出 - 196, 192 + 196, 170 服务器列表 + + 221, 22 + + + 全选 (Ctrl+A) + + + 221, 22 + + + 复制 (Ctrl+C) + + + 221, 22 + + + 复制所有 + + + 221, 22 + + + 快速添加路由规则 (Ctrl+V) + + + 222, 114 + 网速显示未启用 @@ -397,13 +424,13 @@ 信息 - 180, 22 + 124, 22 订阅设置 - 180, 22 + 124, 22 更新订阅 diff --git a/v2rayN/v2rayN/Forms/RoutingRuleQuicklyAddForm.Designer.cs b/v2rayN/v2rayN/Forms/RoutingRuleQuicklyAddForm.Designer.cs new file mode 100644 index 00000000000..b187f72525b --- /dev/null +++ b/v2rayN/v2rayN/Forms/RoutingRuleQuicklyAddForm.Designer.cs @@ -0,0 +1,170 @@ +namespace v2rayN.Forms +{ + partial class RoutingRuleQuicklyAddForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RoutingRuleQuicklyAddForm)); + this.panel1 = new System.Windows.Forms.Panel(); + this.panel3 = new System.Windows.Forms.Panel(); + this.label4 = new System.Windows.Forms.Label(); + this.cmbOutboundTag = new System.Windows.Forms.ComboBox(); + this.panel4 = new System.Windows.Forms.Panel(); + this.btnClose = new System.Windows.Forms.Button(); + this.btnOK = new System.Windows.Forms.Button(); + this.panel2 = new System.Windows.Forms.Panel(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.txtIP = new System.Windows.Forms.TextBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.txtDomain = new System.Windows.Forms.TextBox(); + this.panel3.SuspendLayout(); + this.panel4.SuspendLayout(); + this.panel2.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // panel1 + // + resources.ApplyResources(this.panel1, "panel1"); + this.panel1.Name = "panel1"; + // + // panel3 + // + resources.ApplyResources(this.panel3, "panel3"); + this.panel3.Controls.Add(this.label4); + this.panel3.Controls.Add(this.cmbOutboundTag); + this.panel3.Name = "panel3"; + // + // label4 + // + resources.ApplyResources(this.label4, "label4"); + this.label4.Name = "label4"; + // + // 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")}); + this.cmbOutboundTag.Name = "cmbOutboundTag"; + // + // panel4 + // + resources.ApplyResources(this.panel4, "panel4"); + this.panel4.Controls.Add(this.btnClose); + this.panel4.Controls.Add(this.btnOK); + this.panel4.Name = "panel4"; + // + // btnClose + // + resources.ApplyResources(this.btnClose, "btnClose"); + this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnClose.Name = "btnClose"; + this.btnClose.UseVisualStyleBackColor = true; + this.btnClose.Click += new System.EventHandler(this.btnClose_Click); + // + // btnOK + // + resources.ApplyResources(this.btnOK, "btnOK"); + this.btnOK.Name = "btnOK"; + this.btnOK.UseVisualStyleBackColor = true; + this.btnOK.Click += new System.EventHandler(this.btnOK_Click); + // + // panel2 + // + resources.ApplyResources(this.panel2, "panel2"); + this.panel2.Controls.Add(this.groupBox2); + this.panel2.Controls.Add(this.groupBox1); + this.panel2.Name = "panel2"; + // + // groupBox2 + // + resources.ApplyResources(this.groupBox2, "groupBox2"); + this.groupBox2.Controls.Add(this.txtIP); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.TabStop = false; + // + // txtIP + // + resources.ApplyResources(this.txtIP, "txtIP"); + this.txtIP.Name = "txtIP"; + // + // groupBox1 + // + resources.ApplyResources(this.groupBox1, "groupBox1"); + this.groupBox1.Controls.Add(this.txtDomain); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.TabStop = false; + // + // txtDomain + // + resources.ApplyResources(this.txtDomain, "txtDomain"); + this.txtDomain.Name = "txtDomain"; + // + // RoutingRuleQuicklyAddForm + // + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnClose; + this.Controls.Add(this.panel2); + this.Controls.Add(this.panel4); + this.Controls.Add(this.panel3); + this.Controls.Add(this.panel1); + this.Name = "RoutingRuleQuicklyAddForm"; + this.Load += new System.EventHandler(this.RoutingRuleQuicklyAddForm_Load); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + this.panel4.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.ComboBox cmbOutboundTag; + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.Button btnClose; + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TextBox txtDomain; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.TextBox txtIP; + } +} \ No newline at end of file diff --git a/v2rayN/v2rayN/Forms/RoutingRuleQuicklyAddForm.cs b/v2rayN/v2rayN/Forms/RoutingRuleQuicklyAddForm.cs new file mode 100644 index 00000000000..51f6d87b999 --- /dev/null +++ b/v2rayN/v2rayN/Forms/RoutingRuleQuicklyAddForm.cs @@ -0,0 +1,73 @@ +using System; +using System.Windows.Forms; +using v2rayN.Handler; +using v2rayN.Mode; + +namespace v2rayN.Forms +{ + public partial class RoutingRuleQuicklyAddForm : BaseForm + { + public string domain + { + get; set; + } + private RulesItem rulesItem; + + public RoutingRuleQuicklyAddForm() + { + InitializeComponent(); + } + + private void RoutingRuleQuicklyAddForm_Load(object sender, EventArgs e) + { + rulesItem = new RulesItem(); + ClearBind(); + } + + private void EndBindingData() + { + if (rulesItem != null) + { + rulesItem.outboundTag = cmbOutboundTag.Text; + rulesItem.domain = Utils.String2List(txtDomain.Text); + rulesItem.ip = Utils.String2List(txtIP.Text); + } + } + + private void ClearBind() + { + cmbOutboundTag.Text = Global.agentTag; + txtDomain.Text = domain; + } + private void btnOK_Click(object sender, EventArgs e) + { + EndBindingData(); + var hasRule = false; + if (rulesItem.domain != null && rulesItem.domain.Count > 0) + { + hasRule = true; + } + if (rulesItem.ip != null && rulesItem.ip.Count > 0) + { + hasRule = true; + } + if (!hasRule) + { + return; + } + if (ConfigHandler.InsertRoutingRuleItem(ref config, rulesItem) == 0) + { + this.DialogResult = DialogResult.OK; + } + else + { + UI.ShowWarning(UIRes.I18N("OperationFailed")); + } + } + + private void btnClose_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + } + } +} diff --git a/v2rayN/v2rayN/Forms/RoutingRuleQuicklyAddForm.resx b/v2rayN/v2rayN/Forms/RoutingRuleQuicklyAddForm.resx new file mode 100644 index 00000000000..b081d36dcb5 --- /dev/null +++ b/v2rayN/v2rayN/Forms/RoutingRuleQuicklyAddForm.resx @@ -0,0 +1,462 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + txtIP + + + + Fill + + + + 8 + + + + 119, 20 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Fill + + + 3, 17 + + + 220, 207 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 10 + + + btnOK + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + RoutingRuleQuicklyAddForm + + + $this + + + 0, 288 + + + Bottom + + + Fill + + + 32 + + + panel4 + + + proxy + + + Left + + + 24 + + + 75, 23 + + + 6, 12 + + + 506, 10 + + + 7 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 11 + + + panel1 + + + Domain + + + groupBox1 + + + 0, 10 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel3 + + + 31 + + + 1 + + + 506, 51 + + + Fill + + + txtDomain + + + panel3 + + + NoControl + + + 5 + + + Top + + + panel4 + + + IP + + + 280, 0 + + + 75, 23 + + + 3, 17 + + + label4 + + + outboundTag + + + btnClose + + + block + + + direct + + + 1 + + + 2 + + + 0 + + + 305, 25 + + + panel3 + + + Top + + + 0, 0 + + + 506, 227 + + + True + + + 3 + + + 280, 227 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 4 + + + 3 + + + NoControl + + + &OK + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + cmbOutboundTag + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 506, 60 + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 0 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + &Cancel + + + 226, 227 + + + 107, 16 + + + RoutingRuleQuicklyAddForm + + + NoControl + + + 0 + + + 1 + + + True + + + groupBox2 + + + 19, 20 + + + $this + + + 71, 12 + + + panel2 + + + groupBox2 + + + 4 + + + 0, 0 + + + panel4 + + + $this + + + groupBox1 + + + panel2 + + + 0, 61 + + + 0 + + + 1 + + + 274, 207 + + + 506, 348 + + + 25 + + + v2rayN.Forms.BaseForm, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + 0 + + + panel2 + + + $this + + + 398, 25 + + + True + + + 0 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + zh-Hans + + \ No newline at end of file diff --git a/v2rayN/v2rayN/Forms/RoutingRuleQuicklyAddForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/RoutingRuleQuicklyAddForm.zh-Hans.resx new file mode 100644 index 00000000000..ee735361585 --- /dev/null +++ b/v2rayN/v2rayN/Forms/RoutingRuleQuicklyAddForm.zh-Hans.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + OutboundTag + + + 取消(&C) + + + 确定(&O) + + + 快速添加路由规则 + + \ No newline at end of file diff --git a/v2rayN/v2rayN/Forms/RoutingRuleSettingDetailsForm.resx b/v2rayN/v2rayN/Forms/RoutingRuleSettingDetailsForm.resx index 9149d44a19c..f92d884b100 100644 --- a/v2rayN/v2rayN/Forms/RoutingRuleSettingDetailsForm.resx +++ b/v2rayN/v2rayN/Forms/RoutingRuleSettingDetailsForm.resx @@ -579,6 +579,9 @@ 0 + + zh-Hans + True diff --git a/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.Designer.cs b/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.Designer.cs index a0dbe65099a..f33f9cdd18a 100644 --- a/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.Designer.cs +++ b/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.Designer.cs @@ -155,6 +155,7 @@ private void InitializeComponent() this.menuMoveDown, this.menuMoveBottom}); this.cmsLv.Name = "cmsLv"; + this.cmsLv.OwnerItem = this.MenuItem1; // // menuAdd // diff --git a/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.cs b/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.cs index 2c708f4aa8b..3daed59a91a 100644 --- a/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.cs +++ b/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.cs @@ -194,7 +194,7 @@ private void menuAdd_Click(object sender, EventArgs e) fm.rulesItem = new RulesItem(); if (fm.ShowDialog() == DialogResult.OK) { - routingItem.rules.Add(fm.rulesItem); + routingItem.rules.Insert(0, fm.rulesItem); RefreshRoutingsView(); } } diff --git a/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.resx b/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.resx index 8063cbb9b3c..2d457319e02 100644 --- a/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.resx +++ b/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.resx @@ -150,9 +150,6 @@ 47, 12 - - Move to bottom (B) - Bottom @@ -225,9 +222,6 @@ 475, 17 - - 75, 23 - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -309,6 +303,9 @@ 5 + + menuImportRulesFromFile + Add @@ -369,9 +366,6 @@ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - btnClose - Up (U) @@ -381,15 +375,15 @@ btnOK + + 53, 12 + 47, 12 14 - - Import Rules - NoControl @@ -423,6 +417,9 @@ panel2 + + 4 + Move to top (T) @@ -438,6 +435,9 @@ 748, 356 + + 202, 22 + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w @@ -461,8 +461,8 @@ &OK - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + lvRoutings 247, 22 @@ -491,9 +491,6 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 0 - 644, 48 @@ -506,8 +503,8 @@ Export Selected Rules - - menuImportRulesFromFile + + Move to bottom (B) label3 @@ -539,6 +536,9 @@ System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Top + 3, 3, 3, 3 @@ -554,8 +554,8 @@ Select All (Ctrl+A) - - 53, 12 + + btnClose 6, 12 @@ -581,8 +581,11 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - lvRoutings + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 202, 22 @@ -605,14 +608,11 @@ 762, 575 - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Import Rules - - 202, 22 + + 75, 23 2 @@ -626,8 +626,8 @@ NoControl - - 4 + + 0 3 @@ -656,8 +656,8 @@ 0 - - Top + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 True @@ -665,9 +665,6 @@ 17, 17 - - zh-Hans - 139, 17 diff --git a/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.zh-Hans.resx index d81b8ff0d52..06ade53a3d1 100644 --- a/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.zh-Hans.resx +++ b/v2rayN/v2rayN/Forms/RoutingRuleSettingForm.zh-Hans.resx @@ -120,6 +120,9 @@ 取消(&C) + + 确定(&O) + 0, 613 @@ -127,12 +130,6 @@ 785, 60 - - 确定(&O) - - - 785, 109 - 29, 12 @@ -157,28 +154,8 @@ 别名 - - 197, 186 - - - - AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w - LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkMAwAAAFFTeXN0 - ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2Vu - PWIwM2Y1ZjdmMTFkNTBhM2EFAQAAACFTeXN0ZW0uV2luZG93cy5Gb3Jtcy5MaXN0Vmlld0l0ZW0HAAAA - BFRleHQKSW1hZ2VJbmRleAlCYWNrQ29sb3IHQ2hlY2tlZARGb250CUZvcmVDb2xvchdVc2VJdGVtU3R5 - bGVGb3JTdWJJdGVtcwEABAAEBAAIFFN5c3RlbS5EcmF3aW5nLkNvbG9yAwAAAAETU3lzdGVtLkRyYXdp - bmcuRm9udAMAAAAUU3lzdGVtLkRyYXdpbmcuQ29sb3IDAAAAAQIAAAAGBAAAAAD/////Bfv///8UU3lz - dGVtLkRyYXdpbmcuQ29sb3IEAAAABG5hbWUFdmFsdWUKa25vd25Db2xvcgVzdGF0ZQEAAAAJBwcDAAAA - CgAAAAAAAAAAGAABAAAJBgAAAAH5////+////woAAAAAAAAAABoAAQABBQYAAAATU3lzdGVtLkRyYXdp - bmcuRm9udAQAAAAETmFtZQRTaXplBVN0eWxlBFVuaXQBAAQECxhTeXN0ZW0uRHJhd2luZy5Gb250U3R5 - bGUDAAAAG1N5c3RlbS5EcmF3aW5nLkdyYXBoaWNzVW5pdAMAAAADAAAABggAAAAG5a6L5L2TAAAQQQX3 - ////GFN5c3RlbS5EcmF3aW5nLkZvbnRTdHlsZQEAAAAHdmFsdWVfXwAIAwAAAAAAAAAF9v///xtTeXN0 - ZW0uRHJhd2luZy5HcmFwaGljc1VuaXQBAAAAB3ZhbHVlX18ACAMAAAADAAAACw== - - - - 771, 447 + + 785, 109 196, 22 @@ -237,11 +214,28 @@ 规则功能 - - 0, 134 + + 197, 186 - - 785, 479 + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkMAwAAAFFTeXN0 + ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2Vu + PWIwM2Y1ZjdmMTFkNTBhM2EFAQAAACFTeXN0ZW0uV2luZG93cy5Gb3Jtcy5MaXN0Vmlld0l0ZW0HAAAA + BFRleHQKSW1hZ2VJbmRleAlCYWNrQ29sb3IHQ2hlY2tlZARGb250CUZvcmVDb2xvchdVc2VJdGVtU3R5 + bGVGb3JTdWJJdGVtcwEABAAEBAAIFFN5c3RlbS5EcmF3aW5nLkNvbG9yAwAAAAETU3lzdGVtLkRyYXdp + bmcuRm9udAMAAAAUU3lzdGVtLkRyYXdpbmcuQ29sb3IDAAAAAQIAAAAGBAAAAAD/////Bfv///8UU3lz + dGVtLkRyYXdpbmcuQ29sb3IEAAAABG5hbWUFdmFsdWUKa25vd25Db2xvcgVzdGF0ZQEAAAAJBwcDAAAA + CgAAAAAAAAAAGAABAAAJBgAAAAH5////+////woAAAAAAAAAABoAAQABBQYAAAATU3lzdGVtLkRyYXdp + bmcuRm9udAQAAAAETmFtZQRTaXplBVN0eWxlBFVuaXQBAAQECxhTeXN0ZW0uRHJhd2luZy5Gb250U3R5 + bGUDAAAAG1N5c3RlbS5EcmF3aW5nLkdyYXBoaWNzVW5pdAMAAAADAAAABggAAAAG5a6L5L2TAAAQQQX3 + ////GFN5c3RlbS5EcmF3aW5nLkZvbnRTdHlsZQEAAAAHdmFsdWVfXwAIAwAAAAAAAAAF9v///xtTeXN0 + ZW0uRHJhd2luZy5HcmFwaGljc1VuaXQBAAAAB3ZhbHVlX18ACAMAAAADAAAACw== + + + + 771, 447 777, 453 @@ -249,14 +243,20 @@ 规则列表 + + 0, 134 + + + 785, 479 + - 184, 22 + 189, 22 从文件中导入规则 - 184, 22 + 189, 22 从剪贴板中导入规则 diff --git a/v2rayN/v2rayN/Forms/RoutingSettingForm.Designer.cs b/v2rayN/v2rayN/Forms/RoutingSettingForm.Designer.cs index 417a8283c3b..513d218e61f 100644 --- a/v2rayN/v2rayN/Forms/RoutingSettingForm.Designer.cs +++ b/v2rayN/v2rayN/Forms/RoutingSettingForm.Designer.cs @@ -34,39 +34,70 @@ private void InitializeComponent() this.panel2 = new System.Windows.Forms.Panel(); this.btnOK = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); + this.labRoutingTips = new System.Windows.Forms.Label(); this.linkLabelRoutingDoc = new System.Windows.Forms.LinkLabel(); this.cmbdomainStrategy = new System.Windows.Forms.ComboBox(); - this.lvRoutings = new v2rayN.Base.ListViewFlickerFree(); this.cmsLv = new System.Windows.Forms.ContextMenuStrip(this.components); this.menuAdd = new System.Windows.Forms.ToolStripMenuItem(); this.menuRemove = new System.Windows.Forms.ToolStripMenuItem(); this.menuSelectAll = new System.Windows.Forms.ToolStripMenuItem(); this.menuSetDefaultRouting = new System.Windows.Forms.ToolStripMenuItem(); this.MenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.tabControl2 = new System.Windows.Forms.TabControl(); - this.tabPage2 = new System.Windows.Forms.TabPage(); this.menuServer = new System.Windows.Forms.MenuStrip(); + this.tabNormal = new System.Windows.Forms.TabControl(); + this.tabPageProxy = new System.Windows.Forms.TabPage(); + this.panel5 = new System.Windows.Forms.Panel(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.txtProxyIp = new System.Windows.Forms.TextBox(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.txtProxyDomain = new System.Windows.Forms.TextBox(); + this.tabPageDirect = new System.Windows.Forms.TabPage(); + this.panel4 = new System.Windows.Forms.Panel(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.txtDirectIp = new System.Windows.Forms.TextBox(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.txtDirectDomain = new System.Windows.Forms.TextBox(); + this.tabPageBlock = new System.Windows.Forms.TabPage(); + this.panel3 = new System.Windows.Forms.Panel(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.txtBlockIp = new System.Windows.Forms.TextBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.txtBlockDomain = new System.Windows.Forms.TextBox(); + this.tabPageRuleList = new System.Windows.Forms.TabPage(); + this.lvRoutings = new v2rayN.Base.ListViewFlickerFree(); this.panel2.SuspendLayout(); this.panel1.SuspendLayout(); this.cmsLv.SuspendLayout(); - this.tabControl2.SuspendLayout(); - this.tabPage2.SuspendLayout(); this.menuServer.SuspendLayout(); + this.tabNormal.SuspendLayout(); + this.tabPageProxy.SuspendLayout(); + this.panel5.SuspendLayout(); + this.groupBox5.SuspendLayout(); + this.groupBox6.SuspendLayout(); + this.tabPageDirect.SuspendLayout(); + this.panel4.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.tabPageBlock.SuspendLayout(); + this.panel3.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.tabPageRuleList.SuspendLayout(); this.SuspendLayout(); // // btnClose // - this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; resources.ApplyResources(this.btnClose, "btnClose"); + this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnClose.Name = "btnClose"; this.btnClose.UseVisualStyleBackColor = true; this.btnClose.Click += new System.EventHandler(this.btnClose_Click); // // panel2 // + resources.ApplyResources(this.panel2, "panel2"); this.panel2.Controls.Add(this.btnClose); this.panel2.Controls.Add(this.btnOK); - resources.ApplyResources(this.panel2, "panel2"); this.panel2.Name = "panel2"; // // btnOK @@ -78,11 +109,18 @@ private void InitializeComponent() // // panel1 // + resources.ApplyResources(this.panel1, "panel1"); + this.panel1.Controls.Add(this.labRoutingTips); this.panel1.Controls.Add(this.linkLabelRoutingDoc); this.panel1.Controls.Add(this.cmbdomainStrategy); - resources.ApplyResources(this.panel1, "panel1"); this.panel1.Name = "panel1"; // + // labRoutingTips + // + resources.ApplyResources(this.labRoutingTips, "labRoutingTips"); + this.labRoutingTips.ForeColor = System.Drawing.Color.Brown; + this.labRoutingTips.Name = "labRoutingTips"; + // // linkLabelRoutingDoc // resources.ApplyResources(this.linkLabelRoutingDoc, "linkLabelRoutingDoc"); @@ -92,33 +130,18 @@ private void InitializeComponent() // // cmbdomainStrategy // + resources.ApplyResources(this.cmbdomainStrategy, "cmbdomainStrategy"); this.cmbdomainStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbdomainStrategy.FormattingEnabled = true; this.cmbdomainStrategy.Items.AddRange(new object[] { resources.GetString("cmbdomainStrategy.Items"), resources.GetString("cmbdomainStrategy.Items1"), resources.GetString("cmbdomainStrategy.Items2")}); - resources.ApplyResources(this.cmbdomainStrategy, "cmbdomainStrategy"); this.cmbdomainStrategy.Name = "cmbdomainStrategy"; // - // lvRoutings - // - this.lvRoutings.ContextMenuStrip = this.cmsLv; - resources.ApplyResources(this.lvRoutings, "lvRoutings"); - this.lvRoutings.FullRowSelect = true; - this.lvRoutings.GridLines = true; - this.lvRoutings.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.lvRoutings.HideSelection = false; - this.lvRoutings.Items.AddRange(new System.Windows.Forms.ListViewItem[] { - ((System.Windows.Forms.ListViewItem)(resources.GetObject("lvRoutings.Items")))}); - this.lvRoutings.MultiSelect = false; - this.lvRoutings.Name = "lvRoutings"; - this.lvRoutings.UseCompatibleStateImageBehavior = false; - this.lvRoutings.View = System.Windows.Forms.View.Details; - this.lvRoutings.DoubleClick += new System.EventHandler(this.lvRoutings_DoubleClick); - // // cmsLv // + resources.ApplyResources(this.cmsLv, "cmsLv"); this.cmsLv.ImageScalingSize = new System.Drawing.Size(20, 20); this.cmsLv.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuAdd, @@ -127,65 +150,198 @@ private void InitializeComponent() this.menuSetDefaultRouting}); this.cmsLv.Name = "cmsLv"; this.cmsLv.OwnerItem = this.MenuItem1; - resources.ApplyResources(this.cmsLv, "cmsLv"); // // menuAdd // - this.menuAdd.Name = "menuAdd"; resources.ApplyResources(this.menuAdd, "menuAdd"); + this.menuAdd.Name = "menuAdd"; this.menuAdd.Click += new System.EventHandler(this.menuAdd_Click); // // menuRemove // - this.menuRemove.Name = "menuRemove"; resources.ApplyResources(this.menuRemove, "menuRemove"); + this.menuRemove.Name = "menuRemove"; this.menuRemove.Click += new System.EventHandler(this.menuRemove_Click); // // menuSelectAll // - this.menuSelectAll.Name = "menuSelectAll"; resources.ApplyResources(this.menuSelectAll, "menuSelectAll"); + this.menuSelectAll.Name = "menuSelectAll"; this.menuSelectAll.Click += new System.EventHandler(this.menuSelectAll_Click); // // menuSetDefaultRouting // - this.menuSetDefaultRouting.Name = "menuSetDefaultRouting"; resources.ApplyResources(this.menuSetDefaultRouting, "menuSetDefaultRouting"); + this.menuSetDefaultRouting.Name = "menuSetDefaultRouting"; this.menuSetDefaultRouting.Click += new System.EventHandler(this.menuSetDefaultRouting_Click); // // MenuItem1 // + resources.ApplyResources(this.MenuItem1, "MenuItem1"); this.MenuItem1.DropDown = this.cmsLv; this.MenuItem1.Name = "MenuItem1"; - resources.ApplyResources(this.MenuItem1, "MenuItem1"); - // - // tabControl2 - // - this.tabControl2.Controls.Add(this.tabPage2); - resources.ApplyResources(this.tabControl2, "tabControl2"); - this.tabControl2.Name = "tabControl2"; - this.tabControl2.SelectedIndex = 0; - // - // tabPage2 - // - this.tabPage2.Controls.Add(this.lvRoutings); - resources.ApplyResources(this.tabPage2, "tabPage2"); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.UseVisualStyleBackColor = true; // // menuServer // + resources.ApplyResources(this.menuServer, "menuServer"); this.menuServer.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.MenuItem1}); - resources.ApplyResources(this.menuServer, "menuServer"); this.menuServer.Name = "menuServer"; // + // tabNormal + // + resources.ApplyResources(this.tabNormal, "tabNormal"); + this.tabNormal.Controls.Add(this.tabPageProxy); + this.tabNormal.Controls.Add(this.tabPageDirect); + this.tabNormal.Controls.Add(this.tabPageBlock); + this.tabNormal.Controls.Add(this.tabPageRuleList); + this.tabNormal.Name = "tabNormal"; + this.tabNormal.SelectedIndex = 0; + this.tabNormal.Selecting += new System.Windows.Forms.TabControlCancelEventHandler(this.tabNormal_Selecting); + // + // tabPageProxy + // + resources.ApplyResources(this.tabPageProxy, "tabPageProxy"); + this.tabPageProxy.Controls.Add(this.panel5); + this.tabPageProxy.Name = "tabPageProxy"; + this.tabPageProxy.UseVisualStyleBackColor = true; + // + // panel5 + // + resources.ApplyResources(this.panel5, "panel5"); + this.panel5.Controls.Add(this.groupBox5); + this.panel5.Controls.Add(this.groupBox6); + this.panel5.Name = "panel5"; + // + // groupBox5 + // + resources.ApplyResources(this.groupBox5, "groupBox5"); + this.groupBox5.Controls.Add(this.txtProxyIp); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.TabStop = false; + // + // txtProxyIp + // + resources.ApplyResources(this.txtProxyIp, "txtProxyIp"); + this.txtProxyIp.Name = "txtProxyIp"; + // + // groupBox6 + // + resources.ApplyResources(this.groupBox6, "groupBox6"); + this.groupBox6.Controls.Add(this.txtProxyDomain); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.TabStop = false; + // + // txtProxyDomain + // + resources.ApplyResources(this.txtProxyDomain, "txtProxyDomain"); + this.txtProxyDomain.Name = "txtProxyDomain"; + // + // tabPageDirect + // + resources.ApplyResources(this.tabPageDirect, "tabPageDirect"); + this.tabPageDirect.Controls.Add(this.panel4); + this.tabPageDirect.Name = "tabPageDirect"; + this.tabPageDirect.UseVisualStyleBackColor = true; + // + // panel4 + // + resources.ApplyResources(this.panel4, "panel4"); + this.panel4.Controls.Add(this.groupBox3); + this.panel4.Controls.Add(this.groupBox4); + this.panel4.Name = "panel4"; + // + // groupBox3 + // + resources.ApplyResources(this.groupBox3, "groupBox3"); + this.groupBox3.Controls.Add(this.txtDirectIp); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.TabStop = false; + // + // txtDirectIp + // + resources.ApplyResources(this.txtDirectIp, "txtDirectIp"); + this.txtDirectIp.Name = "txtDirectIp"; + // + // groupBox4 + // + resources.ApplyResources(this.groupBox4, "groupBox4"); + this.groupBox4.Controls.Add(this.txtDirectDomain); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.TabStop = false; + // + // txtDirectDomain + // + resources.ApplyResources(this.txtDirectDomain, "txtDirectDomain"); + this.txtDirectDomain.Name = "txtDirectDomain"; + // + // tabPageBlock + // + resources.ApplyResources(this.tabPageBlock, "tabPageBlock"); + this.tabPageBlock.Controls.Add(this.panel3); + this.tabPageBlock.Name = "tabPageBlock"; + this.tabPageBlock.UseVisualStyleBackColor = true; + // + // panel3 + // + resources.ApplyResources(this.panel3, "panel3"); + this.panel3.Controls.Add(this.groupBox2); + this.panel3.Controls.Add(this.groupBox1); + this.panel3.Name = "panel3"; + // + // groupBox2 + // + resources.ApplyResources(this.groupBox2, "groupBox2"); + this.groupBox2.Controls.Add(this.txtBlockIp); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.TabStop = false; + // + // txtBlockIp + // + resources.ApplyResources(this.txtBlockIp, "txtBlockIp"); + this.txtBlockIp.Name = "txtBlockIp"; + // + // groupBox1 + // + resources.ApplyResources(this.groupBox1, "groupBox1"); + this.groupBox1.Controls.Add(this.txtBlockDomain); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.TabStop = false; + // + // txtBlockDomain + // + resources.ApplyResources(this.txtBlockDomain, "txtBlockDomain"); + this.txtBlockDomain.Name = "txtBlockDomain"; + // + // tabPageRuleList + // + resources.ApplyResources(this.tabPageRuleList, "tabPageRuleList"); + this.tabPageRuleList.Controls.Add(this.lvRoutings); + this.tabPageRuleList.Name = "tabPageRuleList"; + this.tabPageRuleList.UseVisualStyleBackColor = true; + // + // lvRoutings + // + resources.ApplyResources(this.lvRoutings, "lvRoutings"); + this.lvRoutings.ContextMenuStrip = this.cmsLv; + this.lvRoutings.FullRowSelect = true; + this.lvRoutings.GridLines = true; + this.lvRoutings.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.lvRoutings.HideSelection = false; + this.lvRoutings.Items.AddRange(new System.Windows.Forms.ListViewItem[] { + ((System.Windows.Forms.ListViewItem)(resources.GetObject("lvRoutings.Items")))}); + this.lvRoutings.MultiSelect = false; + this.lvRoutings.Name = "lvRoutings"; + this.lvRoutings.UseCompatibleStateImageBehavior = false; + this.lvRoutings.View = System.Windows.Forms.View.Details; + this.lvRoutings.DoubleClick += new System.EventHandler(this.lvRoutings_DoubleClick); + // // RoutingSettingForm // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.btnClose; - this.Controls.Add(this.tabControl2); + this.Controls.Add(this.tabNormal); this.Controls.Add(this.panel1); this.Controls.Add(this.panel2); this.Controls.Add(this.menuServer); @@ -196,10 +352,28 @@ private void InitializeComponent() this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.cmsLv.ResumeLayout(false); - this.tabControl2.ResumeLayout(false); - this.tabPage2.ResumeLayout(false); this.menuServer.ResumeLayout(false); this.menuServer.PerformLayout(); + this.tabNormal.ResumeLayout(false); + this.tabPageProxy.ResumeLayout(false); + this.panel5.ResumeLayout(false); + this.groupBox5.ResumeLayout(false); + this.groupBox5.PerformLayout(); + this.groupBox6.ResumeLayout(false); + this.groupBox6.PerformLayout(); + this.tabPageDirect.ResumeLayout(false); + this.panel4.ResumeLayout(false); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + this.tabPageBlock.ResumeLayout(false); + this.panel3.ResumeLayout(false); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.tabPageRuleList.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -212,9 +386,6 @@ private void InitializeComponent() private System.Windows.Forms.Panel panel1; private System.Windows.Forms.LinkLabel linkLabelRoutingDoc; private System.Windows.Forms.ComboBox cmbdomainStrategy; - private Base.ListViewFlickerFree lvRoutings; - private System.Windows.Forms.TabControl tabControl2; - private System.Windows.Forms.TabPage tabPage2; private System.Windows.Forms.ContextMenuStrip cmsLv; private System.Windows.Forms.ToolStripMenuItem menuRemove; private System.Windows.Forms.ToolStripMenuItem menuSelectAll; @@ -222,5 +393,27 @@ private void InitializeComponent() private System.Windows.Forms.MenuStrip menuServer; private System.Windows.Forms.ToolStripMenuItem MenuItem1; private System.Windows.Forms.ToolStripMenuItem menuSetDefaultRouting; + private System.Windows.Forms.TabControl tabNormal; + private System.Windows.Forms.TabPage tabPageProxy; + private System.Windows.Forms.TabPage tabPageDirect; + private System.Windows.Forms.TabPage tabPageBlock; + private System.Windows.Forms.Panel panel5; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.TextBox txtProxyIp; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.TextBox txtProxyDomain; + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.TextBox txtDirectIp; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.TextBox txtDirectDomain; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.TextBox txtBlockIp; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TextBox txtBlockDomain; + private System.Windows.Forms.TabPage tabPageRuleList; + private Base.ListViewFlickerFree lvRoutings; + private System.Windows.Forms.Label labRoutingTips; } } \ No newline at end of file diff --git a/v2rayN/v2rayN/Forms/RoutingSettingForm.cs b/v2rayN/v2rayN/Forms/RoutingSettingForm.cs index cd7ca2c437c..9066fb34921 100644 --- a/v2rayN/v2rayN/Forms/RoutingSettingForm.cs +++ b/v2rayN/v2rayN/Forms/RoutingSettingForm.cs @@ -10,6 +10,7 @@ namespace v2rayN.Forms public partial class RoutingSettingForm : BaseForm { private List lvSelecteds = new List(); + private RoutingItem lockedItem; public RoutingSettingForm() { InitializeComponent(); @@ -27,8 +28,77 @@ private void RoutingSettingForm_Load(object sender, EventArgs e) } InitRoutingsView(); RefreshRoutingsView(); + + BindingLockedData(); + + } + + + private void tabNormal_Selecting(object sender, TabControlCancelEventArgs e) + { + if (tabNormal.SelectedTab == tabPageRuleList) + { + MenuItem1.Enabled = true; + } + else + { + MenuItem1.Enabled = false; + } + } + private void btnOK_Click(object sender, EventArgs e) + { + config.domainStrategy = cmbdomainStrategy.Text; + EndBindingLockedData(); + + if (ConfigHandler.SaveRouting(ref config) == 0) + { + this.DialogResult = DialogResult.OK; + } + else + { + UI.ShowWarning(UIRes.I18N("OperationFailed")); + } + } + + private void btnClose_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + } + + + #region locked + private void BindingLockedData() + { + lockedItem = ConfigHandler.GetLockedRoutingItem(ref config); + if (lockedItem != null) + { + txtProxyDomain.Text = Utils.List2String(lockedItem.rules[0].domain, true); + txtProxyIp.Text = Utils.List2String(lockedItem.rules[0].ip, true); + + txtDirectDomain.Text = Utils.List2String(lockedItem.rules[1].domain, true); + txtDirectIp.Text = Utils.List2String(lockedItem.rules[1].ip, true); + + txtBlockDomain.Text = Utils.List2String(lockedItem.rules[2].domain, true); + txtBlockIp.Text = Utils.List2String(lockedItem.rules[2].ip, true); + } + } + private void EndBindingLockedData() + { + if (lockedItem != null) + { + lockedItem.rules[0].domain = Utils.String2List(txtProxyDomain.Text.TrimEx()); + lockedItem.rules[0].ip = Utils.String2List(txtProxyIp.Text.TrimEx()); + + lockedItem.rules[1].domain = Utils.String2List(txtDirectDomain.Text.TrimEx()); + lockedItem.rules[1].ip = Utils.String2List(txtDirectIp.Text.TrimEx()); + + lockedItem.rules[2].domain = Utils.String2List(txtBlockDomain.Text.TrimEx()); + lockedItem.rules[2].ip = Utils.String2List(txtBlockIp.Text.TrimEx()); + } } + #endregion + #region ListView private void InitRoutingsView() { lvRoutings.BeginUpdate(); @@ -42,8 +112,8 @@ private void InitRoutingsView() lvRoutings.Columns.Add("", 30); lvRoutings.Columns.Add(UIRes.I18N("LvAlias"), 200); - lvRoutings.Columns.Add(UIRes.I18N("LvUrl"), 240); lvRoutings.Columns.Add(UIRes.I18N("LvCount"), 60); + lvRoutings.Columns.Add(UIRes.I18N("LvUrl"), 240); lvRoutings.EndUpdate(); } @@ -55,42 +125,28 @@ private void RefreshRoutingsView() for (int k = 0; k < config.routings.Count; k++) { + var item = config.routings[k]; + if (item.locked == true) + { + continue; + } + string def = string.Empty; if (config.routingIndex.Equals(k)) { def = "√"; } - - var item = config.routings[k]; - + ListViewItem lvItem = new ListViewItem(def); Utils.AddSubItem(lvItem, "remarks", item.remarks); - Utils.AddSubItem(lvItem, "url", item.url); Utils.AddSubItem(lvItem, "count", item.rules.Count.ToString()); + Utils.AddSubItem(lvItem, "url", item.url); if (lvItem != null) lvRoutings.Items.Add(lvItem); } lvRoutings.EndUpdate(); } - private void btnOK_Click(object sender, EventArgs e) - { - config.domainStrategy = cmbdomainStrategy.Text; - - if (ConfigHandler.SaveRouting(ref config) == 0) - { - this.DialogResult = DialogResult.OK; - } - else - { - UI.ShowWarning(UIRes.I18N("OperationFailed")); - } - } - - private void btnClose_Click(object sender, EventArgs e) - { - this.DialogResult = DialogResult.Cancel; - } private void linkLabelRoutingDoc_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { @@ -137,6 +193,9 @@ private int GetLvSelectedIndex() } } + #endregion + + #region Edit function @@ -197,8 +256,9 @@ private int SetDefaultRouting(int index) } return 0; } - #endregion + #endregion + } } diff --git a/v2rayN/v2rayN/Forms/RoutingSettingForm.resx b/v2rayN/v2rayN/Forms/RoutingSettingForm.resx index ec736baefaf..8a7aaba4afa 100644 --- a/v2rayN/v2rayN/Forms/RoutingSettingForm.resx +++ b/v2rayN/v2rayN/Forms/RoutingSettingForm.resx @@ -117,378 +117,888 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - NoControl + + cmbdomainStrategy - - 568, 17 + + 839, 505 - - 75, 23 + + System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 4 + + + Fill - - &Cancel + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - btnClose + + tabPageRuleList - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 853, 25 - - panel2 + + Fill - + + 441, 485 + + + IP + + + 6, 12 + + 0 - + + 447, 505 + + + Bottom + + + Edit and Function + + + panel1 + + + tabPageProxy + + + panel1 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 3 + + + IPOnDemand + + + 0 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + 25 + + + 3, 17 + + + groupBox5 + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Left + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 392, 505 + + + 15 + + + txtProxyDomain + + + 6, 21 + + + groupBox6 + + + 853, 673 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + NoControl + + 3, 17 + + + MenuItem1 + + + Routing Settings + + + Fill + + + Remove selected + + + Fill + + + IP + + + 4.Pre-defined Rule Set List + + + Domain + + + 2 + 475, 17 - - 75, 23 + + Domain strategy + + + 1 + + + 447, 505 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabNormal + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 0 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 3, 3, 3, 3 + + + tabPageRuleList + + + tabPageBlock + + + 568, 17 + + + False + + + 194, 22 + + + panel5 + + + panel5 + + + 0, 0 + + + Fill + + + Domain + + + 853, 60 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 0, 25 + + + 0 + + + 4 + + + 386, 485 + + + menuServer + + + 1 + + + 120, 21 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel5 + + + System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 2 + + + 4, 22 + + + 845, 511 + + + panel2 + + + cmsLv + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 5 - - &OK + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - btnOK + + True + + + txtProxyIp + + + 845, 511 + + + 386, 485 + + + Add + + + 25 + + + True + + + groupBox3 + + + tabPageProxy + + + panel1 + + + True + + + v2rayN.Base.ListViewFlickerFree, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + 2 + + + labRoutingTips + + + 95, 12 + + + panel3 + + + 1 + + + RoutingSettingForm + + + 441, 485 + + + 1 + + + 0 + + + 0 + + + tabPageDirect + + + Fill + + + $this + + + 25 + + + 392, 505 + + + groupBox2 + + + 0 + + + panel4 + + + 4 + + + True + + + System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + groupBox4 + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 3, 3 + + + True + + + 195, 92 + + + btnOK + + + 3, 3, 3, 3 + + + 116, 17 + + + txtBlockIp + + + NoControl + + + 0 + + + 542, 16 + + + $this + + + True + + + Left + + + panel4 + + + 441, 485 + + + 0 + + + 3 + + + 386, 485 + + + 0, 0, 0, 0 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + IPIfNonMatch + + + 3, 17 + + + 853, 537 + + + 1 + + + 24 + + + Fill + + panel2 - + 1 - - Bottom + + tabPageBlock - - 0, 613 + + 16 - - 765, 60 + + 0, 0 - - 7 + + panel4 - - panel2 + + groupBox1 - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + panel3 + + + $this + + + tabNormal + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkMAwAAAFFTeXN0 + ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2Vu + PWIwM2Y1ZjdmMTFkNTBhM2EFAQAAACFTeXN0ZW0uV2luZG93cy5Gb3Jtcy5MaXN0Vmlld0l0ZW0HAAAA + BFRleHQKSW1hZ2VJbmRleAlCYWNrQ29sb3IHQ2hlY2tlZARGb250CUZvcmVDb2xvchdVc2VJdGVtU3R5 + bGVGb3JTdWJJdGVtcwEABAAEBAAIFFN5c3RlbS5EcmF3aW5nLkNvbG9yAwAAAAETU3lzdGVtLkRyYXdp + bmcuRm9udAMAAAAUU3lzdGVtLkRyYXdpbmcuQ29sb3IDAAAAAQIAAAAGBAAAAAD/////Bfv///8UU3lz + dGVtLkRyYXdpbmcuQ29sb3IEAAAABG5hbWUFdmFsdWUKa25vd25Db2xvcgVzdGF0ZQEAAAAJBwcDAAAA + CgAAAAAAAAAAGAABAAAJBgAAAAH5////+////woAAAAAAAAAABoAAQABBQYAAAATU3lzdGVtLkRyYXdp + bmcuRm9udAQAAAAETmFtZQRTaXplBVN0eWxlBFVuaXQBAAQECxhTeXN0ZW0uRHJhd2luZy5Gb250U3R5 + bGUDAAAAG1N5c3RlbS5EcmF3aW5nLkdyYXBoaWNzVW5pdAMAAAADAAAABggAAAAG5a6L5L2TAAAQQQX3 + ////GFN5c3RlbS5EcmF3aW5nLkZvbnRTdHlsZQEAAAAHdmFsdWVfXwAIAwAAAAAAAAAF9v///xtTeXN0 + ZW0uRHJhd2luZy5HcmFwaGljc1VuaXQBAAAAB3ZhbHVlX18ACAMAAAADAAAACw== + + + + 165, 20 + + + 4, 22 + + + groupBox4 + + + 0 + + + tabNormal + + + &OK + + + tabNormal + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Fill + + + 1 + + + btnClose + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this - - 3 + + 845, 511 + + + 3, 17 + + + 4 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel3 + + + 16 + + + menuSelectAll + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 1 + + + AsIs + + + panel2 + + + groupBox1 + + + 194, 22 + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 0 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 3.Block Domain or IP + + + NoControl + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 11 + + + groupBox2 + + + 12 + + + txtBlockDomain - + + 7 + + True - - NoControl + + v2rayN.Forms.BaseForm, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - 6, 21 + + 392, 0 - - 0, 0, 0, 0 + + 12 - - 95, 12 + + 845, 511 19 - - Domain strategy + + 0, 0 - - linkLabelRoutingDoc + + *Set the rules, separated by commas (,); The comma in the regular is replaced by <COMMA> - - System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + groupBox6 - - panel1 + + txtDirectDomain - + + 839, 505 + + + 0, 613 + + + 3 + + 0 - - AsIs + + tabPageDirect - - IPIfNonMatch + + 839, 505 - - IPOnDemand + + Set as active routing - - 116, 17 + + Domain - - 165, 20 + + Left - - 16 + + txtDirectIp - - cmbdomainStrategy + + 4 - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Select All (Ctrl+A) - - panel1 + + &Cancel - - 1 + + 392, 0 - - Top + + 839, 505 - - 0, 25 + + tabNormal - - 765, 51 + + 3, 3, 3, 3 - - 11 + + 15 - - panel1 + + 0 - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 3, 3, 3, 3 - - $this + + panel1 - - 2 + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 - - - 194, 22 + + 3, 17 - - Add + + menuSetDefaultRouting - - 194, 22 + + 3 - - Remove selected + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 194, 22 + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Select All (Ctrl+A) + + 0 - + 194, 22 - - Set as active routing + + 392, 0 - - 120, 21 + + 3 - - Edit and Function + + lvRoutings - - 195, 114 + + linkLabelRoutingDoc - - cmsLv + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 24 - - Fill + + 3 - - - AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w - LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkMAwAAAFFTeXN0 - ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2Vu - PWIwM2Y1ZjdmMTFkNTBhM2EFAQAAACFTeXN0ZW0uV2luZG93cy5Gb3Jtcy5MaXN0Vmlld0l0ZW0HAAAA - BFRleHQKSW1hZ2VJbmRleAlCYWNrQ29sb3IHQ2hlY2tlZARGb250CUZvcmVDb2xvchdVc2VJdGVtU3R5 - bGVGb3JTdWJJdGVtcwEABAAEBAAIFFN5c3RlbS5EcmF3aW5nLkNvbG9yAwAAAAETU3lzdGVtLkRyYXdp - bmcuRm9udAMAAAAUU3lzdGVtLkRyYXdpbmcuQ29sb3IDAAAAAQIAAAAGBAAAAAD/////Bfv///8UU3lz - dGVtLkRyYXdpbmcuQ29sb3IEAAAABG5hbWUFdmFsdWUKa25vd25Db2xvcgVzdGF0ZQEAAAAJBwcDAAAA - CgAAAAAAAAAAGAABAAAJBgAAAAH5////+////woAAAAAAAAAABoAAQABBQYAAAATU3lzdGVtLkRyYXdp - bmcuRm9udAQAAAAETmFtZQRTaXplBVN0eWxlBFVuaXQBAAQECxhTeXN0ZW0uRHJhd2luZy5Gb250U3R5 - bGUDAAAAG1N5c3RlbS5EcmF3aW5nLkdyYXBoaWNzVW5pdAMAAAADAAAABggAAAAG5a6L5L2TAAAQQQX3 - ////GFN5c3RlbS5EcmF3aW5nLkZvbnRTdHlsZQEAAAAHdmFsdWVfXwAIAwAAAAAAAAAF9v///xtTeXN0 - ZW0uRHJhd2luZy5HcmFwaGljc1VuaXQBAAAAB3ZhbHVlX18ACAMAAAADAAAACw== - + + 0 - - 3, 3 + + menuRemove - - 751, 505 + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 12 + + Fill - - lvRoutings + + NoControl - - v2rayN.Base.ListViewFlickerFree, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + 2.Direct Domain or IP - - tabPage2 + + 4, 22 - + 0 - - 4, 22 + + groupBox3 - - 3, 3, 3, 3 + + 12 - - 757, 511 + + 4, 22 - - 0 + + 3, 3 - - RuleSetList + + 392, 505 - - tabPage2 + + 194, 22 - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Fill - - tabControl2 + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 0 + + 75, 23 - + Fill - - 0, 76 + + Fill + + + 2 - - 765, 537 + + 0 - - 14 + + 1.Proxy Domain or IP - - tabControl2 + + groupBox5 - - System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 4 - - $this + + 24 - - 1 + + Fill - - 139, 17 - - + 0, 0 - - 765, 25 - - - 15 + + IP - - menuServer + + 75, 23 - - System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 3, 17 - - $this + + 0, 76 - - 4 + + 3, 3 - - True - - - 6, 12 + + 34 - - 765, 673 + + 447, 505 - - Routing Settings + + Fill menuAdd - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - menuRemove - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - menuSelectAll - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - menuSetDefaultRouting + + 3, 3 - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - MenuItem1 + + 299, 21 - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - RoutingSettingForm + + 853, 51 - - v2rayN.Forms.BaseForm, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + Top + + zh-Hans + + + True + + + 17, 17 + + + 139, 17 + \ No newline at end of file diff --git a/v2rayN/v2rayN/Forms/RoutingSettingForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/RoutingSettingForm.zh-Hans.resx index 3efb9922113..5c04397074a 100644 --- a/v2rayN/v2rayN/Forms/RoutingSettingForm.zh-Hans.resx +++ b/v2rayN/v2rayN/Forms/RoutingSettingForm.zh-Hans.resx @@ -125,10 +125,16 @@ - 0, 474 + 0, 545 - 726, 60 + 817, 60 + + + 518, 16 + + + *设置的路由规则,用逗号(,)分隔;正则中的逗号用<COMMA>替代 77, 12 @@ -137,7 +143,7 @@ 域名解析策略 - 726, 51 + 817, 51 148, 22 @@ -172,6 +178,72 @@ 149, 92 + + 817, 25 + + + 405, 417 + + + 411, 437 + + + 386, 417 + + + 392, 437 + + + 803, 437 + + + 809, 443 + + + 1.代理的Domain或IP + + + 405, 417 + + + 411, 437 + + + 386, 417 + + + 392, 437 + + + 803, 437 + + + 809, 443 + + + 2.直连的Domain或IP + + + 405, 417 + + + 411, 437 + + + 386, 417 + + + 392, 437 + + + 803, 437 + + + 809, 443 + + + 3.阻止的Domain或IP + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w @@ -190,22 +262,19 @@ - 712, 366 - - - 718, 372 + 803, 437 - - 路由规则集列表 + + 809, 443 - - 726, 398 + + 4.预定义规则集列表 - - 726, 25 + + 817, 469 - 726, 534 + 817, 605 路由设置 diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index 2287c34dec7..38b6d6233fe 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -1001,6 +1001,14 @@ public static int SaveRouting(ref Config config) foreach (var item in config.routings) { + } + //move locked item + int index = config.routings.FindIndex(it => it.locked == true); + if (index != -1) + { + var item = Utils.DeepCopy(config.routings[index]); + config.routings.RemoveAt(index); + config.routings.Add(item); } if (config.routingIndex >= config.routings.Count) { @@ -1151,32 +1159,43 @@ public static int InitBuiltinRouting(ref Config config) { config.routings = new List(); } - if (config.routings.Count > 0) + if (config.routings.Count <= 0) { - return 0; - } - config.routingIndex = 0; + //Bypass the mainland + var item2 = new RoutingItem(); + item2.remarks = "绕过大陆(Whitelist)"; + item2.url = string.Empty; + item2.rules = new List(); + string result2 = Utils.GetEmbedText(Global.CustomRoutingFileName + "white"); + AddBatchRoutingRules(ref item2, result2); + config.routings.Add(item2); - //Global - var item1 = new RoutingItem(); - item1.remarks = "全局(Global)"; - item1.url = string.Empty; - item1.rules = new List(); - string result = Utils.GetEmbedText(Global.CustomRoutingFileName + "global"); - AddBatchRoutingRules(ref item1, result); - config.routings.Add(item1); - - //Bypass the mainland - var item2 = new RoutingItem(); - item2.remarks = "绕过大陆(Whitelist)"; - item2.url = string.Empty; - item2.rules = new List(); - string result2 = Utils.GetEmbedText(Global.CustomRoutingFileName + "white"); - AddBatchRoutingRules(ref item2, result2); - config.routings.Add(item2); + config.routingIndex = 0; + } + + if (GetLockedRoutingItem(ref config) == null) + { + var item1 = new RoutingItem(); + item1.remarks = "locked"; + item1.url = string.Empty; + item1.rules = new List(); + item1.locked = true; + string result1 = Utils.GetEmbedText(Global.CustomRoutingFileName + "locked"); + AddBatchRoutingRules(ref item1, result1); + config.routings.Add(item1); + } - ToJsonFile(config); + SaveRouting(ref config); return 0; + } + + public static RoutingItem GetLockedRoutingItem(ref Config config) + { + if (config.routings == null) + { + return null; + } + return config.routings.Find(it => it.locked == true); } #endregion } diff --git a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs index 53a0b8c3bd2..3f2ba4170ab 100644 --- a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs @@ -190,6 +190,14 @@ private static int routing(Config config, ref V2rayConfig v2rayConfig) { v2rayConfig.routing.domainStrategy = config.domainStrategy; + var lockedItem = ConfigHandler.GetLockedRoutingItem(ref config); + if (lockedItem != null) + { + foreach (var item in lockedItem.rules) + { + routingUserRule(item, ref v2rayConfig); + } + } if (config.routings != null && config.routingIndex < config.routings.Count) { foreach (var item in config.routings[config.routingIndex].rules) diff --git a/v2rayN/v2rayN/Mode/RoutingItem.cs b/v2rayN/v2rayN/Mode/RoutingItem.cs index 544558ed555..2344e2278dd 100644 --- a/v2rayN/v2rayN/Mode/RoutingItem.cs +++ b/v2rayN/v2rayN/Mode/RoutingItem.cs @@ -23,5 +23,10 @@ public List rules } public bool enabled { get; set; } = true; + public bool locked + { + get; set; + } + } } diff --git a/v2rayN/v2rayN/Properties/AssemblyInfo.cs b/v2rayN/v2rayN/Properties/AssemblyInfo.cs index 01ee10301ec..d26a2167083 100644 --- a/v2rayN/v2rayN/Properties/AssemblyInfo.cs +++ b/v2rayN/v2rayN/Properties/AssemblyInfo.cs @@ -32,4 +32,4 @@ // 方法是按如下所示使用“*”: //[assembly: AssemblyVersion("1.0.*")] //[assembly: AssemblyVersion("1.0.0")] -[assembly: AssemblyFileVersion("4.8")] +[assembly: AssemblyFileVersion("4.9")] diff --git a/v2rayN/v2rayN/Sample/custom_routing_locked b/v2rayN/v2rayN/Sample/custom_routing_locked new file mode 100644 index 00000000000..b46361311e7 --- /dev/null +++ b/v2rayN/v2rayN/Sample/custom_routing_locked @@ -0,0 +1,21 @@ +[ + { + "domain": [ + "geosite:google" + ], + "outboundTag": "proxy" + }, + { + "outboundTag": "direct", + "domain": [ + "domain:example.com", + "domain:example2.com" + ] + }, + { + "outboundTag": "block", + "domain": [ + "geosite:category-ads-all" + ] + } +] \ No newline at end of file diff --git a/v2rayN/v2rayN/Sample/custom_routing_white b/v2rayN/v2rayN/Sample/custom_routing_white index 7ee814b3a85..61c483822c8 100644 --- a/v2rayN/v2rayN/Sample/custom_routing_white +++ b/v2rayN/v2rayN/Sample/custom_routing_white @@ -1,15 +1,23 @@ -[{ - "outboundTag": "block", - "domain": [ - "geosite:category-ads-all" - ] - }, - { - "outboundTag": "direct", - "domain": [ - "geosite:cn" - ] - }, +[ + { + "outboundTag": "direct", + "domain": [ + "domain:example.com", + "domain:example2.com" + ] + }, + { + "outboundTag": "block", + "domain": [ + "geosite:category-ads-all" + ] + }, + { + "outboundTag": "direct", + "domain": [ + "geosite:cn" + ] + }, { "outboundTag": "direct", "ip": [ @@ -17,8 +25,8 @@ "geoip:cn" ] }, - { - "port": "0-65535", - "outboundTag": "proxy" - } + { + "port": "0-65535", + "outboundTag": "proxy" + } ] \ No newline at end of file diff --git a/v2rayN/v2rayN/v2rayN.csproj b/v2rayN/v2rayN/v2rayN.csproj index c38e2c89869..2f87020d20a 100644 --- a/v2rayN/v2rayN/v2rayN.csproj +++ b/v2rayN/v2rayN/v2rayN.csproj @@ -388,6 +388,7 @@ +