Skip to content

Commit

Permalink
Add Cultiv.Hangfire to the list of installed packages with the curren…
Browse files Browse the repository at this point in the history
…t version listed
  • Loading branch information
nul800sebastiaan committed Nov 2, 2022
1 parent 8b3f5c9 commit 61117f0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Cultiv.Hangfire/ManifestFilter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using System.Collections.Generic;
using System.Diagnostics;
using Umbraco.Cms.Core.Manifest;
using Umbraco.Cms.Core.Semver;
using Umbraco.Extensions;

namespace Cultiv.Hangfire;

Expand All @@ -10,6 +13,7 @@ public void Filter(List<PackageManifest> manifests)
manifests.Add(new PackageManifest
{
PackageName = "Cultiv.Hangfire",
Version = GetVersion(),
Dashboards = new[]
{
new ManifestDashboard
Expand All @@ -21,4 +25,19 @@ public void Filter(List<PackageManifest> manifests)
}
});
}

private static string GetVersion()
{
var assembly = typeof(global::Cultiv.Hangfire.ManifestFilter).Assembly;
try
{
var fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.GetAssemblyFile().FullName);
var productVersion = SemVersion.Parse(fileVersionInfo.ProductVersion);
return productVersion.ToSemanticStringWithoutBuild();
}
catch
{
return assembly.GetName().Version.ToString(3);
}
}
}

0 comments on commit 61117f0

Please sign in to comment.