diff --git a/FWManager.cs b/FWManager.cs index 1cd2337..770be4f 100644 --- a/FWManager.cs +++ b/FWManager.cs @@ -60,7 +60,7 @@ public void blockLOL() var str = RunAction("advfirewall firewall show rule name=all"); - if (str.Contains("LeftSpace_LolOfflineMode")) + if (str.Contains("LeftSpace_LolOfflineMode"+ chat_dom)) { LDebug.WriteLine("Chat endpoint already blocked"); @@ -69,12 +69,12 @@ public void blockLOL() } - string strCmdText = $"advfirewall firewall add rule name=\"LeftSpace_LolOfflineMode\" dir=out remoteip={chat_ip} protocol=any action=block"; + string strCmdText = $"advfirewall firewall add rule name=\"LeftSpace_LolOfflineMode{chat_dom}\" dir=out remoteip={chat_ip} protocol=any action=block"; RunAction(strCmdText); } public void unblockLOL() { - string strCmdText = $"advfirewall firewall delete rule name=\"LeftSpace_LolOfflineMode\""; + string strCmdText = $"advfirewall firewall delete rule name=\"LeftSpace_LolOfflineMode{chat_dom}\""; RunAction(strCmdText); } diff --git a/LSLolOffline.Designer.cs b/LSLolOffline.Designer.cs index 3e206db..2b33382 100644 --- a/LSLolOffline.Designer.cs +++ b/LSLolOffline.Designer.cs @@ -31,6 +31,7 @@ private void InitializeComponent() this.switchButton = new System.Windows.Forms.Button(); this.srvLabel = new System.Windows.Forms.Label(); this.srvbox = new System.Windows.Forms.ComboBox(); + this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // switchButton @@ -77,11 +78,22 @@ private void InitializeComponent() this.srvbox.TabIndex = 4; this.srvbox.SelectedIndexChanged += new System.EventHandler(this.srvbox_SelectedIndexChanged); // + // button1 + // + this.button1.Location = new System.Drawing.Point(319, 12); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(82, 44); + this.button1.TabIndex = 5; + this.button1.Text = "Check"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // // LSLolOffline // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(325, 68); + this.ClientSize = new System.Drawing.Size(421, 68); + this.Controls.Add(this.button1); this.Controls.Add(this.srvbox); this.Controls.Add(this.srvLabel); this.Controls.Add(this.switchButton); @@ -100,6 +112,7 @@ private void InitializeComponent() private System.Windows.Forms.Button switchButton; private System.Windows.Forms.Label srvLabel; private System.Windows.Forms.ComboBox srvbox; + private System.Windows.Forms.Button button1; } } diff --git a/LSLolOffline.cs b/LSLolOffline.cs index 4215257..85e6e68 100644 --- a/LSLolOffline.cs +++ b/LSLolOffline.cs @@ -23,7 +23,8 @@ private void switchButton_Click(object sender, EventArgs e) { try { - + Globals.fw.chat_dom = srvbox.Items[srvbox.SelectedIndex].ToString(); + Globals.fw.chat_ip = Globals.lc.GetIPFromDomain(); var isBlocked = Globals.fw.isBlocked(); if (isBlocked) { @@ -85,14 +86,16 @@ private void UpdateState(bool isBlocked) private void srvbox_SelectedIndexChanged(object sender, EventArgs e) { - Globals.fw.chat_dom = srvbox.Items[srvbox.SelectedIndex].ToString(); + + } + private void button1_Click(object sender, EventArgs e) + { + Globals.fw.chat_dom = srvbox.Items[srvbox.SelectedIndex].ToString(); + Globals.fw.chat_ip = Globals.lc.GetIPFromDomain(); var isBlocked = Globals.fw.isBlocked(); srvLabel.Focus(); UpdateState(isBlocked); - - - } } }