Exemple #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);
        }
        private void ConfigurePools()
        {
            _leagueProcessHandler = new LeagueProcessHandler();
            _lockFileHandler      = new LockFileHandler();

            _leagueProcessHandler.ExecutablePath += s => _leaguePath = s;
            _leagueProcessHandler.PoolPath();
            PoolLcu();
        }
Exemple #3
0
        public PykeAPI(Serilog.Events.LogEventLevel DebugLevel = Serilog.Events.LogEventLevel.Information)
        {
            logger = new LoggerConfiguration()
                     .WriteTo.Console()
                     .MinimumLevel.Is(DebugLevel)
                     .CreateLogger();

            _processHandler  = new LeagueProcessHandler();
            _lockFileHandler = new LockFileHandler();
        }
 /// <summary>
 /// Initializes the necessary handlers.
 /// </summary>
 static LeagueClientApi()
 {
     _processHandler  = new LeagueProcessHandler();
     _lockFileHandler = new LockFileHandler();
 }