Пример #1
0
            public override Task <DiscordGetServersTableReply> GetDiscordServersTable(DiscordGetServersTableRequest request, ServerCallContext context)
            {
                Type discordContextServerType = typeof(DiscordContext.Server);

                PropertyInfo[] fields = discordContextServerType.GetProperties();

                ConsoleTable table = new ConsoleTable(fields.Select(f => f.Name).ToArray());

                foreach (DiscordContext.Server contextServer in Servers.DbSet)
                {
                    table.AddRow(fields.Select(f => f.GetValue(contextServer)).ToArray());
                }

                DiscordGetServersTableReply reply = new DiscordGetServersTableReply()
                {
                    Table = table.ToString()
                };

                return(Task.FromResult(reply));
            }
Пример #2
0
        public static void GetServersTable()
        {
            DiscordGetServersTableReply reply = Client.GetDiscordServersTable(new DiscordGetServersTableRequest());

            Console.WriteLine(reply.Table);
        }