Add a Windows desktop installer for PC-based OmniNX installs.
This lets mass deployments and modchip setups apply the same install/update flow from a PC, with generated deletion lists kept in sync with the payload headers.
This commit is contained in:
21 files changed
+2312
No files matched your search
@@ -0,0 +1,40 @@
|
||||
using System.IO.Compression;
|
||||
using OmniNX.DesktopInstaller.Models;
|
||||
|
||||
namespace OmniNX.DesktopInstaller.Services;
|
||||
|
||||
public static class ZipExtractor
|
||||
{
|
||||
public static string ExtractPack(string zipPath, string extractRoot, IProgress<string>? progress = null)
|
||||
{
|
||||
PathUtils.EnsureDirectory(extractRoot);
|
||||
var targetDir = Path.Combine(extractRoot, Path.GetFileNameWithoutExtension(zipPath));
|
||||
if (Directory.Exists(targetDir))
|
||||
Directory.Delete(targetDir, recursive: true);
|
||||
|
||||
progress?.Report($"Extracting {Path.GetFileName(zipPath)}...");
|
||||
ZipFile.ExtractToDirectory(zipPath, targetDir, overwriteFiles: true);
|
||||
return ResolveStagingPath(targetDir);
|
||||
}
|
||||
|
||||
public static string ResolveStagingPath(string extractRoot)
|
||||
{
|
||||
foreach (var variant in new[] { OmniNxVariant.Standard, OmniNxVariant.Light, OmniNxVariant.Oc })
|
||||
{
|
||||
var candidate = Path.Combine(extractRoot, VariantHelper.GetStagingFolderName(variant));
|
||||
if (Directory.Exists(candidate))
|
||||
return candidate;
|
||||
}
|
||||
|
||||
if (Directory.Exists(Path.Combine(extractRoot, "atmosphere")) ||
|
||||
Directory.Exists(Path.Combine(extractRoot, "bootloader")))
|
||||
return extractRoot;
|
||||
|
||||
var subdirs = Directory.GetDirectories(extractRoot);
|
||||
if (subdirs.Length == 1)
|
||||
return ResolveStagingPath(subdirs[0]);
|
||||
|
||||
throw new InvalidOperationException(
|
||||
"Could not locate OmniNX pack root in extracted archive. Expected 'OmniNX Light', 'OmniNX Standard', or 'OmniNX OC' folder.");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user