Beispiel #1
0
        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();
        }
Beispiel #2
0
            public ListenerBuilder AddHandler <TR, TH>() where TH : RequestHandler <TR>
            {
                IsBuiltCheck();

                services.AddTransient <TH>();
                subject.RegisterRequest <TR, TH>();

                return(this);
            }