Adopt the code review

This commit is contained in:
Namhyeon Go 2025-05-17 02:46:48 +09:00
parent db3f0eae0c
commit e454c22053

View File

@ -92,9 +92,6 @@ namespace WelsonJS.Launcher
private bool IsValidFile(string filePath) private bool IsValidFile(string filePath)
{ {
if (!File.Exists(filePath))
throw new FileNotFoundException("File does not exist.", filePath);
byte[] signature = new byte[4]; byte[] signature = new byte[4];
using (var fs = File.OpenRead(filePath)) using (var fs = File.OpenRead(filePath))
@ -165,17 +162,15 @@ namespace WelsonJS.Launcher
private bool ExtractUsingShell(string filePath, string workingDirectory) private bool ExtractUsingShell(string filePath, string workingDirectory)
{ {
var shellAppType = Type.GetTypeFromProgID("Shell.Application"); var shellAppType = Type.GetTypeFromProgID("Shell.Application");
if (shellAppType == null) if (shellAppType == null)
return false; return false;
dynamic shell = Activator.CreateInstance(shellAppType); dynamic shell = Activator.CreateInstance(shellAppType);
if (shell == null) if (shell == null)
return false; return false;
dynamic zip = shell.NameSpace(filePath); dynamic zip = shell.NameSpace(filePath);
dynamic dest = shell.NameSpace(workingDirectory); dynamic dest = shell.NameSpace(workingDirectory);
dynamic dest = shell.NameSpace(workingDirectory);
if (zip == null || dest == null) if (zip == null || dest == null)
return false; return false;