コード例 #1
0
ファイル: Rpc.cs プロジェクト: stevancorre/rewarded-posts
            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);
        }