Esempio n. 1
0
        static async Task Main(string[] args)
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

            var json = await File.ReadAllTextAsync("courses.json");

            var obj = JsonConvert.DeserializeObject(json) as JArray;

            List <Task> tasks = new List <Task>();

            foreach (var c in obj)
            {
                var request  = new ReplayRequest(c.Value <string>("name"), c.Value <string>("url"), c.Value <string>("content"));
                var replayer = new Replayer(request);
                tasks.Add(replayer.ReplayAsync());
            }

            await Task.WhenAll(tasks);

            Console.WriteLine("Finished");
            Console.ReadLine();
        }
Esempio n. 2
0
 public Replayer(ReplayRequest replayRequest)
 {
     this.replayRequest = replayRequest;
     httpClient.Timeout = TimeSpan.FromMinutes(10);
 }