From 18cfa4a2eb88358200efcc63903cf14d830c414e Mon Sep 17 00:00:00 2001
From: Nick Genovese <23391587+ngenovese11@users.noreply.github.com>
Date: Fri, 24 Feb 2023 17:37:29 -0500
Subject: [PATCH] feature: use system.reflection now
---
.gitignore | 295 +++++++++++++++++-
.../.idea/indexLayout.xml | 8 +
.../.idea/sonarlint/issuestore/index.pb | 0
.../Factory/DeviceFactory.cs | 7 +-
.../Plugins/PluginLoader.cs | 8 +-
.../Config/DeviceFactory.cs | 2 +-
.../Factory/DeviceFactory.cs | 3 +-
src/PepperDash.Essentials/ControlSystem.cs | 8 +-
.../Factory/DeviceFactory.cs | 2 +-
9 files changed, 305 insertions(+), 28 deletions(-)
create mode 100644 .idea/.idea.PepperDash.Essentials/.idea/indexLayout.xml
create mode 100644 .idea/.idea.PepperDash.Essentials/.idea/sonarlint/issuestore/index.pb
diff --git a/.gitignore b/.gitignore
index 94b7d400..948ce6e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,8 +33,6 @@ PepperDashEssentials-0.0.0-buildType-test.zip
# User-specific files
*.rsuser
-*.suo
-*.user
*.userosscache
*.sln.docstates
@@ -97,28 +95,21 @@ ScaffoldingReadMe.txt
StyleCopReport.xml
# Files built by Visual Studio
-*_i.c
-*_p.c
*_h.h
-*.ilk
*.meta
*.obj
*.iobj
-*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
-*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
-*.log
-*.vspscc
*.vssscc
.builds
*.pidb
@@ -130,8 +121,6 @@ _Chutzpah*
# Visual C++ cache files
ipch/
-*.aps
-*.ncb
*.opendb
*.opensdf
*.sdf
@@ -155,7 +144,6 @@ $tf/
*.gpState
# ReSharper is a .NET coding add-in
-_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
@@ -389,3 +377,286 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
essentials-framework/Essentials Interfaces/PepperDash_Essentials_Interfaces/PepperDash_Essentials_Interfaces.csproj
+### JetBrains template
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# AWS User-specific
+.idea/**/aws.xml
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn. Uncomment if using
+# auto-import.
+# .idea/artifacts
+# .idea/compiler.xml
+# .idea/jarRepositories.xml
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
+
+# CMake
+cmake-build-*/
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# File-based project format
+*.iws
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# SonarLint plugin
+.idea/sonarlint/
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+# Android studio 3.1+ serialized cache file
+.idea/caches/build_file_checksums.ser
+
+### VisualStudio template
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
+
+# User-specific files
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+
+# Mono auto generated files
+
+# Build results
+
+# Visual Studio 2015/2017 cache/options directory
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+
+# MSTest test Results
+
+# NUnit
+
+# Build Results of an ATL Project
+
+# Benchmark Results
+
+# .NET Core
+
+# ASP.NET Scaffolding
+
+# StyleCop
+
+# Files built by Visual Studio
+*.tlog
+
+# Chutzpah Test files
+
+# Visual C++ cache files
+
+# Visual Studio profiler
+
+# Visual Studio Trace Files
+
+# TFS 2012 Local Workspace
+
+# Guidance Automation Toolkit
+
+# ReSharper is a .NET coding add-in
+
+# TeamCity is a build add-in
+
+# DotCover is a Code Coverage Tool
+
+# AxoCover is a Code Coverage Tool
+
+# Coverlet is a free, cross platform Code Coverage Tool
+
+# Visual Studio code coverage results
+
+# NCrunch
+
+# MightyMoose
+
+# Web workbench (sass)
+
+# Installshield output folder
+
+# DocProject is a documentation generator add-in
+
+# Click-Once directory
+
+# Publish Web Output
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+
+# NuGet Packages
+# NuGet Symbol Packages
+# The packages folder can be ignored because of Package Restore
+# except build/, which is used as an MSBuild target.
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+
+# Microsoft Azure Build Output
+
+# Microsoft Azure Emulator
+
+# Windows Store app package directories and files
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+# but keep track of directories ending in .cache
+
+# Others
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+
+# SQL Server files
+
+# Business Intelligence projects
+
+# Microsoft Fakes
+
+# GhostDoc plugin setting file
+
+# Node.js Tools for Visual Studio
+
+# Visual Studio 6 build log
+
+# Visual Studio 6 workspace options file
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+
+# Visual Studio 6 auto-generated project file (contains which files were open etc.)
+*.vbp
+
+# Visual Studio 6 workspace and project file (working project files containing files to include in project)
+*.dsw
+*.dsp
+
+# Visual Studio 6 technical files
+
+# Visual Studio LightSwitch build output
+
+# Paket dependency manager
+
+# FAKE - F# Make
+
+# CodeRush personal settings
+
+# Python Tools for Visual Studio (PTVS)
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+
+# Telerik's JustMock configuration file
+
+# BizTalk build output
+
+# OpenCover UI analysis results
+
+# Azure Stream Analytics local run output
+
+# MSBuild Binary and Structured Log
+
+# NVidia Nsight GPU debugger configuration file
+
+# MFractors (Xamarin productivity tool) working folder
+
+# Local History for Visual Studio
+
+# Visual Studio History (VSHistory) files
+.vshistory/
+
+# BeatPulse healthcheck temp database
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+
+# Ionide (cross platform F# VS Code tools) working folder
+
+# Fody - auto-generated XML schema
+
+# VS Code files for those working on multiple tools
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+*.code-workspace
+
+# Local History for Visual Studio Code
+.history/
+
+# Windows Installer files from build outputs
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# JetBrains Rider
+*.sln.iml
+
diff --git a/.idea/.idea.PepperDash.Essentials/.idea/indexLayout.xml b/.idea/.idea.PepperDash.Essentials/.idea/indexLayout.xml
new file mode 100644
index 00000000..7b08163c
--- /dev/null
+++ b/.idea/.idea.PepperDash.Essentials/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.PepperDash.Essentials/.idea/sonarlint/issuestore/index.pb b/.idea/.idea.PepperDash.Essentials/.idea/sonarlint/issuestore/index.pb
new file mode 100644
index 00000000..e69de29b
diff --git a/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs b/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs
index d53aef19..d6508c9f 100644
--- a/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs
+++ b/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs
@@ -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 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 method)
+ public static void AddFactoryForType(string typeName, string description, Type cType, Func method)
{
//Debug.Console(1, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
diff --git a/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs b/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs
index 9da843b8..f17f95db 100644
--- a/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs
+++ b/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs
@@ -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
///
///
///
- 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);
diff --git a/src/PepperDash.Essentials.DM/Config/DeviceFactory.cs b/src/PepperDash.Essentials.DM/Config/DeviceFactory.cs
index 0cd08ec2..ff9d7486 100644
--- a/src/PepperDash.Essentials.DM/Config/DeviceFactory.cs
+++ b/src/PepperDash.Essentials.DM/Config/DeviceFactory.cs
@@ -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;
diff --git a/src/PepperDash.Essentials.Devices.Common/Factory/DeviceFactory.cs b/src/PepperDash.Essentials.Devices.Common/Factory/DeviceFactory.cs
index c5ab29b1..7d035f43 100644
--- a/src/PepperDash.Essentials.Devices.Common/Factory/DeviceFactory.cs
+++ b/src/PepperDash.Essentials.Devices.Common/Factory/DeviceFactory.cs
@@ -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;
diff --git a/src/PepperDash.Essentials/ControlSystem.cs b/src/PepperDash.Essentials/ControlSystem.cs
index 077a2b1a..c08e833a 100644
--- a/src/PepperDash.Essentials/ControlSystem.cs
+++ b/src/PepperDash.Essentials/ControlSystem.cs
@@ -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
{
diff --git a/src/PepperDash.Essentials/Factory/DeviceFactory.cs b/src/PepperDash.Essentials/Factory/DeviceFactory.cs
index 418fb603..01986367 100644
--- a/src/PepperDash.Essentials/Factory/DeviceFactory.cs
+++ b/src/PepperDash.Essentials/Factory/DeviceFactory.cs
@@ -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;