feature: use system.reflection now

This commit is contained in:
Nick Genovese
2023-02-24 17:37:29 -05:00
parent 14b6900460
commit 18cfa4a2eb
9 changed files with 305 additions and 28 deletions

View File

@@ -3,11 +3,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.GeneralIO;
using Crestron.SimplSharp.Reflection;
using PepperDash.Core;
using Full.Newtonsoft.Json.Linq;
using Full.Newtonsoft.Json;
@@ -20,7 +19,7 @@ namespace PepperDash.Essentials.Core
{
public class DeviceFactoryWrapper
{
public CType CType { get; set; }
public Type CType { get; set; }
public string Description { get; set; }
public Func<DeviceConfig, IKeyed> FactoryMethod { get; set; }
@@ -75,7 +74,7 @@ namespace PepperDash.Essentials.Core
DeviceFactory.FactoryMethods.Add(typeName, new DeviceFactoryWrapper() { FactoryMethod = method});
}
public static void AddFactoryForType(string typeName, string description, CType cType, Func<DeviceConfig, IKeyed> method)
public static void AddFactoryForType(string typeName, string description, Type cType, Func<DeviceConfig, IKeyed> method)
{
//Debug.Console(1, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);

View File

@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.Reflection;
using PepperDash.Core;
using PepperDash.Essentials.Core;
@@ -358,7 +358,7 @@ namespace PepperDash.Essentials
try
{
var assy = loadedAssembly.Assembly;
CType[] types = {};
Type[] types = {};
try
{
types = assy.GetTypes();
@@ -452,7 +452,7 @@ namespace PepperDash.Essentials
/// </summary>
/// <param name="type"></param>
/// <param name="loadPlugin"></param>
static void LoadCustomLegacyPlugin(CType type, MethodInfo loadPlugin, LoadedAssembly loadedAssembly)
static void LoadCustomLegacyPlugin(Type type, MethodInfo loadPlugin, LoadedAssembly loadedAssembly)
{
Debug.Console(2, "LoadPlugin method found in {0}", type.Name);

View File

@@ -3,13 +3,13 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.AirMedia;
using Crestron.SimplSharpPro.UI;
using Crestron.SimplSharp.Reflection;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;

View File

@@ -3,11 +3,10 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.GeneralIO;
using Crestron.SimplSharp.Reflection;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;

View File

@@ -3,12 +3,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.CrestronThread;
using Crestron.SimplSharpPro.Diagnostics;
using Crestron.SimplSharp.Reflection;
using PepperDash.Core;
using PepperDash.Essentials.Core;
@@ -147,13 +147,13 @@ namespace PepperDash.Essentials
string directoryPrefix;
directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory();
directoryPrefix = Directory.GetApplicationRootDirectory();
var fullVersion = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false);
AssemblyInformationalVersionAttribute fullVersionAtt = fullVersion[0] as AssemblyInformationalVersionAttribute;
var fullVersionAtt = fullVersion.FirstOrDefault() as AssemblyInformationalVersionAttribute;
Global.SetAssemblyVersion(fullVersionAtt.InformationalVersion);
Global.SetAssemblyVersion(fullVersionAtt?.InformationalVersion ?? "0.0.0.");
if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) // Handles 3-series running Windows CE OS
{

View File

@@ -3,10 +3,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharp.Reflection;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;