public async Task<string> InstallCustom(string id, IProgress<double?> progress = null, CancellationToken cancellation = default(CancellationToken)) {
var destination = FilesStorage.Instance.GetDirectory("Locales", id);
var data = await CmApiProvider.GetDataAsync(@"locales/get/base", progress, cancellation);
if (cancellation.IsCancellationRequested || data == null) return null;
progress?.Report(null);
using (var memory = new MemoryStream(data))
using (var updateZip = new ZipArchive(memory)) {
foreach (var entry in updateZip.Entries) {
using (var stream = entry.Open()) {
var filename = Path.Combine(destination, entry.Name);
if (File.Exists(filename)) continue;
await FileUtils.WriteAllBytesAsync(filename, stream, cancellation);
if (cancellation.IsCancellationRequested) return null;
}
}
}
return destination;
}
}