public void StartListening() { IsBuiltCheck(); isBuilt = true; var serviceProvider = services.BuildServiceProvider(); subject.AddServiceProvider(serviceProvider); subject.StartListening(); }
static void Main(string[] args) { dbHandler = new DatabaseHandler(); Console.WriteLine("Generate new galaxy?"); string ans = Console.ReadLine(); if (ans == "y") { if (File.Exists("StarsDB.db")) { File.Delete("StarsDB.db"); } //StarDatabaseCode.StartDB(); DatabaseHandler.RefreshCurrentGalaxy(); StarSystemGenerator gen = new StarSystemGenerator(); gen.GenerateGalaxy(); DatabaseHandler.GetMainCluster(); } else { //woah } RequestListener listener = new RequestListener(57253); #region Request Registering listener.RegisterRequest <LoginRequest>(RequestHandlers.LoginRequestHandler); listener.RegisterRequest <WriteRequest>(RequestHandlers.WriteRequestHandler); listener.RegisterRequest <ReadRequest>(RequestHandlers.ReadRequestHandler); listener.RegisterRequest <CreateAccountRequest>(RequestHandlers.CreateAccountRequestHandler); listener.RegisterRequest <UpdateClientOnServerRequest>(RequestHandlers.UpdateClientOnServerRequestHandler); listener.RegisterRequest <FindJumpableSystemsRequest>(RequestHandlers.FindJumpableSystemsRequestHandler); listener.RegisterRequest <FindLocalPlayersRequest>(RequestHandlers.FindLocalPlayersRequestHandler); listener.RegisterRequest <SendChatRequest>(RequestHandlers.SendChatRequestHandler); listener.RegisterRequest <AddModuleRequest>(RequestHandlers.AddModuleRequestHandler); listener.RegisterRequest <UserDisconnectRequest>(RequestHandlers.UserDisconnectRequestHandler); #endregion Console.WriteLine("Started Listening"); listener.StartListening(); }