Renamed file.

This commit is contained in:
Jim Cartlidge 2020-09-14 18:23:50 +01:00
parent f73e744785
commit d27d2a8990
2 changed files with 34 additions and 23 deletions

View File

@ -1051,27 +1051,38 @@ namespace Emby.Server.Implementations
var dllList = new List<string>(); var dllList = new List<string>();
var versions = new List<(Version PluginVersion, string Name, string Path)>(); var versions = new List<(Version PluginVersion, string Name, string Path)>();
var directories = Directory.EnumerateDirectories(path, "*.*", SearchOption.TopDirectoryOnly); var directories = Directory.EnumerateDirectories(path, "*.*", SearchOption.TopDirectoryOnly);
string metafile;
foreach (var dir in directories) foreach (var dir in directories)
{ {
try try
{ {
var manifest = _jsonSerializer.DeserializeFromFile<PlugInManifest>(Path.Combine(dir, "meta.json")); metafile = Path.Combine(dir, "meta.json");
if (File.Exists(metafile))
if (!Version.TryParse(manifest.TargetAbi, out var targetAbi))
{ {
targetAbi = new Version(0, 0, 0, 1); var manifest = _jsonSerializer.DeserializeFromFile<PluginManifest>(metafile);
if (!Version.TryParse(manifest.TargetAbi, out var targetAbi))
{
targetAbi = new Version(0, 0, 0, 1);
}
if (!Version.TryParse(manifest.Version, out var version))
{
version = new Version(0, 0, 0, 1);
}
if (ApplicationVersion <= targetAbi)
{
// Only load Plugins if the plugin is built for this version or below.
versions.Add((version, manifest.Name, dir));
}
} }
else
if (!Version.TryParse(manifest.Version, out var version))
{ {
version = new Version(0, 0, 0, 1); metafile = dir.Split(new char[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries).Last();
} // Add it under the path name and version 0.0.0.1.
versions.Add((new Version("0.0.0.1"), metafile, dir));
if (targetAbi >= ApplicationVersion)
{
// Only load Plugins for this version or below.
versions.Add((version, manifest.Name, dir));
} }
} }
catch catch

View File

@ -9,52 +9,52 @@ namespace Emby.Server.Implementations.Plugins
{ {
/// <summary> /// <summary>
/// Gets or sets the category of the plugin. /// Gets or sets the category of the plugin.
/// </summary> /// </summary>
public string Category { get; set; } public string Category { get; set; }
/// <summary> /// <summary>
/// Gets or sets the changelog information. /// Gets or sets the changelog information.
/// </summary> /// </summary>
public string Changelog { get; set; } public string Changelog { get; set; }
/// <summary> /// <summary>
/// Gets or sets the description of the plugin. /// Gets or sets the description of the plugin.
/// </summary> /// </summary>
public string Description { get; set; } public string Description { get; set; }
/// <summary> /// <summary>
/// Gets or sets the Global Unique Identifier for the plugin. /// Gets or sets the Global Unique Identifier for the plugin.
/// </summary> /// </summary>
public Guid Guid { get; set; } public Guid Guid { get; set; }
/// <summary> /// <summary>
/// Gets or sets the Name of the plugin. /// Gets or sets the Name of the plugin.
/// </summary> /// </summary>
public string Name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// Gets or sets an overview of the plugin. /// Gets or sets an overview of the plugin.
/// </summary> /// </summary>
public string Overview { get; set; } public string Overview { get; set; }
/// <summary> /// <summary>
/// Gets or sets the owner of the plugin. /// Gets or sets the owner of the plugin.
/// </summary> /// </summary>
public string Owner { get; set; } public string Owner { get; set; }
/// <summary> /// <summary>
/// Gets or sets the compatibility version for the plugin. /// Gets or sets the compatibility version for the plugin.
/// </summary> /// </summary>
public string TargetAbi { get; set; } public string TargetAbi { get; set; }
/// <summary> /// <summary>
/// Gets or sets the timestamp of the plugin. /// Gets or sets the timestamp of the plugin.
/// </summary> /// </summary>
public DateTime Timestamp { get; set; } public DateTime Timestamp { get; set; }
/// <summary> /// <summary>
/// Gets or sets the Version number of the plugin. /// Gets or sets the Version number of the plugin.
/// </summary> /// </summary>
public string Version { get; set; } public string Version { get; set; }
} }
} }