public static void Main(string[] args) { string defaultGwIp = GetDefaultGatewayIp(); GetIpOfInternetInterface(defaultGwIp, out string myIP, out PhysicalAddress mac); System.Console.WriteLine(string.Format("Starting HueEmulation for IP {0}:{1}", myIP, mac.ToString())); System.Console.WriteLine(mac.ToString().ToUpper().Substring(0, 6) + "FFFE" + mac.ToString().ToUpper().Substring(6, 6)); ServiceController[] services = ServiceController.GetServices(); ////foreach (ServiceController service in services) ////{ //// System.Console.WriteLine(service.ServiceName + "==" + service.Status); ////} if (services.Where(x => x.ServiceName == "SSDPSRV").First().Status == ServiceControllerStatus.Running) { System.Console.ForegroundColor = ConsoleColor.Red; System.Console.WriteLine("Error: SSDP Service Running"); System.Console.ForegroundColor = ConsoleColor.Yellow; Environment.Exit(0); } SSDP.Start(myIP, mac); HTTP.Start(myIP, mac); }
//// --------------------------------------------------------------------- #region CONSTRUCTION /// <summary> /// Initializes a new instance of the <see cref="MainForm"/> class. /// </summary> public MainForm() { this.InitializeComponent(); this.ConfigureLogging(); this.ssdp = new SSDP(); this.ssdp.SynchronizationContext = SynchronizationContext.Current; this.ssdp.DeviceFoundCallback = this.OnDeviceFound; this.ssdp.DeviceRemovedCallback = this.OnDeviceRemoved; } // MainForm()