Make all versioning functions internal, move to separate class

This commit is contained in:
goaaats 2025-12-15 21:31:25 +01:00
parent a1409096fd
commit 20af5b40c7
20 changed files with 142 additions and 130 deletions

View file

@ -1790,7 +1790,7 @@ internal class PluginManager : IInternalDisposableService
var updates = this.AvailablePlugins
.Where(remoteManifest => plugin.Manifest.InternalName == remoteManifest.InternalName)
.Where(remoteManifest => plugin.Manifest.InstalledFromUrl == remoteManifest.SourceRepo.PluginMasterUrl || !remoteManifest.SourceRepo.IsThirdParty)
.Where(remoteManifest => remoteManifest.MinimumDalamudVersion == null || Util.AssemblyVersionParsed >= remoteManifest.MinimumDalamudVersion)
.Where(remoteManifest => remoteManifest.MinimumDalamudVersion == null || Versioning.GetAssemblyVersionParsed() >= remoteManifest.MinimumDalamudVersion)
.Where(remoteManifest =>
{
var useTesting = this.UseTesting(remoteManifest);

View file

@ -315,7 +315,7 @@ internal class LocalPlugin : IAsyncDisposable
if (!this.CheckPolicy())
throw new PluginPreconditionFailedException($"Unable to load {this.Name} as a load policy forbids it");
if (this.Manifest.MinimumDalamudVersion != null && this.Manifest.MinimumDalamudVersion > Util.AssemblyVersionParsed)
if (this.Manifest.MinimumDalamudVersion != null && this.Manifest.MinimumDalamudVersion > Versioning.GetAssemblyVersionParsed())
throw new PluginPreconditionFailedException($"Unable to load {this.Name}, Dalamud version is lower than minimum required version {this.Manifest.MinimumDalamudVersion}");
this.State = PluginState.Loading;

View file

@ -59,7 +59,7 @@ internal class PluginRepository
},
UserAgent =
{
new ProductInfoHeaderValue("Dalamud", Util.AssemblyVersion),
new ProductInfoHeaderValue("Dalamud", Versioning.GetAssemblyVersion()),
},
},
};
@ -164,7 +164,7 @@ internal class PluginRepository
}
this.PluginMaster = pluginMaster.Where(this.IsValidManifest).ToList().AsReadOnly();
// API9 HACK: Force IsHide to false, we should remove that
if (!this.IsThirdParty)
{
@ -197,7 +197,7 @@ internal class PluginRepository
Log.Error("Plugin {PluginName} in {RepoLink} has an invalid Name.", manifest.InternalName, this.PluginMasterUrl);
return false;
}
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
if (manifest.AssemblyVersion == null)
{
@ -224,7 +224,7 @@ internal class PluginRepository
request.Headers.CacheControl = new CacheControlHeaderValue { NoCache = true };
using var requestCts = new CancellationTokenSource(TimeSpan.FromSeconds(timeout));
return await httpClient.SendAsync(request, requestCts.Token);
}
}