Revert "Merge pull request #256 from gnh1201/dev"

This reverts commit 26bc061819, reversing
changes made to 4d37a3eb4a.
This commit is contained in:
Theodore Tsirpanis 2025-05-22 02:54:47 +03:00
parent f2dc0a3904
commit ea3e70ab24

View File

@ -42,6 +42,12 @@ namespace WelsonJS.Launcher
ExtractCommand = (src, dest) => $"-ext2simple \"{src}\" \"{dest}\""
},
new Extractor
{
Name = "tar (Windows)",
FileName = "tar.exe",
ExtractCommand = (src, dest) => $"-xf \"{src}\" -C \"{dest}\""
},
new Extractor
{
Name = "WinZip",
FileName = "wzunzip.exe",
@ -58,18 +64,6 @@ namespace WelsonJS.Launcher
Name = "Bandizip",
FileName = "Bandizip.exe",
ExtractCommand = (src, dest) => $"x -o:\"{dest}\" \"{src}\" -y"
},
new Extractor
{
Name = "tar (Windows)", // Windows 10 build 17063 or later
FileName = "tar.exe",
ExtractCommand = (src, dest) => $"-xf \"{src}\" -C \"{dest}\""
},
new Extractor
{
Name = "unzip", // Info-ZIP, Cygwin
FileName = "unzip.exe",
ExtractCommand = (src, dest) => $"\"{src}\" -d \"{dest}\" -o"
}
};
@ -92,16 +86,12 @@ namespace WelsonJS.Launcher
foreach (var extractor in AvailableExtractors.Where(e => e.Path != null))
{
if (RunProcess(extractor.Path, extractor.ExtractCommand(filePath, workingDirectory)))
{
return true;
}
}
if (ExtractUsingPowerShell(filePath, workingDirectory))
return true;
if (ExtractUsingShell(filePath, workingDirectory))
return true;
return false;
return ExtractUsingShell(filePath, workingDirectory);
}
private bool IsValidFile(string filePath)
@ -167,9 +157,7 @@ namespace WelsonJS.Launcher
}
}
}
catch {
// ignore an exception
}
catch { }
}
}
@ -193,15 +181,6 @@ namespace WelsonJS.Launcher
}
}
private bool ExtractUsingPowerShell(string filePath, string workingDirectory)
{
var escapedSrc = filePath.Replace("'", "''");
var escapedDest = workingDirectory.Replace("'", "''");
var script = $"Expand-Archive -LiteralPath '{escapedSrc}' -DestinationPath '{escapedDest}' -Force";
return RunProcess("powershell.exe", $"-NoProfile -Command \"{script}\"");
}
private bool ExtractUsingShell(string filePath, string workingDirectory)
{
var shellAppType = Type.GetTypeFromProgID("Shell.Application");