mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-22 00:15:48 +02:00
Remove Program.VersionFull and refactor plugin version checks
This commit is contained in:
parent
a3a52e0a1c
commit
c22934336b
@ -7,6 +7,9 @@
|
||||
|
||||
namespace TweetDuck.Plugins{
|
||||
sealed class Plugin{
|
||||
private static readonly Version AppVersion = new Version(Program.VersionTag);
|
||||
private const string VersionWildcard = "*";
|
||||
|
||||
public string Identifier { get; }
|
||||
public PluginGroup Group { get; }
|
||||
public PluginEnvironment Environments { get; private set; }
|
||||
@ -50,7 +53,7 @@ public string DefaultConfigPath{
|
||||
{ "WEBSITE", "" },
|
||||
{ "CONFIGFILE", "" },
|
||||
{ "CONFIGDEFAULT", "" },
|
||||
{ "REQUIRES", "*" }
|
||||
{ "REQUIRES", VersionWildcard }
|
||||
};
|
||||
|
||||
private bool? canRun;
|
||||
@ -209,7 +212,7 @@ private static bool LoadMetadata(string path, Plugin plugin, out string error){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (plugin.RequiredVersion.Length == 0 || !(plugin.RequiredVersion.Equals("*") || System.Version.TryParse(plugin.RequiredVersion, out Version _))){
|
||||
if (plugin.RequiredVersion.Length == 0 || !(plugin.RequiredVersion == VersionWildcard || System.Version.TryParse(plugin.RequiredVersion, out Version _))){
|
||||
error = "Plugin contains invalid version: "+plugin.RequiredVersion;
|
||||
return false;
|
||||
}
|
||||
@ -221,7 +224,7 @@ private static bool LoadMetadata(string path, Plugin plugin, out string error){
|
||||
}
|
||||
|
||||
private static bool CheckRequiredVersion(string requires){
|
||||
return requires.Equals("*", StringComparison.Ordinal) || Program.Version >= new Version(requires);
|
||||
return requires == VersionWildcard || AppVersion >= new Version(requires);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,7 @@ static class Program{
|
||||
public const string Website = "https://tweetduck.chylex.com";
|
||||
|
||||
public const string VersionTag = "1.8.7";
|
||||
public const string VersionFull = "1.8.7";
|
||||
|
||||
public static readonly Version Version = new Version(VersionTag);
|
||||
public static readonly bool IsPortable = File.Exists("makeportable");
|
||||
|
||||
public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
|
||||
@ -48,7 +46,7 @@ static class Program{
|
||||
|
||||
private static readonly LockManager LockManager = new LockManager(Path.Combine(StoragePath, ".lock"));
|
||||
private static bool HasCleanedUp;
|
||||
|
||||
|
||||
public static UserConfig UserConfig { get; private set; }
|
||||
public static SystemConfig SystemConfig { get; private set; }
|
||||
public static Reporter Reporter { get; }
|
||||
|
@ -34,8 +34,8 @@
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion(Program.VersionFull)]
|
||||
[assembly: AssemblyFileVersion(Program.VersionFull)]
|
||||
[assembly: AssemblyVersion(Program.VersionTag)]
|
||||
[assembly: AssemblyFileVersion(Program.VersionTag)]
|
||||
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user