From c113b3e029889b226bbb298bdf9e04a3fc66b9f9 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Tue, 14 Jan 2020 01:21:07 -0500 Subject: [PATCH] this has been moved to MBS.Framework.Reflection --- .../Common/Reflection.cs | 40 +------------------ 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/CSharp/Libraries/UniversalEditor.UserInterface/Common/Reflection.cs b/CSharp/Libraries/UniversalEditor.UserInterface/Common/Reflection.cs index ef56aec6..02933e0b 100644 --- a/CSharp/Libraries/UniversalEditor.UserInterface/Common/Reflection.cs +++ b/CSharp/Libraries/UniversalEditor.UserInterface/Common/Reflection.cs @@ -194,44 +194,6 @@ namespace UniversalEditor.UserInterface.Common } } - private static Dictionary TypesByName = new Dictionary(); - private static Type FindType(string TypeName) - { - if (!TypesByName.ContainsKey(TypeName)) - { - System.Reflection.Assembly[] asms = GetAvailableAssemblies(); - bool found = false; - foreach (System.Reflection.Assembly asm in asms) - { - Type[] types = null; - try - { - types = asm.GetTypes(); - } - catch (System.Reflection.ReflectionTypeLoadException ex) - { - Console.Error.WriteLine("ReflectionTypeLoadException(" + ex.LoaderExceptions.Length.ToString() + "): " + asm.FullName); - Console.Error.WriteLine(ex.Message); - - types = ex.Types; - } - foreach (Type type in types) - { - if (type == null) continue; - if (type.FullName == TypeName) - { - TypesByName.Add(TypeName, type); - found = true; - break; - } - } - if (found) break; - } - if (!found) return null; - } - return TypesByName[TypeName]; - } - private static System.Reflection.Assembly[] mvarAvailableAssemblies = null; private static System.Reflection.Assembly[] GetAvailableAssemblies() { @@ -338,7 +300,7 @@ namespace UniversalEditor.UserInterface.Common } foreach (EditorReference editor in editors) { - if (editor.EditorType == FindType(typeName)) return editor; + if (editor.EditorType == MBS.Framework.Reflection.FindType(typeName)) return editor; } return null; }