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) { string server_name = "Sample Server"; string database_name = "Sample Database"; ushort port = 3689; Database db = new Database (database_name); for (int i = 0; i < args.Length; i++) { if (args[i] == "--port") { port = Convert.ToUInt16 (args[++i]); continue; } if (args[i] == "--server-name") { server_name = args[++i]; continue; } if (args[i] == "--database-name") { database_name = args[++i]; continue; } if (args[i] == "--help") { ShowHelp (); return; } AddDirectory (db, args[i]); } db.Name = database_name; server = new Server (server_name); server.Collision += OnCollision; server.Port = port; Playlist pl = new Playlist ("foo playlist"); foreach (Track track in db.Tracks) { pl.AddTrack (track); } db.AddPlaylist (pl); Console.WriteLine ("Done adding files"); Console.WriteLine ("Starting Server '{0}' on Port {1}", server.Name, server.Port); server.AddDatabase (db); server.Commit (); server.Start (); Console.ReadLine (); server.Stop (); }