PluginDataModel.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using GreenTree.Nachtragsmanagement.Core;
  2. using GreenTree.Nachtragsmanagement.Core.Plugins;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Web;
  7. namespace GreenTree.Nachtragsmanagement.Web.Models.Admin.Plugins
  8. {
  9. public class PluginDataModel
  10. {
  11. public bool IsInstalled { get; set; }
  12. public string SystemName { get; set; }
  13. public string FriendlyName { get; set; }
  14. public string LogoUrl { get; set; }
  15. public string Group { get; set; }
  16. public string Author { get; set; }
  17. public string Version { get; set; }
  18. public static PluginDataModel FromPluginDesciptor(PluginDescriptor descriptor, IWebHelper webHelper)
  19. {
  20. if (descriptor == null)
  21. throw new ArgumentNullException("descriptor", "Cannot create PluginDataModel from NULL plugin descriptor.");
  22. return new PluginDataModel
  23. {
  24. IsInstalled = descriptor.Installed,
  25. SystemName = descriptor.SystemName,
  26. FriendlyName = descriptor.FriendlyName,
  27. LogoUrl = descriptor.GetLogoUrl(webHelper),
  28. Group = descriptor.Group,
  29. Author = descriptor.Author,
  30. Version = descriptor.Version
  31. };
  32. }
  33. }
  34. }