Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.Title = "Draven";
            printHeader();

            if (!DatabaseManager.InitConnection())
            {
                Console.WriteLine("[ERR] Press any Key to exit... (Check your Database Connection)");
                Console.ReadKey();
                return;
            }

            //Create the Authentication Server to handle login requests and client page
            _auth = new AuthServer(AuthServer.HandleWebServ, AuthLocations);

            //Generate the SerializationContext
            _context = new SerializationContext();
            var structures = Assembly.GetExecutingAssembly().GetTypes().Where(x => String.Equals(x.Namespace, "Draven.Structures", StringComparison.Ordinal));

            foreach (Type ObjectType in structures)
            {
                _context.Register(ObjectType);
            }

            //Create the RTMPS server with the context and certificate
            _server = new RtmpServer(new IPEndPoint(IPAddress.Parse(RTMPSHost), RTMPSPort), _context);
            _server.ClientCommandReceieved += ClientCommandReceieved;
            _server.ClientMessageReceived  += ClientMessageReceived;

            //Set up the handler
            _handler = new MessageHandler();
            _handler.Register("LoginService");
            _handler.Register("MatchmakerService");
            _handler.Register("ClientFacadeService");
            _handler.Register("InventoryService");
            _handler.Register("MasteryBookService");
            _handler.Register("SummonerRuneService");
            _handler.Register("PlayerPreferencesService");
            _handler.Register("LcdsGameInvitationService");
            _handler.Register("LeaguesServiceProxy");
            _handler.Register("SummonerIconService");
            _handler.Register("LcdsServiceProxy");
            _handler.Register("SummonerService");
            _handler.Register("LcdsRerollService");
            _handler.Register("SummonerTeamService");
            _handler.Register("PlayerStatsService");

            //Set up the property redirector
            _redirector = new PropertyRedirector();

            Console.WriteLine("[LOG] AuthServer listening on port 8080");
            _auth.Start();
            _server.Listen();
            while (true)
            {
            }
        }
Esempio n. 2
0
        public PoroServer(PoroServerSettings settings)
        {
            _settings = settings;

            //Create the Authentication Server to handle login requests
            _auth = new AuthServer(HandleAuth, _settings.AuthLocations);

            //Load the certificate for the RTMPS server
            var certificateStore = new X509Store(StoreName.Root, StoreLocation.LocalMachine);

            certificateStore.Open(OpenFlags.MaxAllowed);

            //Store the certificate if it's not in the local store
            var _rtmpsCert = new X509Certificate2(_settings.CertFilename, "");

            if (!StoreContainsCertificate(certificateStore.Certificates, _rtmpsCert))
            {
                certificateStore.Add(_rtmpsCert);
            }
            certificateStore.Close();

            //Generate the SerializationContext
            var context    = new SerializationContext();
            var structures = Assembly.GetExecutingAssembly().GetTypes().Where(x => String.Equals(x.Namespace, "PoroLib.Structures", StringComparison.Ordinal));

            foreach (Type ObjectType in structures)
            {
                context.Register(ObjectType);
            }

            //Create the RTMPS server with the context and certificate
            _server = new RtmpServer(new IPEndPoint(IPAddress.Parse(_settings.RTMPSHost), _settings.RTMPSPort), context, _rtmpsCert);
            _server.ClientCommandReceieved += ClientCommandReceieved;
            _server.ClientMessageReceived  += ClientMessageReceived;

            //Set up the handler
            _handler = new MessageHandler();
            _handler.Register("LoginService");
            _handler.Register("MatchmakerService");
            _handler.Register("ClientFacadeService");
            _handler.Register("InventoryService");

            //Set up the forwarder
            _forwarder = new MessageForwarder(context);

            //Set up the property redirector
            _redirector = new PropertyRedirector(_settings);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Console.Title = "Draven";
            printHeader();

            if (!DatabaseManager.DatabaseManager.InitConnection())
            {
                Console.WriteLine("[ERR] Press any Key to exit... (Check your Database Connection)");
                Console.ReadKey();
                return;
            }

            DatabaseManager.DatabaseManager.InitMasteryAndRuneTree();
            DatabaseManager.DatabaseManager.InitProfileIcons();

            //Create the Authentication Server to handle login requests and client page
            _auth = new AuthServer.AuthServer(AuthServer.AuthServer.HandleWebServ, AuthLocations);

            //Load the certificate store for the RTMPS server
            var certificateStore = new X509Store(StoreName.TrustedPeople, StoreLocation.LocalMachine);

            certificateStore.Open(OpenFlags.MaxAllowed);

            //Remove last certificate in case it wasn't deleted on close
            foreach (var cert in certificateStore.Certificates)
            {
                if (cert.IssuerName.Name == $"CN={RTMPSHost}")
                {
                    certificateStore.Remove(cert);
                }
            }

            //Generate new certificate for this run and add it to the store.
            var _rtmpsCert = CertGen.CreateSelfSignedCertificate(RTMPSHost);

            try
            {
                certificateStore.Add(_rtmpsCert);
                certificateStore.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw new Exception("Faile to create and store the SelfSigned cert to the store.");
            }

            //Generate the SerializationContext
            _context = new SerializationContext();
            var structures = Assembly.GetExecutingAssembly().GetTypes().Where(x => isStructureNamespace(x.Namespace));

            foreach (Type ObjectType in structures)
            {
                _context.Register(ObjectType);
                $"Successfully registered ({ObjectType.Namespace}) to handler".PrintSuccess();
            }

            //Create the RTMPS server with the context and certificate
            _server = new RtmpServer(new IPEndPoint(IPAddress.Parse(RTMPSHost), RTMPSPort), _context, _rtmpsCert);
            _server.ClientCommandReceived += ClientCommandReceieved;
            _server.ClientMessageReceived += ClientMessageReceived;

            //Set up the handler
            _handler = new MessageHandler();
            foreach (var service in Services)
            {
                try
                {
                    _handler.Register(service);
                }
                catch (Exception e)
                {
                    $"Failed to register`{service}".PrintError();
                    e.ToString().PrintError();
                }

                $"Successfully registered ({service}) to handler".PrintSuccess();
            }

            //Set up the property redirector
            _redirector = new PropertyRedirector();

            Console.WriteLine("[LOG] AuthServer listening on port 8080");
            _auth.Start();

            Console.WriteLine("[LOG] RTMPS Server listening at rtmps://{0}:{1}", RTMPSHost, RTMPSPort);
            _server.Listen();
            while (true)
            {
            }
        }
