private void _checkforLocalbridge1() { DataTable _bl1 = BridgeList.bridgeList(); Data.bridgelist = new List <string>(); // _bl1.Clear(); for (int i = 0; i <= _bl1.Rows.Count - 1; i++) { Data.bridgelist.Add(_bl1.Rows[i][2].ToString()); // comboBox1.Items.Add(Data.bridgelist[i]); <-----this was on seceond form } if (Data.bridgelist.Count > 1) { Data.bridgeExists = true; } else { Data.bridgeExists = false; } if (Data.bridgeExists) { AddLocalBridgeButton.Enabled = false; } ; if (!Data.bridgeExists) { AddLocalBridgeButton.Enabled = true; } ; return; }
public static void _returnEth() { BridgeList._lcl_bridge("p"); Data._lcl_bridge = Data._tmp; string patern = "[(ID=]+\\d+[)|]+[Operating]+g"; string repl = ""; Regex rgx = new System.Text.RegularExpressions.Regex(patern); string input = Data._lcl_bridge; string result1; string result2 = rgx.Replace(input, repl).Trim(); if (result2.Contains("|Operating")) { string result1a = result2.Replace("|Operating", "").Replace(" ", " ").Trim(); result1 = result1a; } else { result1 = result2; } var ip = "127.0.0.1"; ushort port = 5555; var pw = "pirkon12"; using (var softEther = new SoftEther(ip, port)) { var connectResult = softEther.Connect(); if (!connectResult.Valid()) { return; } var authResult = softEther.Authenticate(pw); if (!authResult.Valid()) { return; } var EthDev = softEther.ServerApi.GetEthernetDeviceList(); for (int i = 0; i < EthDev.Elements.Count; i++) { if (EthDev.Elements[i].DeviceName.Contains(result1)) { Data._bridgeWindowsname = EthDev.Elements[i].NetworkConnectionName; } } return; } }
private void AddLocalBridgeButton_Click(object sender, EventArgs e) { _cmd _fr = new _cmd(); string _esc = "\"" + L_LocalBridgeBox.Text + "\""; // _fr.Execmd("localhost:5555", "server", " /Password:pirkon12","BridgeDelete", "Bridge /Device:" + "\"" + L_LocalBridgeBox.Text + "\""); _fr.Execmd("localhost:5555", "server", " BridgeCreate", " Bridge /Device:" + "\"" + L_LocalBridgeBox.Text + "\"", " /Password:pirkon12"); MessageBox.Show("Local Bridge Added."); BridgeList.bridgeList(); AvailableInterfaces.Items.Clear(); AvailableInterfaces.SelectedItems.Clear(); for (int i = 0; i < AvailableInterfaces.CheckedItems.Count; i++) { AvailableInterfaces.SetItemChecked(AvailableInterfaces.CheckedIndices[i], false); } // AvailableInterfaces.SetItemChecked(AvailableInterfaces.CheckedIndices[0], false); _LocalBridge(); }
public static void _brdgeNicName() { BridgeList._lcl_bridge("p"); Data._lcl_bridge = Data._tmp; //string nic_Descr = string.Empty; string patern = "[(ID=]+\\d+[)|]+[Operating]+g"; string repl = ""; Regex rgx = new System.Text.RegularExpressions.Regex(patern); string input = Data._lcl_bridge; string result1 = rgx.Replace(input, repl).Trim(); if (result1.Contains("(2)")) { string relult3 = ReplaceLastOccurance(result1, "(2)", "#2"); result = relult3; Data.netnamefound = true; } else { _returnEth(); Data.netnamefound = true; return; } // Console.WriteLine(result); NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface adapter in interfaces) { string _rt1 = adapter.Description.Trim(); // string _rt2 = adapter.Id.Trim(); ; if (_rt1 == result.Trim()) { Data._bridgeWindowsname = adapter.Name.ToString(); Data._localBridgeDHCPflag = adapter.GetIPProperties().GetIPv4Properties().IsDhcpEnabled; } } return; }
private void _checkforLocalbridge() { DataTable _bl1 = BridgeList.bridgeList(); Data.bridgelist = new List <string>(); for (int i = 0; i <= _bl1.Rows.Count - 1; i++) { Data.bridgelist.Add(_bl1.Rows[i][2].ToString()); // comboBox1.Items.Add(Data.bridgelist[i]); <-----this was on seceond form } if (Data.bridgelist.Count > 1) { Data.bridgeExists = true; NetworkConnection.Text = Data._bridgeWindowsname; return; } else { Data.bridgeExists = false; } }