public bool PrepAdapters() { bool reply1 = false; bool reply2 = false; foreach (var nic in IcsManager.GetIPv4EthernetAndWirelessInterfaces()) { if (nic.Id == AModel.Adapter1 || nic.Id == AModel.Adapter2) { if (nic.OperationalStatus == OperationalStatus.Up) { if (nic.Id == AModel.Adapter1) { reply1 = A1Finalize(nic.Name); } if (nic.Id == AModel.Adapter2) { reply2 = A2Finalize(nic.Name); } } else { reply1 = false; reply2 = false; } } } return(reply1 && reply2); }
private bool PrepNetworks() { bool reply1 = false; bool reply2 = false; bool reply = false; var someException = new System.Exception(); String SharedAdap = ""; foreach (var nic in IcsManager.GetIPv4EthernetAndWirelessInterfaces()) { if (nic.Id == AModel.Adapter1 || nic.Id == AModel.Adapter2) { if (nic.OperationalStatus == OperationalStatus.Up) { if (nic.Id == AModel.Adapter1) { reply1 = true; } if (nic.Id == AModel.Adapter2) { reply2 = true; } try { String netResp = IdToNetworkPrivatise(nic.Id); if (netResp == "No Network") { throw someException; } } catch { if (reply1) { reply1 = false; } if (reply2) { reply2 = false; } } } else { // this adapter is down???? } } else { //found Shared/Internet network if (nic.OperationalStatus == OperationalStatus.Up) { SharedAdap = nic.Id; } } } if (reply1 && reply2 && SharedAdap != "") { EnableICS(SharedAdap, AModel.Adapter1, true); } return(reply1 && reply2); }