adding some more logging
This commit is contained in:
parent
96bf6aaf63
commit
52a283ad37
@ -25,7 +25,7 @@ namespace SPTInstaller.Aki.Helper
|
|||||||
{
|
{
|
||||||
if (expectedHash != null && FileHashHelper.CheckHash(cacheFile, expectedHash))
|
if (expectedHash != null && FileHashHelper.CheckHash(cacheFile, expectedHash))
|
||||||
{
|
{
|
||||||
Log.Information($"Using cached file: {cacheFile.Name}");
|
Log.Information($"Using cached file: {cacheFile.Name} - Hash: {expectedHash}");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,8 +119,9 @@ namespace SPTInstaller.Aki.Helper
|
|||||||
|
|
||||||
return result.Succeeded ? cacheFile : null;
|
return result.Succeeded ? cacheFile : null;
|
||||||
}
|
}
|
||||||
catch
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
Log.Error(ex, $"Error while getting file: {fileName}");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,8 +136,9 @@ namespace SPTInstaller.Aki.Helper
|
|||||||
|
|
||||||
return result.Succeeded ? cacheFile : null;
|
return result.Succeeded ? cacheFile : null;
|
||||||
}
|
}
|
||||||
catch
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
Log.Error(ex, $"Error while getting file: {fileName}");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using Serilog;
|
|||||||
using SPTInstaller.Models;
|
using SPTInstaller.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace SPTInstaller.Aki.Helper
|
namespace SPTInstaller.Aki.Helper
|
||||||
{
|
{
|
||||||
@ -49,6 +50,19 @@ namespace SPTInstaller.Aki.Helper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetRedactedPath(string path)
|
||||||
|
{
|
||||||
|
var nameMatched = Regex.Match(path, @".:\\[uU]sers\\(?<NAME>[^\\]+)");
|
||||||
|
|
||||||
|
if (nameMatched.Success)
|
||||||
|
{
|
||||||
|
var name = nameMatched.Groups["NAME"].Value;
|
||||||
|
return path.Replace(name, "-REDACTED-");
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
public static Result CopyDirectoryWithProgress(DirectoryInfo sourceDir, DirectoryInfo targetDir, IProgress<double> progress = null) =>
|
public static Result CopyDirectoryWithProgress(DirectoryInfo sourceDir, DirectoryInfo targetDir, IProgress<double> progress = null) =>
|
||||||
CopyDirectoryWithProgress(sourceDir, targetDir, (msg, prog) => progress?.Report(prog));
|
CopyDirectoryWithProgress(sourceDir, targetDir, (msg, prog) => progress?.Report(prog));
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Splat;
|
using Serilog;
|
||||||
|
using Splat;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -76,7 +77,11 @@ namespace SPTInstaller.Helpers
|
|||||||
var service = Locator.Current.GetService(type);
|
var service = Locator.Current.GetService(type);
|
||||||
|
|
||||||
if (service == null)
|
if (service == null)
|
||||||
throw new InvalidOperationException($"Could not locate service of type '{type.Name}'");
|
{
|
||||||
|
var message = $"Could not locate service of type '{type.Name}'";
|
||||||
|
Log.Error(message);
|
||||||
|
throw new InvalidOperationException(message);
|
||||||
|
}
|
||||||
|
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
@ -92,7 +97,11 @@ namespace SPTInstaller.Helpers
|
|||||||
var service = Locator.Current.GetService<T>();
|
var service = Locator.Current.GetService<T>();
|
||||||
|
|
||||||
if (service == null)
|
if (service == null)
|
||||||
throw new InvalidOperationException($"Could not locate service of type '{nameof(T)}'");
|
{
|
||||||
|
var message = $"Could not locate service of type '{nameof(T)}'";
|
||||||
|
Log.Error(message);
|
||||||
|
throw new InvalidOperationException(message);
|
||||||
|
}
|
||||||
|
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
@ -108,7 +117,11 @@ namespace SPTInstaller.Helpers
|
|||||||
var services = Locator.Current.GetServices<T>().ToArray();
|
var services = Locator.Current.GetServices<T>().ToArray();
|
||||||
|
|
||||||
if (services == null || services.Count() == 0)
|
if (services == null || services.Count() == 0)
|
||||||
throw new InvalidOperationException($"Could not locate service of type '{nameof(T)}'");
|
{
|
||||||
|
var message = $"Could not locate service of type '{nameof(T)}'";
|
||||||
|
Log.Error(message);
|
||||||
|
throw new InvalidOperationException(message);
|
||||||
|
}
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace SPTInstaller.Installer_Tasks
|
|||||||
|
|
||||||
public override async Task<IResult> TaskOperation()
|
public override async Task<IResult> TaskOperation()
|
||||||
{
|
{
|
||||||
SetStatus("Initializing", "");
|
SetStatus("Initializing", $"Target Install Path: {FileHelper.GetRedactedPath(_data.TargetInstallPath)}");
|
||||||
|
|
||||||
_data.OriginalGamePath = PreCheckHelper.DetectOriginalGamePath();
|
_data.OriginalGamePath = PreCheckHelper.DetectOriginalGamePath();
|
||||||
|
|
||||||
@ -26,6 +26,8 @@ namespace SPTInstaller.Installer_Tasks
|
|||||||
return Result.FromError("EFT IS NOT INSTALLED!");
|
return Result.FromError("EFT IS NOT INSTALLED!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetStatus(null, $"Installed EFT Game Path: {FileHelper.GetRedactedPath(_data.OriginalGamePath)}");
|
||||||
|
|
||||||
var result = PreCheckHelper.DetectOriginalGameVersion(_data.OriginalGamePath);
|
var result = PreCheckHelper.DetectOriginalGameVersion(_data.OriginalGamePath);
|
||||||
|
|
||||||
if (!result.Succeeded)
|
if (!result.Succeeded)
|
||||||
@ -35,6 +37,8 @@ namespace SPTInstaller.Installer_Tasks
|
|||||||
|
|
||||||
_data.OriginalGameVersion = result.Message;
|
_data.OriginalGameVersion = result.Message;
|
||||||
|
|
||||||
|
SetStatus(null, $"Installed EFT Game Version: {_data.OriginalGameVersion}");
|
||||||
|
|
||||||
if (_data.OriginalGamePath == null)
|
if (_data.OriginalGamePath == null)
|
||||||
{
|
{
|
||||||
return Result.FromError("Unable to find original EFT directory, please make sure EFT is installed. Please also run EFT once");
|
return Result.FromError("Unable to find original EFT directory, please make sure EFT is installed. Please also run EFT once");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user