awaitMessageBus.INSTANCE.SendError(new(Icons.Material.Filled.Error,$"The pandoc process exited unexpectedly."));
LOG.LogError("The pandoc process was exited with code {ProcessExitCode}",process.ExitCode);
returnfalse;
}
varversionMatch=PandocCmdRegex().Match(output);
if(!versionMatch.Success)
{
if(showMessages)
awaitMessageBus.INSTANCE.SendError(new(Icons.Material.Filled.Terminal,$"pandoc --version returned an invalid format."));
LOG.LogError("pandoc --version returned an invalid format:\n {Output}",output);
returnfalse;
}
varversions=versionMatch.Groups[1].Value;
varinstalledVersion=Version.Parse(versions);
if(installedVersion>=MINIMUM_REQUIRED_VERSION)
{
if(showMessages)
awaitMessageBus.INSTANCE.SendSuccess(new(Icons.Material.Filled.CheckCircle,$"Pandoc {installedVersion.ToString()} is installed."));
returntrue;
}
if(showMessages)
awaitMessageBus.INSTANCE.SendError(new(Icons.Material.Filled.Build,$"Pandoc {installedVersion.ToString()} is installed, but it doesn't match the required version ({MINIMUM_REQUIRED_VERSION.ToString()})."));
LOG.LogInformation("Pandoc {Installed} is installed, but it does not match the required version ({Requirement})",installedVersion.ToString(),MINIMUM_REQUIRED_VERSION.ToString());
returnfalse;
}
catch(Exceptione)
{
if(showMessages)
awaitMessageBus.INSTANCE.SendError(new(@Icons.Material.Filled.AppsOutage,"Pandoc is not installed."));
LOG.LogError("Pandoc is not installed and threw an exception:\n {Message}",e.Message);
awaitMessageBus.INSTANCE.SendError(new(Icons.Material.Filled.Error,$"Pandoc was not installed successfully, because the download archive was not found."));
LOG.LogError("Pandoc was not installed, the release archive was not found (Status Code {StatusCode}):\n{Uri}\n{Message}",response.StatusCode,uri,response.RequestMessage);
awaitMessageBus.INSTANCE.SendError(new(Icons.Material.Filled.Error,$"Pandoc was not installed successfully, because the download archive type is unknown."));
LOG.LogError("Pandoc was not installed, the download archive is unknown:\n {Uri}",uri);
LOG.LogError("Code {StatusCode}: Could not fetch Pandoc's latest page:\n {Response}",response.StatusCode,response.RequestMessage);
awaitMessageBus.INSTANCE.SendWarning(new(Icons.Material.Filled.Warning,$"The latest pandoc version was not found, installing version {FALLBACK_VERSION.ToString()} instead."));
LOG.LogError("The latest version regex returned nothing:\n {Value}",versionMatch.Groups.ToString());
awaitMessageBus.INSTANCE.SendWarning(new(Icons.Material.Filled.Warning,$"The latest pandoc version was not found, installing version {FALLBACK_VERSION.ToString()} instead."));
returnFALLBACK_VERSION.ToString();
}
varversion=versionMatch.Groups[1].Value;
returnversion;
}
/// <summary>
/// Reads the systems architecture to find the correct archive