This commit is contained in:
Luke Pulverenti 2017-08-28 12:41:32 -04:00
parent efc2fa1b30
commit 780b761456
5 changed files with 26 additions and 12 deletions

View File

@ -316,7 +316,6 @@ namespace Emby.Dlna
profile = ReserializeProfile(tempProfile); profile = ReserializeProfile(tempProfile);
profile.Id = path.ToLower().GetMD5().ToString("N"); profile.Id = path.ToLower().GetMD5().ToString("N");
profile.ProfileType = type;
_profiles[path] = new Tuple<InternalProfileInfo, DeviceProfile>(GetInternalProfileInfo(_fileSystem.GetFileInfo(path), type), profile); _profiles[path] = new Tuple<InternalProfileInfo, DeviceProfile>(GetInternalProfileInfo(_fileSystem.GetFileInfo(path), type), profile);

View File

@ -1482,13 +1482,26 @@ namespace Emby.Server.Implementations
var assembly = plugin.GetType().Assembly; var assembly = plugin.GetType().Assembly;
var assemblyName = assembly.GetName(); var assemblyName = assembly.GetName();
var attribute = (GuidAttribute)assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0];
var assemblyId = new Guid(attribute.Value);
var assemblyFileName = assemblyName.Name + ".dll"; var assemblyFileName = assemblyName.Name + ".dll";
var assemblyFilePath = Path.Combine(ApplicationPaths.PluginsPath, assemblyFileName); var assemblyFilePath = Path.Combine(ApplicationPaths.PluginsPath, assemblyFileName);
assemblyPlugin.SetAttributes(assemblyFilePath, assemblyFileName, assemblyName.Version, assemblyId); assemblyPlugin.SetAttributes(assemblyFilePath, assemblyFileName, assemblyName.Version);
try
{
var idAttributes = assembly.GetCustomAttributes(typeof(GuidAttribute), true);
if (idAttributes.Length > 0)
{
var attribute = (GuidAttribute)idAttributes[0];
var assemblyId = new Guid(attribute.Value);
assemblyPlugin.SetId(assemblyId);
}
}
catch (Exception ex)
{
Logger.ErrorException("Error getting plugin Id from {0}.", ex, plugin.GetType().FullName);
}
} }
var isFirstRun = !File.Exists(plugin.ConfigurationFilePath); var isFirstRun = !File.Exists(plugin.ConfigurationFilePath);

View File

@ -55,11 +55,15 @@ namespace MediaBrowser.Common.Plugins
get { return typeof(TConfigurationType); } get { return typeof(TConfigurationType); }
} }
public void SetAttributes(string assemblyFilePath, string assemblyFileName, Version assemblyVersion, Guid assemblyId) public void SetAttributes(string assemblyFilePath, string assemblyFileName, Version assemblyVersion)
{ {
AssemblyFilePath = assemblyFilePath; AssemblyFilePath = assemblyFilePath;
AssemblyFileName = assemblyFileName; AssemblyFileName = assemblyFileName;
Version = assemblyVersion; Version = assemblyVersion;
}
public void SetId(Guid assemblyId)
{
Id = assemblyId; Id = assemblyId;
} }
@ -78,7 +82,7 @@ namespace MediaBrowser.Common.Plugins
/// Gets the unique id. /// Gets the unique id.
/// </summary> /// </summary>
/// <value>The unique id.</value> /// <value>The unique id.</value>
public Guid Id { get; private set; } public virtual Guid Id { get; private set; }
/// <summary> /// <summary>
/// Gets the plugin version /// Gets the plugin version
@ -284,6 +288,7 @@ namespace MediaBrowser.Common.Plugins
public interface IPluginAssembly public interface IPluginAssembly
{ {
void SetAttributes(string assemblyFilePath, string assemblyFileName, Version assemblyVersion, Guid assemblyId); void SetAttributes(string assemblyFilePath, string assemblyFileName, Version assemblyVersion);
void SetId(Guid assemblyId);
} }
} }

View File

@ -17,9 +17,6 @@ namespace MediaBrowser.Model.Dlna
[XmlIgnore] [XmlIgnore]
public string Id { get; set; } public string Id { get; set; }
[XmlIgnore]
public MediaBrowser.Model.Dlna.DeviceProfileType ProfileType { get; set; }
/// <summary> /// <summary>
/// Gets or sets the identification. /// Gets or sets the identification.
/// </summary> /// </summary>

View File

@ -1,3 +1,3 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("3.2.29.1")] [assembly: AssemblyVersion("3.2.29.2")]