add try catch and directory check to stream method
This commit is contained in:
parent
7f8268200a
commit
e7a38ac30d
@ -43,6 +43,11 @@ namespace SPT_AKI_Installer.Aki.Helper
|
|||||||
|
|
||||||
private static async Task<GenericResult> ProcessInboundStreamAsync(FileInfo cacheFile, Stream downloadStream, string expectedHash = null)
|
private static async Task<GenericResult> ProcessInboundStreamAsync(FileInfo cacheFile, Stream downloadStream, string expectedHash = null)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cacheFile.Refresh();
|
||||||
|
Directory.CreateDirectory(_cachePath);
|
||||||
|
|
||||||
if (cacheFile.Exists)
|
if (cacheFile.Exists)
|
||||||
{
|
{
|
||||||
if (expectedHash != null && FileHashHelper.CheckHash(cacheFile, expectedHash))
|
if (expectedHash != null && FileHashHelper.CheckHash(cacheFile, expectedHash))
|
||||||
@ -68,6 +73,11 @@ namespace SPT_AKI_Installer.Aki.Helper
|
|||||||
|
|
||||||
return GenericResult.FromSuccess();
|
return GenericResult.FromSuccess();
|
||||||
}
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
return GenericResult.FromError(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static async Task<GenericResult> ProcessInboundFileAsync(FileInfo cacheFile, string targetLink, IProgress<double> progress, string expectedHash = null)
|
private static async Task<GenericResult> ProcessInboundFileAsync(FileInfo cacheFile, string targetLink, IProgress<double> progress, string expectedHash = null)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user