Ejemplo n.º 1
0
        public IEnumerable <CardDeck> Cards()
        {
            var client = new ClientCR(WebConfig.CRConfig);
            var data   = client.GetMissingCards().OrderByDescending(p => p.Cards);

            //var data = Test.Create(5);
            return(data);
        }
Ejemplo n.º 2
0
        public IEnumerable <TournamentItem> Tournois()
        {
            var client = new ClientCR(WebConfig.CRConfig);
            var data   = client.GetTournaments().Where(p => p.MaxCapacity.GetValueOrDefault(50) != 1000).OrderByDescending(p => p.MaxCapacity).ThenBy(p => p.Capacity).ThenBy(p => p.CreatedTime).ToList();
            var rest   = data.Where(p => p.Status == "inProgress").ToList();

            rest.AddRange(data.Where(p => p.Status != "inProgress").ToList());
            //var data = Test.Create(5);
            return(rest);
        }
Ejemplo n.º 3
0
        public void WaitKey(ConsoleKey carExit, ClientCR client)
        {
            ShowChoices(carExit);
            while (true)
            {
                var key = Console.ReadKey();
                if (key.Key == ConsoleKey.Escape)
                {
                    Console.WriteLine();
                    client.DemandStopping = true;
                }
                else if (key.Key == carExit)
                {
                    Console.WriteLine();
                    break;
                }
                else
                {
                    Console.WriteLine();
                    var actionlocal = _actions.FirstOrDefault(p => p.IsSameChar(key.Key));
                    if (actionlocal != null)
                    {
                        if (actionlocal.SubChoice != null)
                        {
                            actionlocal.SubChoice.WaitKey(carExit, client);
                            ShowChoices(carExit);
                            continue;
                        }

                        if (actionlocal.Args.Count() > 0)
                        {
                            var arglst = new string[actionlocal.Args.Length];
                            for (int i = 0; i < actionlocal.Args.Length; i++)
                            {
                                Console.Write(actionlocal.Args[i]);
                                arglst[i] = Console.ReadLine();
                            }
                            var task = Task.Factory.StartNew(() => actionlocal.Action(arglst)).ContinueWith(taskShow => ShowChoices(carExit));
                        }
                        else
                        {
                            var task = Task.Factory.StartNew(() => actionlocal.Action(null)).ContinueWith(taskShow => ShowChoices(carExit));
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            ServiceClientTracing.IsEnabled = true;
            ServiceClientTracing.AddTracingInterceptor(new DebugTracer(ExtConsole));

            if (ConfigRepo.NotConfigure())
            {
                ExtConsole.WriteLine("You must complete the config.json file.");
                ExtConsole.WriteLine("Create an account on https://developer.clashroyale.com and genrate a key(token)");
                ExtConsole.ReadKey();
                return;
            }

            client = new ClientCR(ConfigRepo.Config, ExtConsole);

            if (client.Player != null)
            {
                ExtConsole.WriteLine($"Player : {client.Player}");
            }
            if (client.Clan != null)
            {
                ExtConsole.WriteLine($"Clan   : {client.Clan}");
            }

            ExtConsole
            .NewChoice(ConsoleKey.D1, "Rank of your clan", ExtConsole
                       .NewChoice(ConsoleKey.D1, "Local", RankLocalClan)
                       .NewChoice(ConsoleKey.D2, "General", RankGeneralClan))
            .NewChoice(ConsoleKey.D2, "Various functions", ExtConsole
                       .NewChoice(ConsoleKey.D1, "Upcomming chests", UpcommingChests)
                       .NewChoice(ConsoleKey.D2, "Open tournaments", OpenTournaments)
                       .NewChoice(ConsoleKey.D3, "Cards list", ListCards))
            .NewChoice(ConsoleKey.D3, "My cards", ExtConsole
                       .NewChoice(ConsoleKey.D1, "Completed cards", CompletedCards)
                       .NewChoice(ConsoleKey.D2, "Missing cards", MissingCards))
            .NewChoice(ConsoleKey.D4, "Stats players", ExtConsole
                       .NewChoice(ConsoleKey.D1, "Usage cards in local top 200", UsageCardsTop)
                       .NewChoice(ConsoleKey.D2, "Winrate card local top 200", WinrateCardTop)
                       .NewChoice(ConsoleKey.D3, "Winrate card by trophes (is long)", WinrateCardByClanTrophe, "Minimum clan trophy : "))
            .NewChoice(ConsoleKey.D9, "Change player and clan", ExtConsole
                       .NewChoice(ConsoleKey.D1, "Change player and clan", SettingPlayerClan)
                       .NewChoice(ConsoleKey.D2, "Change just clan", SettingClan))
            .WaitKey(ConsoleKey.X, client);
        }