Пример #1
0
        static void Main(string[] args)
        {
            API            = new PykeAPI(Serilog.Events.LogEventLevel.Information);
            API.PykeReady += API_PykeReady;
            API.ConnectAsync().ConfigureAwait(false);

            while (true)
            {
                Console.ReadLine();
                Console.WriteLine(API.RequestHandler.GetJsonResponseAsync(HttpMethod.Get, "/lol-champ-select/v1/session", null).GetAwaiter().GetResult());
            }
        }
Пример #2
0
        public void CheckConnection()
        {
            if (!Process.GetProcesses().Any(_ => _.MainWindowTitle == "League of Legends"))
            {
                throw new Exception("League of Legends Client not Open");
            }

            API = new PykeAPI(Serilog.Events.LogEventLevel.Information);

            AutoResetEvent wait = new AutoResetEvent(false);

            API.PykeReady += (o, e) => wait.Set(); // Need to wait for PykeReady to be fired before testing CheckDDragonData()
            API.ConnectAsync().ConfigureAwait(true);

            Assert.IsTrue(wait.WaitOne(TimeSpan.FromSeconds(20)));
        }