Esempio n. 1
0
        private async Task <int> Info(PointsModuleOptions opts)
        {
            if (opts.Server != null && opts.SummonerName != null)
            {
                var summoner = await Shared.GetSummoner(opts.Server, opts.SummonerName, riotApi, logger);

                if (summoner == null)
                {
                    return(1);
                }

                var summonerDb = await Shared.GetDbSummoner(summoner.Id, dal);

                var entries = await dal.GetPointsViewAsync(summonerDb?.Id ?? default);

                var count     = entries?.Count ?? 0;
                var lastEntry = entries?.ToArray()[0];

                logger.LogInformation(
                    "\n" +
                    $"For summoner '{summoner.Name}' ({summonerDb.Id}):\n\n" +
                    $"Data count:   {count}\n" +
                    $"Last entry:   {(lastEntry == null ? "[nothing collected yet]" : lastEntry.Updated.ToString())}"
                    );
            }
            else
            {
                var count     = dal.GetPointsCount((_) => true);
                var lastEntry = (await dal.GetPointsViewAsync(default, null, 1, 0)).ToArray();
Esempio n. 2
0
        public int Exec(PointsModuleOptions opts)
        {
            if (opts.ActionInfo)
            {
                return(Info(opts).Result);
            }
            if (opts.ActionFetch)
            {
                return(Fetch(opts).Result);
            }


            logger.LogError("Action must be specified");
            return(1);
        }