Validate installed fpcalc version
This commit is contained in:
parent
56fdbef0ec
commit
08c6c48934
@ -14,6 +14,11 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class FPCalc
|
public static class FPCalc
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Minimum fpcalc version that can be used.
|
||||||
|
/// </summary>
|
||||||
|
private static Version minimumFPCalcVersion = new Version(1, 4, 3);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the logger.
|
/// Gets or sets the logger.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -27,9 +32,29 @@ public static class FPCalc
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var version = GetOutput("-version", 2000);
|
var rawVersion = GetOutput("-version", 2000).TrimEnd();
|
||||||
Logger?.LogDebug("fpcalc version: {Version}", version);
|
if (!rawVersion.StartsWith("fpcalc version", StringComparison.OrdinalIgnoreCase))
|
||||||
return version.StartsWith("fpcalc version", StringComparison.OrdinalIgnoreCase);
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger?.LogDebug("raw fpcalc version: {Version}", rawVersion);
|
||||||
|
|
||||||
|
var version = Version.Parse(rawVersion.AsSpan(15));
|
||||||
|
|
||||||
|
Logger?.LogDebug("Found fpcalc version {Version}", version);
|
||||||
|
|
||||||
|
var okay = version >= minimumFPCalcVersion;
|
||||||
|
|
||||||
|
if (!okay)
|
||||||
|
{
|
||||||
|
Logger?.LogError(
|
||||||
|
"installed fpcalc version of {Version} is too old (minimum is {Minimum})",
|
||||||
|
version,
|
||||||
|
minimumFPCalcVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
return okay;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user