From 0a2aaa693f42b3409d5aa085908ca8d7e1f6f51c Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 23 May 2024 14:11:42 -0600 Subject: [PATCH] feat: Replaces Crestron.SimplSharp.Reflection with System.Reflextion and updates the way essentials plugin versions are stored and retrieved --- .../Bridges/BridgeBase.cs | 4 +- .../Config/InfoConfig.cs | 14 +++--- .../Devices/DeviceJsonApi.cs | 20 ++++----- .../Devices/DeviceManager.cs | 2 +- .../Devices/EssentialsDevice.cs | 2 +- .../Devices/IHasFeedbacks.cs | 6 +-- .../Factory/DeviceFactory.cs | 22 +++++----- .../Factory/IDeviceFactory.cs | 12 +---- .../ProcessorExtensionDeviceFactory.cs | 8 ++-- .../Global/Global.cs | 1 + .../JoinMaps/JoinMapBase.cs | 8 ++-- .../PepperDash.Essentials.Core.csproj | 5 ++- .../Plugins/PluginLoader.cs | 44 ++++++++++++++----- .../Web/EssentialsWebApiHelpers.cs | 2 +- .../Cameras/CameraBase.cs | 2 +- .../Cameras/CameraVisca.cs | 2 +- .../DeviceFactory.cs | 4 +- ...epperDash.Essentials.Devices.Common.csproj | 5 ++- .../Streaming/AppleTV.cs | 4 +- .../VideoCodec/VideoCodecBase.cs | 2 +- src/PepperDash.Essentials/ControlSystem.cs | 8 +--- ...onfigurationFile-HuddleSpace-2-Source.json | 2 +- .../Factory/DeviceFactory.cs | 4 +- .../PepperDash.Essentials.csproj | 6 ++- 24 files changed, 100 insertions(+), 89 deletions(-) diff --git a/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs b/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs index b4bef5b8..c9784647 100644 --- a/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs +++ b/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; using Crestron.SimplSharp; -using Crestron.SimplSharp.Reflection; +using System.Reflection; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.EthernetCommunication; @@ -168,7 +168,7 @@ namespace PepperDash.Essentials.Core.Bridges Debug.LogMessage(LogEventLevel.Debug, this, "Linking Device: '{0}'", device.Key); - if (!typeof(IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType())) + if (!typeof(IBridgeAdvanced).IsAssignableFrom(device.GetType().GetType())) { Debug.LogMessage(LogEventLevel.Information, this, "{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.", diff --git a/src/PepperDash.Essentials.Core/Config/InfoConfig.cs b/src/PepperDash.Essentials.Core/Config/InfoConfig.cs index 32a6f71e..12ca49f4 100644 --- a/src/PepperDash.Essentials.Core/Config/InfoConfig.cs +++ b/src/PepperDash.Essentials.Core/Config/InfoConfig.cs @@ -1,18 +1,16 @@  +using Crestron.SimplSharp; +using Newtonsoft.Json; using System; using System.Collections.Generic; -using Crestron.SimplSharp; -using Crestron.SimplSharp.Reflection; - -using Newtonsoft.Json; namespace PepperDash.Essentials.Core.Config { - /// - /// Represents the info section of a Config file - /// - public class InfoConfig + /// + /// Represents the info section of a Config file + /// + public class InfoConfig { [JsonProperty("name")] public string Name { get; set; } diff --git a/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs b/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs index 691aea55..9d0b9616 100644 --- a/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs +++ b/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using Crestron.SimplSharp.Reflection; +using System.Reflection; using Newtonsoft.Json; using PepperDash.Core; @@ -63,7 +63,7 @@ namespace PepperDash.Essentials.Core action.Params = new object[0]; } - CType t = obj.GetType(); + Type t = obj.GetType(); try { var methods = t.GetMethods().Where(m => m.Name == action.MethodName).ToList(); @@ -121,7 +121,7 @@ namespace PepperDash.Essentials.Core if (obj == null) return "{ \"error\":\"No Device\"}"; - CType t = obj.GetType(); + Type t = obj.GetType(); // get the properties and set them into a new collection of NameType wrappers var props = t.GetProperties().Select(p => new PropertyNameType(p, obj)); return JsonConvert.SerializeObject(props, Formatting.Indented); @@ -139,7 +139,7 @@ namespace PepperDash.Essentials.Core if(dev == null) return "{ \"error\":\"No Device\"}"; - object prop = dev.GetType().GetCType().GetProperty(propertyName).GetValue(dev, null); + object prop = dev.GetType().GetType().GetProperty(propertyName).GetValue(dev, null); // var prop = t.GetProperty(propertyName); if (prop != null) @@ -165,7 +165,7 @@ namespace PepperDash.Essentials.Core return "{ \"error\":\"No Device\"}"; // Package up method names using helper objects - CType t = obj.GetType(); + Type t = obj.GetType(); var methods = t.GetMethods() .Where(m => !m.IsSpecialName) .Select(p => new MethodNameParams(p)); @@ -179,7 +179,7 @@ namespace PepperDash.Essentials.Core return "{ \"error\":\"No Device\"}"; // Package up method names using helper objects - CType t = obj.GetType(); + Type t = obj.GetType(); var methods = t.GetMethods() .Where(m => !m.IsSpecialName) .Where(m => m.GetCustomAttributes(typeof(ApiAttribute), true).Any()) @@ -226,7 +226,7 @@ namespace PepperDash.Essentials.Core Debug.LogMessage(LogEventLevel.Information, dev, " Checking for collection '{0}', index '{1}'", objName, indexStr); } - CType oType = obj.GetType(); + Type oType = obj.GetType(); var prop = oType.GetProperty(objName); if (prop == null) { @@ -256,7 +256,7 @@ namespace PepperDash.Essentials.Core obj = indexedPropInfo.GetValue(collection, new object[] { properParam }); } // if the index is bad, catch it here. - catch (Crestron.SimplSharp.Reflection.TargetInvocationException e) + catch (TargetInvocationException e) { if (e.InnerException is ArgumentOutOfRangeException) Debug.LogMessage(LogEventLevel.Information, " Index Out of range"); @@ -287,7 +287,7 @@ namespace PepperDash.Essentials.Core //if (obj == null) // return "{\"error\":\"No object found\"}"; - //CType t = obj.GetType(); + //Type t = obj.GetType(); //// get the properties and set them into a new collection of NameType wrappers @@ -365,7 +365,7 @@ namespace PepperDash.Essentials.Core } [AttributeUsage(AttributeTargets.All)] - public class ApiAttribute : CAttribute + public class ApiAttribute : Attribute { } diff --git a/src/PepperDash.Essentials.Core/Devices/DeviceManager.cs b/src/PepperDash.Essentials.Core/Devices/DeviceManager.cs index 916cc42f..e92d11c5 100644 --- a/src/PepperDash.Essentials.Core/Devices/DeviceManager.cs +++ b/src/PepperDash.Essentials.Core/Devices/DeviceManager.cs @@ -166,7 +166,7 @@ namespace PepperDash.Essentials.Core // var dev = GetDeviceForKey(devKey); // if(dev != null) // { - // var type = dev.GetType().GetCType(); + // var type = dev.GetType().GetType(); // var methods = type.GetMethods(BindingFlags.Public|BindingFlags.Instance); // var sb = new StringBuilder(); // sb.AppendLine(string.Format("{2} methods on [{0}] ({1}):", dev.Key, type.Name, methods.Length)); diff --git a/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs b/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs index e383627d..8b0fc9fe 100644 --- a/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs +++ b/src/PepperDash.Essentials.Core/Devices/EssentialsDevice.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using Crestron.SimplSharp.Reflection; +using System.Reflection; using PepperDash.Core; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Devices/IHasFeedbacks.cs b/src/PepperDash.Essentials.Core/Devices/IHasFeedbacks.cs index 5241a147..9943c738 100644 --- a/src/PepperDash.Essentials.Core/Devices/IHasFeedbacks.cs +++ b/src/PepperDash.Essentials.Core/Devices/IHasFeedbacks.cs @@ -1,7 +1,5 @@ -using System.Collections.Generic; +using System; using System.Linq; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharp.Reflection; using PepperDash.Core; using Serilog.Events; @@ -23,7 +21,7 @@ namespace PepperDash.Essentials.Core { public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates) { - CType t = source.GetType(); + Type t = source.GetType(); // get the properties and set them into a new collection of NameType wrappers var props = t.GetProperties().Select(p => new PropertyNameType(p, t)); diff --git a/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs b/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs index 65b410e6..63c6b224 100644 --- a/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs +++ b/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs @@ -1,7 +1,7 @@  using Crestron.SimplSharp; -using Crestron.SimplSharp.Reflection; +using System.Reflection; using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core.Config; @@ -14,13 +14,13 @@ namespace PepperDash.Essentials.Core { public class DeviceFactoryWrapper { - public CType CType { get; set; } + public Type Type { get; set; } public string Description { get; set; } public Func FactoryMethod { get; set; } public DeviceFactoryWrapper() { - CType = null; + Type = null; Description = "Not Available"; } } @@ -40,7 +40,7 @@ namespace PepperDash.Essentials.Core { try { - var factory = (IDeviceFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(type); + var factory = (IDeviceFactory)Activator.CreateInstance(type); factory.LoadTypeFactories(); } catch (Exception e) @@ -69,7 +69,7 @@ namespace PepperDash.Essentials.Core DeviceFactory.FactoryMethods.Add(typeName, new DeviceFactoryWrapper() { FactoryMethod = method}); } - public static void AddFactoryForType(string typeName, string description, CType cType, Func method) + public static void AddFactoryForType(string typeName, string description, Type Type, Func method) { //Debug.LogMessage(LogEventLevel.Debug, "Adding factory method for type '{0}'", typeName); @@ -79,7 +79,7 @@ namespace PepperDash.Essentials.Core return; } - var wrapper = new DeviceFactoryWrapper() { CType = cType, Description = description, FactoryMethod = method }; + var wrapper = new DeviceFactoryWrapper() { Type = Type, Description = description, FactoryMethod = method }; DeviceFactory.FactoryMethods.Add(typeName, wrapper); } @@ -180,17 +180,17 @@ namespace PepperDash.Essentials.Core foreach (var type in types.OrderBy(t => t.Key)) { var description = type.Value.Description; - var cType = "Not Specified by Plugin"; + var Type = "Not Specified by Plugin"; - if (type.Value.CType != null) + if (type.Value.Type != null) { - cType = type.Value.CType.FullName; + Type = type.Value.Type.FullName; } CrestronConsole.ConsoleCommandResponse( @"Type: '{0}' - CType: '{1}' - Description: {2}{3}", type.Key, cType, description, CrestronEnvironment.NewLine); + Type: '{1}' + Description: {2}{3}", type.Key, Type, description, CrestronEnvironment.NewLine); } } diff --git a/src/PepperDash.Essentials.Core/Factory/IDeviceFactory.cs b/src/PepperDash.Essentials.Core/Factory/IDeviceFactory.cs index 91e073f2..9f7eec58 100644 --- a/src/PepperDash.Essentials.Core/Factory/IDeviceFactory.cs +++ b/src/PepperDash.Essentials.Core/Factory/IDeviceFactory.cs @@ -1,14 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharp.Reflection; - -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core +namespace PepperDash.Essentials.Core { /// /// Defines a class that is capable of loading device types diff --git a/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs b/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs index 68f5dc1f..b67dcf5b 100644 --- a/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs +++ b/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs @@ -1,5 +1,5 @@  -using Crestron.SimplSharp.Reflection; +using System.Reflection; using PepperDash.Core; using PepperDash.Essentials.Core.Config; using Serilog.Events; @@ -25,7 +25,7 @@ namespace PepperDash.Essentials.Core { try { - var factory = (IProcessorExtensionDeviceFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(extension); + var factory = (IProcessorExtensionDeviceFactory)Activator.CreateInstance(extension); factory.LoadFactories(); } catch( Exception e ) @@ -55,7 +55,7 @@ namespace PepperDash.Essentials.Core ProcessorExtensionDeviceFactory.ProcessorExtensionFactoryMethods.Add(extensionName, new DeviceFactoryWrapper() { FactoryMethod = method }); } - public static void AddFactoryForType(string extensionName, string description, CType cType, Func method) + public static void AddFactoryForType(string extensionName, string description, Type Type, Func method) { //Debug.LogMessage(LogEventLevel.Debug, "Adding factory method for type '{0}'", typeName); @@ -65,7 +65,7 @@ namespace PepperDash.Essentials.Core return; } - var wrapper = new DeviceFactoryWrapper() { CType = cType, Description = description, FactoryMethod = method }; + var wrapper = new DeviceFactoryWrapper() { Type = Type, Description = description, FactoryMethod = method }; ProcessorExtensionDeviceFactory.ProcessorExtensionFactoryMethods.Add(extensionName, wrapper); } diff --git a/src/PepperDash.Essentials.Core/Global/Global.cs b/src/PepperDash.Essentials.Core/Global/Global.cs index b69143af..9e4b6462 100644 --- a/src/PepperDash.Essentials.Core/Global/Global.cs +++ b/src/PepperDash.Essentials.Core/Global/Global.cs @@ -137,6 +137,7 @@ namespace PepperDash.Essentials.Core public static void SetFilePathPrefix(string prefix) { FilePathPrefix = prefix; + Debug.LogMessage(LogEventLevel.Information, "File Path Prefix set to '{0}'", FilePathPrefix); } static string _AssemblyVersion; diff --git a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs index f8a7e4d2..dda04445 100644 --- a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs +++ b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; -using Crestron.SimplSharp.Reflection; +using System.Reflection; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharp; @@ -109,7 +109,7 @@ namespace PepperDash.Essentials.Core protected void AddJoins(Type type) { var fields = - type.GetCType() + type.GetType() .GetFields(BindingFlags.Public | BindingFlags.Instance) .Where(f => f.IsDefined(typeof (JoinNameAttribute), true)); @@ -501,7 +501,7 @@ namespace PepperDash.Essentials.Core public string GetNameAttribute(MemberInfo memberInfo) { var name = string.Empty; - var attribute = (JoinNameAttribute)CAttribute.GetCustomAttribute(memberInfo, typeof(JoinNameAttribute)); + var attribute = (JoinNameAttribute)Attribute.GetCustomAttribute(memberInfo, typeof(JoinNameAttribute)); if (attribute == null) return name; @@ -514,7 +514,7 @@ namespace PepperDash.Essentials.Core [AttributeUsage(AttributeTargets.All)] - public class JoinNameAttribute : CAttribute + public class JoinNameAttribute : Attribute { private string _Name; diff --git a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj index 6c1a058e..72dbb279 100644 --- a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj +++ b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj @@ -11,6 +11,9 @@ PepperDash.Essentials.Core PepperDash Essentials Core PepperDash.Essentials.Core + $(Version) + false + 2.0.0-local full @@ -23,7 +26,7 @@ - + diff --git a/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs b/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs index 3e658ea1..3b70b112 100644 --- a/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs +++ b/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs @@ -1,14 +1,14 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Crestron.SimplSharp.Reflection; +using System.Reflection; using PepperDash.Core; using PepperDash.Essentials.Core; using Serilog.Events; +using Newtonsoft.Json; namespace PepperDash.Essentials { @@ -27,24 +27,29 @@ namespace PepperDash.Essentials /// static List LoadedPluginFolderAssemblies; + public static LoadedAssembly EssentialsAssembly { get; private set; } + + public static List EssentialsPluginAssemblies { get; private set; } + /// /// The directory to look in for .cplz plugin packages /// - static string _pluginDirectory = Global.FilePathPrefix + "plugins"; + static string _pluginDirectory => Global.FilePathPrefix + "plugins"; /// /// The directory where plugins will be moved to and loaded from /// - static string _loadedPluginsDirectoryPath = _pluginDirectory + Global.DirectorySeparator + "loadedAssemblies"; + static string _loadedPluginsDirectoryPath => _pluginDirectory + Global.DirectorySeparator + "loadedAssemblies"; // The temp directory where .cplz archives will be unzipped to - static string _tempDirectory = _pluginDirectory + Global.DirectorySeparator + "temp"; + static string _tempDirectory => _pluginDirectory + Global.DirectorySeparator + "temp"; static PluginLoader() { LoadedAssemblies = new List(); LoadedPluginFolderAssemblies = new List(); + EssentialsPluginAssemblies = new List(); } /// @@ -69,6 +74,7 @@ namespace PepperDash.Essentials case ("PepperDashEssentials.dll"): { version = Global.AssemblyVersion; + EssentialsAssembly = new LoadedAssembly(fi.Name, version, assembly); break; } case ("PepperDash_Essentials_Core.dll"): @@ -144,7 +150,7 @@ namespace PepperDash.Essentials /// /// /// - static string GetAssemblyVersion(Assembly assembly) + public static string GetAssemblyVersion(Assembly assembly) { var ver = assembly.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false); if (ver != null && ver.Length > 0) @@ -190,12 +196,18 @@ namespace PepperDash.Essentials /// public static void ReportAssemblyVersions(string command) { - - CrestronConsole.ConsoleCommandResponse("Loaded Assemblies:" + CrestronEnvironment.NewLine); - foreach (var assembly in LoadedAssemblies) + CrestronConsole.ConsoleCommandResponse("Essentials Version: {0}" + CrestronEnvironment.NewLine, Global.AssemblyVersion); + CrestronConsole.ConsoleCommandResponse("Essentials Plugin Versions:" + CrestronEnvironment.NewLine); + foreach (var assembly in EssentialsPluginAssemblies) { CrestronConsole.ConsoleCommandResponse("{0} Version: {1}" + CrestronEnvironment.NewLine, assembly.Name, assembly.Version); } + + //CrestronConsole.ConsoleCommandResponse("Loaded Assemblies:" + CrestronEnvironment.NewLine); + //foreach (var assembly in LoadedAssemblies) + //{ + // CrestronConsole.ConsoleCommandResponse("{0} Version: {1}" + CrestronEnvironment.NewLine, assembly.Name, assembly.Version); + //} } /// /// Moves any .dll assemblies not already loaded from the plugins folder to loadedPlugins folder @@ -354,7 +366,7 @@ namespace PepperDash.Essentials try { var assy = loadedAssembly.Assembly; - CType[] types = {}; + Type[] types = {}; try { types = assy.GetTypes(); @@ -375,7 +387,7 @@ namespace PepperDash.Essentials if (typeof (IPluginDeviceFactory).IsAssignableFrom(type) && !type.IsAbstract) { var plugin = - (IPluginDeviceFactory) Crestron.SimplSharp.Reflection.Activator.CreateInstance(type); + (IPluginDeviceFactory)Activator.CreateInstance(type); LoadCustomPlugin(plugin, loadedAssembly); } } @@ -432,6 +444,9 @@ namespace PepperDash.Essentials Debug.LogMessage(LogEventLevel.Information, "Loading plugin: {0}", loadedAssembly.Name); plugin.LoadTypeFactories(); + + if(!EssentialsPluginAssemblies.Contains(loadedAssembly)) + EssentialsPluginAssemblies.Add(loadedAssembly); } /// @@ -439,7 +454,7 @@ namespace PepperDash.Essentials /// /// /// - static void LoadCustomLegacyPlugin(CType type, MethodInfo loadPlugin, LoadedAssembly loadedAssembly) + static void LoadCustomLegacyPlugin(Type type, MethodInfo loadPlugin, LoadedAssembly loadedAssembly) { Debug.LogMessage(LogEventLevel.Verbose, "LoadPlugin method found in {0}", type.Name); @@ -486,6 +501,8 @@ namespace PepperDash.Essentials /// public static void LoadPlugins() { + Debug.LogMessage(LogEventLevel.Information, "Attempting to Load Plugins from {_pluginDirectory}", _pluginDirectory); + if (Directory.Exists(_pluginDirectory)) { Debug.LogMessage(LogEventLevel.Information, "Plugins directory found, checking for plugins"); @@ -514,8 +531,11 @@ namespace PepperDash.Essentials /// public class LoadedAssembly { + [JsonProperty("name")] public string Name { get; private set; } + [JsonProperty("version")] public string Version { get; private set; } + [JsonIgnore] public Assembly Assembly { get; private set; } public LoadedAssembly(string name, string version, Assembly assembly) diff --git a/src/PepperDash.Essentials.Core/Web/EssentialsWebApiHelpers.cs b/src/PepperDash.Essentials.Core/Web/EssentialsWebApiHelpers.cs index 89718fcf..3a3dd756 100644 --- a/src/PepperDash.Essentials.Core/Web/EssentialsWebApiHelpers.cs +++ b/src/PepperDash.Essentials.Core/Web/EssentialsWebApiHelpers.cs @@ -80,7 +80,7 @@ namespace PepperDash.Essentials.Core.Web { Type = device.Key, Description = device.Value.Description, - CType = device.Value.CType == null ? "---": device.Value.CType.ToString() + CType = device.Value.Type == null ? "---": device.Value.Type.ToString() }; } } diff --git a/src/PepperDash.Essentials.Devices.Common/Cameras/CameraBase.cs b/src/PepperDash.Essentials.Devices.Common/Cameras/CameraBase.cs index d606249f..4d59fe90 100644 --- a/src/PepperDash.Essentials.Devices.Common/Cameras/CameraBase.cs +++ b/src/PepperDash.Essentials.Devices.Common/Cameras/CameraBase.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using System.Text.RegularExpressions; using Crestron.SimplSharp; -using Crestron.SimplSharp.Reflection; +using System.Reflection; using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; diff --git a/src/PepperDash.Essentials.Devices.Common/Cameras/CameraVisca.cs b/src/PepperDash.Essentials.Devices.Common/Cameras/CameraVisca.cs index 302aa0f1..fa82ba1f 100644 --- a/src/PepperDash.Essentials.Devices.Common/Cameras/CameraVisca.cs +++ b/src/PepperDash.Essentials.Devices.Common/Cameras/CameraVisca.cs @@ -12,7 +12,7 @@ using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Devices.Common.Codec; using System.Text.RegularExpressions; -using Crestron.SimplSharp.Reflection; +using System.Reflection; using Newtonsoft.Json; using Serilog.Events; diff --git a/src/PepperDash.Essentials.Devices.Common/DeviceFactory.cs b/src/PepperDash.Essentials.Devices.Common/DeviceFactory.cs index bd8cf92f..0f1f973f 100644 --- a/src/PepperDash.Essentials.Devices.Common/DeviceFactory.cs +++ b/src/PepperDash.Essentials.Devices.Common/DeviceFactory.cs @@ -2,7 +2,7 @@ using System; using System.Linq; -using Crestron.SimplSharp.Reflection; +using System.Reflection; using PepperDash.Core; using PepperDash.Essentials.Core; using Serilog.Events; @@ -25,7 +25,7 @@ namespace PepperDash.Essentials.Devices.Common { try { - var factory = (IDeviceFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(type); + var factory = (IDeviceFactory)Activator.CreateInstance(type); factory.LoadTypeFactories(); } catch (Exception e) diff --git a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj index c34ec280..ac5d9790 100644 --- a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj +++ b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj @@ -12,6 +12,9 @@ True PepperDash Essentials Devices Common PepperDash.Essentials.Devices.Common + 2.0.0-local + $(Version) + false full @@ -27,6 +30,6 @@ - + \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/Streaming/AppleTV.cs b/src/PepperDash.Essentials.Devices.Common/Streaming/AppleTV.cs index 5c8f9163..643db30d 100644 --- a/src/PepperDash.Essentials.Devices.Common/Streaming/AppleTV.cs +++ b/src/PepperDash.Essentials.Devices.Common/Streaming/AppleTV.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using Crestron.SimplSharp.Reflection; +using System.Reflection; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Newtonsoft.Json; @@ -42,7 +42,7 @@ namespace PepperDash.Essentials.Devices.Common public void PrintExpectedIrCommands() { - var cmds = typeof (AppleTvIrCommands).GetCType().GetFields(BindingFlags.Public | BindingFlags.Static); + var cmds = typeof (AppleTvIrCommands).GetType().GetFields(BindingFlags.Public | BindingFlags.Static); foreach (var value in cmds.Select(cmd => cmd.GetValue(null)).OfType()) { diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs index b4b2efad..f2a98a8d 100644 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs +++ b/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs @@ -1214,7 +1214,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec var entryIndex = counterIndex; Debug.LogMessage(LogEventLevel.Verbose, this, "Entry{2:0000} Name: {0}, Folder ID: {1}, Type: {3}, ParentFolderId: {4}", - entry.Name, entry.FolderId, entryIndex, entry.GetType().GetCType().FullName, entry.ParentFolderId); + entry.Name, entry.FolderId, entryIndex, entry.GetType().GetType().FullName, entry.ParentFolderId); if (entry is DirectoryFolder) { diff --git a/src/PepperDash.Essentials/ControlSystem.cs b/src/PepperDash.Essentials/ControlSystem.cs index 84bf12ec..f084e6a5 100644 --- a/src/PepperDash.Essentials/ControlSystem.cs +++ b/src/PepperDash.Essentials/ControlSystem.cs @@ -1,7 +1,7 @@  using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Crestron.SimplSharp.Reflection; +using System.Reflection; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.CrestronThread; using Crestron.SimplSharpPro.Diagnostics; @@ -172,11 +172,7 @@ namespace PepperDash.Essentials directoryPrefix = Directory.GetApplicationRootDirectory(); - var fullVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); - - Global.SetAssemblyVersion(fullVersion); - - //Global.SetAssemblyVersion(fullVersionAtt.InformationalVersion); + Global.SetAssemblyVersion(PluginLoader.GetAssemblyVersion(Assembly.GetExecutingAssembly())); if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) // Handles 3-series running Windows CE OS { diff --git a/src/PepperDash.Essentials/Example Configuration/EssentialsHuddleSpaceRoom/configurationFile-HuddleSpace-2-Source.json b/src/PepperDash.Essentials/Example Configuration/EssentialsHuddleSpaceRoom/configurationFile-HuddleSpace-2-Source.json index d3ce3275..7be04854 100644 --- a/src/PepperDash.Essentials/Example Configuration/EssentialsHuddleSpaceRoom/configurationFile-HuddleSpace-2-Source.json +++ b/src/PepperDash.Essentials/Example Configuration/EssentialsHuddleSpaceRoom/configurationFile-HuddleSpace-2-Source.json @@ -61,7 +61,7 @@ "supportedSystemTypes": [ "hudType", "presType", - "vtcType", + "vtType", "custom" ], "type": "rmc3", diff --git a/src/PepperDash.Essentials/Factory/DeviceFactory.cs b/src/PepperDash.Essentials/Factory/DeviceFactory.cs index 73063e30..262130f1 100644 --- a/src/PepperDash.Essentials/Factory/DeviceFactory.cs +++ b/src/PepperDash.Essentials/Factory/DeviceFactory.cs @@ -6,7 +6,7 @@ using System.Linq; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharpPro; -using Crestron.SimplSharp.Reflection; +using System.Reflection; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -35,7 +35,7 @@ namespace PepperDash.Essentials { try { - var factory = (IDeviceFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(type); + var factory = (IDeviceFactory)Activator.CreateInstance(type); factory.LoadTypeFactories(); } catch (Exception e) diff --git a/src/PepperDash.Essentials/PepperDash.Essentials.csproj b/src/PepperDash.Essentials/PepperDash.Essentials.csproj index 3d85afd5..4600ef2c 100644 --- a/src/PepperDash.Essentials/PepperDash.Essentials.csproj +++ b/src/PepperDash.Essentials/PepperDash.Essentials.csproj @@ -11,7 +11,9 @@ bin\$(Configuration)\ PepperDash Essentials PepperDashEssentials - $(Version) + 2.0.0-local + $(Version) + false full @@ -47,7 +49,7 @@ - +