Added a try/catch block when unzipping files to ensure errors are properly logged, and temp files are cleaned up (#165)
This commit is contained in:
@@ -154,6 +154,8 @@ namespace gaseous_server.Classes
|
|||||||
// extract the zip file and search the contents
|
// extract the zip file and search the contents
|
||||||
string ExtractPath = Path.Combine(Config.LibraryConfiguration.LibraryTempDirectory, Path.GetRandomFileName());
|
string ExtractPath = Path.Combine(Config.LibraryConfiguration.LibraryTempDirectory, Path.GetRandomFileName());
|
||||||
if (!Directory.Exists(ExtractPath)) { Directory.CreateDirectory(ExtractPath); }
|
if (!Directory.Exists(ExtractPath)) { Directory.CreateDirectory(ExtractPath); }
|
||||||
|
try
|
||||||
|
{
|
||||||
ZipFile.ExtractToDirectory(GameFileImportPath, ExtractPath);
|
ZipFile.ExtractToDirectory(GameFileImportPath, ExtractPath);
|
||||||
|
|
||||||
// loop through contents until we find the first signature match
|
// loop through contents until we find the first signature match
|
||||||
@@ -183,6 +185,11 @@ namespace gaseous_server.Classes
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logging.Log(Logging.LogType.Critical, "Get Signature", "Error processing zip file: " + GameFileImportPath, ex);
|
||||||
|
}
|
||||||
|
|
||||||
if (Directory.Exists(ExtractPath)) { Directory.Delete(ExtractPath, true); }
|
if (Directory.Exists(ExtractPath)) { Directory.Delete(ExtractPath, true); }
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user