public static void Main(string[] args) { string name = "Foobar Mirror"; ushort port = 3690; if (args.Length > 0) name = args[0]; if (args.Length > 1) port = UInt16.Parse (args[1]); server = new Server (name); server.Port = port; server.Start (); ServiceLocator locator = new ServiceLocator (); locator.Found += OnServiceFound; locator.Removed += OnServiceRemoved; locator.Start (); Console.WriteLine ("Press enter to quit"); Console.ReadLine (); foreach (Client client in clients) { client.Logout (); } locator.Stop (); server.Stop (); }
public static void Main(string[] args) { if (args.Length == 0) { ServiceLocator locator = new ServiceLocator (); locator.Found += OnServiceFound; locator.Removed += OnServiceRemoved; locator.Start (); } else { string host = args[0]; ushort port = 3689; if (args.Length > 1) port = UInt16.Parse (args[1]); Client client = new Client (host, port); client.Login (); AddClient (client); } Console.WriteLine ("Press enter to quit"); Console.ReadLine (); foreach (Client client in clients) { client.Logout (); } }