示例#1
0
        private static async Task GetGroupConfigRude(Core.Services.Config.ConfigClient client, string token)
        {
            Console.WriteLine("Getting group key setting...");
            try
            {
                var headers = GetHeaders(token);
                Console.Write("Group? ");
                var keyName = Console.ReadLine();
                Console.Write("Rudness? ");
                var rudeness = Console.ReadLine();
                if (!int.TryParse(rudeness, out var loops))
                {
                    loops = 10;
                }
                var sw = Stopwatch.StartNew();
                for (int i = 0; i < loops; i++)
                {
                    await client.GetGroupConfigAsync(keyName, headers);

                    Console.Write('.');
                }
                sw.Stop();
                Console.WriteLine($"\n {sw.Elapsed} Done.");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error getting setting.{Environment.NewLine}{ex}");
            }
        }
示例#2
0
        private static async Task GetGroupConfig(Core.Services.Config.ConfigClient client, string token)
        {
            Console.WriteLine("Getting group key setting...");
            try
            {
                var headers = GetHeaders(token);
                Console.Write("Group? ");
                var keyName = Console.ReadLine();
                var resp    = await client.GetGroupConfigAsync(keyName, headers);

                foreach (var(index, setting) in resp.Settings.Select((p, i) => (i, p)))
                {
                    Console.WriteLine($"{index} => {setting.Key} [{setting.Value}({setting.Type})]");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error getting setting.{Environment.NewLine}{ex}");
            }
        }