Skip to content

Instantly share code, notes, and snippets.

@nielsAD
Created November 26, 2017 09:43
Show Gist options
  • Save nielsAD/3e26c89f29d5c7cfd8cde0e28471e92b to your computer and use it in GitHub Desktop.
Save nielsAD/3e26c89f29d5c7cfd8cde0e28471e92b to your computer and use it in GitHub Desktop.
using System;
using System.Net;
using System.Collections.Generic;
using RestSharp;
namespace ConsoleApp1
{
using ArchiveFiles = List<ArchiveFile>;
public class ArchiveFile
{
public string Name { get; set; }
public string Type { get; set; }
public DateTime MTime { get; set; }
public int Size { get; set; }
}
class Program
{
static void PrintFiles(string dir)
{
var client = new RestClient("http://archive.toom.io");
var request = new RestRequest("dl/{dir}/", Method.GET);
request.AddUrlSegment("dir", dir);
IRestResponse<ArchiveFiles> resp = client.Execute<ArchiveFiles>(request);
foreach (var item in resp.Data)
{
if (item.Type == "directory")
PrintFiles(dir + "/" + item.Name);
else
Console.WriteLine(dir + "/" + item.Name);
}
}
static void Main(string[] args)
{
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
PrintFiles("wc3/replays");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment