Beispiel #1
0
        private async Task <int> Info(PointsLogModuleOptions 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.GetPointsLogViewAsync(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.Timestamp.ToString())}"
                    );
            }
            else
            {
                var count     = dal.GetPointsLogCount((_) => true);
                var lastEntry = (await dal.GetPointsLogViewAsync(default, null, default, default, 1, 0)).ToArray();
Beispiel #2
0
        public int Exec(PointsLogModuleOptions opts)
        {
            if (opts.ActionInfo)
            {
                return(Info(opts).Result);
            }
            if (opts.ActionFetch)
            {
                return(Fetch(opts).Result);
            }


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