Formatting

This commit is contained in:
Thorsten Sommer 2025-05-29 14:56:30 +02:00
parent 7ec2b19bf3
commit 40b6432f0f
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -34,7 +34,8 @@ public static partial class Pandoc
return true; return true;
} }
if (HasPandoc(installDir)) return true; if (HasPandoc(installDir))
return true;
try try
{ {
@ -103,21 +104,18 @@ public static partial class Pandoc
try try
{ {
var subdirectories = Directory.GetDirectories(pandocDirectory); var subdirectories = Directory.GetDirectories(pandocDirectory);
foreach (var subdirectory in subdirectories) foreach (var subdirectory in subdirectories)
{ {
var pandocPath = Path.Combine(subdirectory, "pandoc.exe"); var pandocPath = Path.Combine(subdirectory, "pandoc.exe");
if (File.Exists(pandocPath)) if (File.Exists(pandocPath))
{
return true; return true;
}
} }
return false; return false;
} }
catch (Exception ex) catch (Exception ex)
{ {
LOG.LogInformation("Pandoc is not installed in the data directory and might have thrown and error:\n{ErrorMessage}", ex.Message); LOG.LogInformation("Pandoc is not installed in the data directory and might have thrown and error: {0}", ex.Message);
return false; return false;
} }
} }
@ -207,17 +205,16 @@ public static partial class Pandoc
if (!response.IsSuccessStatusCode) if (!response.IsSuccessStatusCode)
{ {
LOG.LogError("Code {StatusCode}: Could not fetch Pandoc's latest page:\n {Response}", response.StatusCode, response.RequestMessage); LOG.LogError("Code {StatusCode}: Could not fetch Pandoc's latest page: {Response}", response.StatusCode, response.RequestMessage);
await MessageBus.INSTANCE.SendWarning(new (Icons.Material.Filled.Warning, $"The latest pandoc version was not found, installing version {FALLBACK_VERSION.ToString()} instead.")); await MessageBus.INSTANCE.SendWarning(new (Icons.Material.Filled.Warning, $"The latest pandoc version was not found, installing version {FALLBACK_VERSION.ToString()} instead."));
return FALLBACK_VERSION.ToString(); return FALLBACK_VERSION.ToString();
} }
var htmlContent = await response.Content.ReadAsStringAsync(); var htmlContent = await response.Content.ReadAsStringAsync();
var versionMatch = LatestVersionRegex().Match(htmlContent); var versionMatch = LatestVersionRegex().Match(htmlContent);
if (!versionMatch.Success) if (!versionMatch.Success)
{ {
LOG.LogError("The latest version regex returned nothing:\n {Value}", versionMatch.Groups.ToString()); LOG.LogError("The latest version regex returned nothing: {Value}", versionMatch.Groups.ToString());
await MessageBus.INSTANCE.SendWarning(new (Icons.Material.Filled.Warning, $"The latest pandoc version was not found, installing version {FALLBACK_VERSION.ToString()} instead.")); await MessageBus.INSTANCE.SendWarning(new (Icons.Material.Filled.Warning, $"The latest pandoc version was not found, installing version {FALLBACK_VERSION.ToString()} instead."));
return FALLBACK_VERSION.ToString(); return FALLBACK_VERSION.ToString();
} }