static void Main(string[] args) { Console.WriteLine(AssemblyTitle + " " + AssemblyVersion); Console.WriteLine(AssemblyCopyright); Console.WriteLine(); if (args.Length > 0 && args[0] == "/?") { Console.WriteLine("Usage: VirtualRouterHostConsole [SSID] [Passkey]"); return; } var virtualRouterHost = new softGetawayHost.softGetawayHost(); var serviceHost = new ServiceHost(virtualRouterHost); if(args.Length == 2) { var strSSID = args[0]; var strPassKey = args[1]; virtualRouterHost.SetPrivateConnectionSettings(new ConnectionSettings() { SSID = strSSID, MaxPeerCount = 100, Password = strPassKey }); Console.WriteLine("SSID: " + strSSID); Console.WriteLine("Passkey: " + strPassKey); Console.WriteLine(); } var conns = virtualRouterHost.GetSharableConnections(); var connToShare = conns.FirstOrDefault(); virtualRouterHost.Start(connToShare.Guid); { Console.WriteLine("ERROR: Virtual Router could not be started. Supported hardware may not have been found."); Console.WriteLine(); } Console.WriteLine("Starting Service..."); if (serviceHost.State != CommunicationState.Opened) { serviceHost.Open(); } Console.WriteLine(); Console.WriteLine("Virtual Router Service Running... [Press Enter To Stop]"); Console.ReadLine(); serviceHost.Close(); virtualRouterHost.Stop(); Console.WriteLine("Virtual Router Service Stopped."); }
internal void startUp() { if (this.serviceHost != null) { this.serviceHost.Close(); } this.softGetawayHost = new softGetawayHost.softGetawayHost(); this.serviceHost = new ServiceHost(this.softGetawayHost); if (this.serviceHost.State != CommunicationState.Opened) { this.serviceHost.Open(); } }
static void Main(string[] args) { Console.WriteLine(AssemblyTitle + " " + AssemblyVersion); Console.WriteLine(AssemblyCopyright); Console.WriteLine(); if (args.Length > 0 && args[0] == "/?") { Console.WriteLine("Usage: VirtualRouterHostConsole [SSID] [Passkey]"); return; } var virtualRouterHost = new softGetawayHost.softGetawayHost(); var serviceHost = new ServiceHost(virtualRouterHost); if (args.Length == 2) { var strSSID = args[0]; var strPassKey = args[1]; virtualRouterHost.SetPrivateConnectionSettings(new ConnectionSettings() { SSID = strSSID, MaxPeerCount = 100, Password = strPassKey }); Console.WriteLine("SSID: " + strSSID); Console.WriteLine("Passkey: " + strPassKey); Console.WriteLine(); } var conns = virtualRouterHost.GetSharableConnections(); var connToShare = conns.FirstOrDefault(); virtualRouterHost.Start(connToShare.Guid); { Console.WriteLine("ERROR: Virtual Router could not be started. Supported hardware may not have been found."); Console.WriteLine(); } Console.WriteLine("Starting Service..."); if (serviceHost.State != CommunicationState.Opened) { serviceHost.Open(); } Console.WriteLine(); Console.WriteLine("Virtual Router Service Running... [Press Enter To Stop]"); Console.ReadLine(); serviceHost.Close(); virtualRouterHost.Stop(); Console.WriteLine("Virtual Router Service Stopped."); }