public static async Task<RsrEventInformation> GetEventInformationAsync(int eventId, CancellationToken cancellation = default(CancellationToken)) {
try {
using (var client = new WebClient { Headers = {
[HttpRequestHeader.UserAgent] = "Assetto Corsa Launcher",
["X-User-Agent"] = CmApiProvider.UserAgent
} }) {
var result = await client.DownloadDataTaskAsync(GetUrl(eventId));
if (cancellation.IsCancellationRequested) return null;
return null;
}
} catch (Exception e) {
if (!cancellation.IsCancellationRequested) {
Logging.Warning($"Cannot get {eventId}: " + e);
}
return null;
}
}
}