Example #1
0
        protected override async Task ExecuteAsync(IConsole console)
        {
            if (Name != default && Id != default)
            {
                await ErrorAsync("Please specify either name or id, not both");

                return;
            }

            var user = Name != default
                ? await ServerAccessor.GetUserByNameAsync(Name)
                : Id != default
                ? await ServerAccessor.GetUserByIdAsync(Id.Value)
                : await MinerAccessor.GetCurrentUserAync();

            if (user == null)
            {
                await WarnLineAsync("User not found");

                return;
            }

            var miners = Name != default
                ? await ServerAccessor.ListMinersByOwnerNameAsync(Name)
                : Id != default
                ? await ServerAccessor.ListMinersByOwnerIdAsync(Id.Value)
                : await MinerAccessor.ListOwnedMinersAsync();

            var plotters = Name != default
                ? await ServerAccessor.ListPlottersByOwnerNameAsync(Name)
                : Id != default
                ? await ServerAccessor.ListPlottersByOwnerIdAsync(Id.Value)
                : await MinerAccessor.ListOwnedPlottersAsync();

            await InfoLineAsync($"[ {user.Name}   |   User Info ] ");

            await InfoLineAsync($"[ID]               |  {user.Id}");
            await InfoLineAsync($"[Plot Minutes]     |  {user.PlotMinutes}");
            await InfoLineAsync($"[Miner Count]      |  {miners.Count}");
            await InfoLineAsync($"[Mining Profit]    |  {miners.Sum(x => x.Earnings)}");
            await InfoLineAsync($"[Plotter Count]    |  {plotters.Count}");
            await InfoLineAsync($"[Plotting Profit]  |  {plotters.Sum(x => x.Earnings)}");

            await WriteLineAsync();
            await InfoLineAsync($"[ {user.Name}   |   Miners ] ");

            if (miners.Count == 0)
            {
                await WarnLineAsync("--- No Entries ---");
            }
            else
            {
                var columns = new Dictionary <string, Func <MinerInfo, object> >()
                {