Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LeagueAPI"/> class.
        /// </summary>
        /// <param name="port">The league client API's port.</param>
        /// <param name="token">The authentication token.</param>
        /// <param name="eventHandler">The event handler.</param>
        private PykeAPI(int port, string token, Websocket.ILeagueEventHandler eventHandler, LeagueProcessHandler _pHandler, LockFileHandler _lfHandler, Logger logger)
        {
            this.logger             = logger;
            _processHandler         = _pHandler;
            _lockFileHandler        = _lfHandler;
            EventHandler            = eventHandler;
            RequestHandler          = new LeagueRequestHandler(port, token, this);
            RiotClientEndpoint      = new RiotClientEndpoint(RequestHandler);
            ProcessControlEndpoint  = new ProcessControlEndpoint(RequestHandler);
            _processHandler.Exited += OnDisconnected;
            cProc = Process.GetProcessById(ProcessId);

            _processHandler  = new LeagueProcessHandler();
            _lockFileHandler = new LockFileHandler();
            ChampSelect      = new ChampSelect.ChampSelect(this);
            Events           = new LeagueEvents(this);
            Gameflow         = new ClientGameflow(this);
            MatchMaker       = new MatchMaker(this);
            ClientInfo       = new ClientInformation(this);
            Login            = new Login.Login(this);
            Summoners        = new Summoners.Summoners(this);
            WindowHandler    = new Window.WindowHandler(this);
            Lobby            = new ClientLobby(this);
            Champions        = JsonConvert.DeserializeObject <ChampionInfo>(new WebClient().DownloadString("https://ddragon.leagueoflegends.com/cdn/10.16.1/data/en_US/champion.json"), Converter.Settings).Data.Values.ToList();
            logger.Information("Pyke Ready");
            PykeReady?.Invoke(this, this);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="LeagueClientApi"/> class.
 /// </summary>
 /// <param name="port">The league client API's port.</param>
 /// <param name="token">The authentication token.</param>
 /// <param name="eventHandler">The event handler.</param>
 private LeagueClientApi(int port, string token, ILeagueEventHandler eventHandler)
 {
     EventHandler            = eventHandler;
     RequestHandler          = new LeagueRequestHandler(port, token);
     RiotClientEndpoint      = new RiotClientEndpoint(RequestHandler);
     ProcessControlEndpoint  = new ProcessControlEndpoint(RequestHandler);
     _processHandler.Closed += OnDisconnected;
 }