using System; using System.Net.NetworkInformation; using sharpknife.Tools; namespace sharpknife.Commands { class SetProxyCommand : Command { public override void Execute() { base.Execute(); bool home = true; foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) { IPInterfaceProperties ipProps = nic.GetIPProperties(); Debug = nic.Name; if (ipProps.DnsSuffix == "simgroup.lan") { home = false; break; } } if (home) { if (Proxy.IsProxy()) { Proxy.UnsetProxy(); Debug = "Proxy unset"; TrayIcon.GetTrayIcon().Message("Proxy unset"); } } else { if (!Proxy.IsProxy()) { Proxy.SetProxy("metisa07:8080"); Debug = "Proxy set"; TrayIcon.GetTrayIcon().Message("Proxy set"); } } Status = StatusCode.Waiting; NextExecution = DateTime.Now.AddSeconds(15); } } }