Created
November 26, 2017 09:43
-
-
Save nielsAD/3e26c89f29d5c7cfd8cde0e28471e92b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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