mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-29 04:57:02 +00:00
Adopt the code review
This commit is contained in:
parent
db3f0eae0c
commit
e454c22053
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user