Esempio n. 4
0
        public PoroServer(PoroServerSettings settings)
        {
            _settings = settings;

            //Create the Authentication Server to handle login requests and client page
            _auth = new AuthServer(HandleWebServ, _settings.AuthLocations);

            //Load the certificate store for the RTMPS server
            var certificateStore = new X509Store(StoreName.Root, StoreLocation.LocalMachine);

            certificateStore.Open(OpenFlags.MaxAllowed);

            //Remove last certificate in case it wasn't deleted on close
            foreach (var cert in certificateStore.Certificates)
            {
                if (cert.IssuerName.Name == string.Format("CN={0}", _settings.RTMPSHost))
                {
                    certificateStore.Remove(cert);
                }
            }

            //Generate new certificate for this run and add it to the store.
            var _rtmpsCert = CertGen.CreateSelfSignedCertificate(_settings.RTMPSHost);

            certificateStore.Add(_rtmpsCert);
            certificateStore.Close();

            //Generate the SerializationContext
            _context = new SerializationContext();
            var structures = Assembly.GetExecutingAssembly().GetTypes().Where(x => String.Equals(x.Namespace, "PoroLib.Structures", StringComparison.Ordinal));

            foreach (Type ObjectType in structures)
            {
                _context.Register(ObjectType);
            }

            //Create the RTMPS server with the context and certificate
            _server = new RtmpServer(new IPEndPoint(IPAddress.Parse(_settings.RTMPSHost), _settings.RTMPSPort), _context, _rtmpsCert);
            _server.ClientCommandReceieved += ClientCommandReceieved;
            _server.ClientMessageReceived  += ClientMessageReceived;

            //Set up the handler
            _handler = new MessageHandler();
            _handler.Register("LoginService");
            _handler.Register("MatchmakerService");
            _handler.Register("ClientFacadeService");
            _handler.Register("InventoryService");
            _handler.Register("MasteryBookService");
            _handler.Register("SummonerRuneService");
            _handler.Register("PlayerPreferencesService");
            _handler.Register("LcdsGameInvitationService");
            _handler.Register("SummonerTeamService");

            //Set up the forwarder
            _forwarder = new MessageForwarder(_context);

            //Set up the property redirector
            _redirector = new PropertyRedirector(_settings);

            //Set up the data loader
            _data = new DataLoader();
            _redirector.PatcherFound += new PropertyRedirector.PatcherFoundHandler(_data.LoadData);

            //Set up the user server
            _users = new UserHandler();
        }