Added a minimal GUI based on Avalonia UI library for C#

This commit is contained in:
2022-05-22 16:27:37 +03:00
parent 9f656d5f3f
commit 96b681bbda
24 changed files with 2099 additions and 21 deletions

View File

@@ -237,5 +237,42 @@ namespace PluginManager.Others
}
}
/// <summary>
/// Extract zip to location
/// </summary>
/// <param name="zip">The zip location</param>
/// <param name="folder">The target location</param>
/// <returns></returns>
public static async Task ExtractArchive(string zip, string folder, IProgress<double> progress)
{
if (!Directory.Exists(folder))
Directory.CreateDirectory(folder);
using (ZipArchive archive = ZipFile.OpenRead(zip))
{
int totalZIPFiles = archive.Entries.Count();
int currentZIPFile = 0;
foreach (ZipArchiveEntry entry in archive.Entries)
{
if (entry.FullName.EndsWith("/"))
{
currentZIPFile++;
Directory.CreateDirectory(Path.Combine(folder, entry.FullName));
}
else
{
entry.ExtractToFile(Path.Combine(folder, entry.FullName), true);
currentZIPFile++;
}
await Task.Delay(10);
progress.Report((double)currentZIPFile / totalZIPFiles * 100);
}
}
}
}
}