示例#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;
            }
            if (Name == default && Id == default)
            {
                await ErrorAsync("Please specify either name or id");

                return;
            }


            var plotter = Name != default
                ? await ServerAccessor.GetPlotterByNameAsync(Name)
                : await ServerAccessor.GetPlotterByIdAsync(Id.Value);

            await InfoLineAsync($"[ID]         |   {plotter.Id}");
            await InfoLineAsync($"[Name]       |   {plotter.Name}");
            await InfoLineAsync($"[Earnings]   |   {plotter.Earnings}");
            await InfoAsync($"[Status]     |   ");

            if (!plotter.Online)
            {
                await ErrorLineAsync("Offline");

                return;
            }

            await SuccessLineAsync("Online");
            await InfoLineAsync($"[Capacity]   |   {plotter.Capacity}");
            await InfoLineAsync($"[Plots]      |   {plotter.PlotsAvailable}");
        }