Merge pull request 'fix/net6-precheck' (#29) from waffle.lord/SPT-AKI-Installer:fix/net6-precheck into master
Reviewed-on: CWX/SPT-AKI-Installer#29
This commit is contained in:
commit
d5e8db40ab
@ -1,5 +1,7 @@
|
|||||||
using SPTInstaller.Models;
|
using Serilog;
|
||||||
|
using SPTInstaller.Models;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SPTInstaller.Installer_Tasks.PreChecks;
|
namespace SPTInstaller.Installer_Tasks.PreChecks;
|
||||||
@ -44,7 +46,7 @@ public class NetCore6PreCheck : PreCheckBase
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// TODO: logging
|
Log.Error(ex, $"PreCheck::{Name}::Exception");
|
||||||
return PreCheckResult.FromException(ex);
|
return PreCheckResult.FromException(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,13 +54,15 @@ public class NetCore6PreCheck : PreCheckBase
|
|||||||
|
|
||||||
foreach (var lineVersion in output)
|
foreach (var lineVersion in output)
|
||||||
{
|
{
|
||||||
if (lineVersion.StartsWith("Microsoft.WindowsDesktop.App") && lineVersion.Split(" ").Length > 1)
|
var regex = Regex.Match(lineVersion, @"Microsoft.WindowsDesktop.App (\d\.\d\.\d)");
|
||||||
{
|
|
||||||
string stringVerion = lineVersion.Split(" ")[1];
|
|
||||||
|
|
||||||
var foundVersion = new Version(stringVerion);
|
if (!regex.Success || regex.Groups.Count < 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var stringVersion = regex.Groups[1].Value;
|
||||||
|
|
||||||
|
var foundVersion = new Version(stringVersion);
|
||||||
|
|
||||||
// waffle: not fully sure if we should only check for 6.x.x versions or if higher major versions are ok
|
|
||||||
if (foundVersion >= minRequiredVersion)
|
if (foundVersion >= minRequiredVersion)
|
||||||
{
|
{
|
||||||
return PreCheckResult.FromSuccess($".Net Core {minRequiredVersion} Desktop Runtime or higher is installed.\n\nInstalled Version: {foundVersion}");
|
return PreCheckResult.FromSuccess($".Net Core {minRequiredVersion} Desktop Runtime or higher is installed.\n\nInstalled Version: {foundVersion}");
|
||||||
@ -66,7 +70,6 @@ public class NetCore6PreCheck : PreCheckBase
|
|||||||
|
|
||||||
highestFoundVersion = foundVersion > highestFoundVersion ? foundVersion : highestFoundVersion;
|
highestFoundVersion = foundVersion > highestFoundVersion ? foundVersion : highestFoundVersion;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return PreCheckResult.FromError($".Net Core Desktop Runtime version {minRequiredVersion} or higher is required.\n\nHighest Version Found: {(highestFoundVersion > new Version("0.0.0") ? highestFoundVersion : "Not Found")}\n\nThis is required to play SPT, but you can install it later if and shouldn't affect the SPT install process.", failedButtonText, failedButtonAction);
|
return PreCheckResult.FromError($".Net Core Desktop Runtime version {minRequiredVersion} or higher is required.\n\nHighest Version Found: {(highestFoundVersion > new Version("0.0.0") ? highestFoundVersion : "Not Found")}\n\nThis is required to play SPT, but you can install it later if and shouldn't affect the SPT install process.", failedButtonText, failedButtonAction);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
using Serilog;
|
||||||
using SPTInstaller.Models;
|
using SPTInstaller.Models;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -55,8 +56,7 @@ public class NetFramework472PreCheck : PreCheckBase
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// TODO: log exceptions
|
Log.Error(ex, $"PreCheck::{Name}::Exception");
|
||||||
|
|
||||||
return PreCheckResult.FromException(ex);
|
return PreCheckResult.FromException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
<PackageIcon>icon.ico</PackageIcon>
|
<PackageIcon>icon.ico</PackageIcon>
|
||||||
<ApplicationIcon>Assets\icon.ico</ApplicationIcon>
|
<ApplicationIcon>Assets\icon.ico</ApplicationIcon>
|
||||||
<Configurations>Debug;Release;TEST</Configurations>
|
<Configurations>Debug;Release;TEST</Configurations>
|
||||||
<AssemblyVersion>2.10</AssemblyVersion>
|
<AssemblyVersion>2.11</AssemblyVersion>
|
||||||
<FileVersion>2.10</FileVersion>
|
<FileVersion>2.11</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user