From da4c33b231a6be42736b2b174ecec3b1df0148a0 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Sat, 25 Jan 2020 03:30:16 -0500 Subject: [PATCH] some editors are identified by TypeName instead of ID, and that's OK --- .../UniversalEditor.UserInterface/Engine.cs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/CSharp/Libraries/UniversalEditor.UserInterface/Engine.cs b/CSharp/Libraries/UniversalEditor.UserInterface/Engine.cs index 79d4b5bd..877925d8 100644 --- a/CSharp/Libraries/UniversalEditor.UserInterface/Engine.cs +++ b/CSharp/Libraries/UniversalEditor.UserInterface/Engine.cs @@ -130,6 +130,9 @@ namespace UniversalEditor.UserInterface if (tag == null) continue; if (tag.FullName != "Editor") continue; + MarkupAttribute attID = tag.Attributes["ID"]; + MarkupAttribute attTypeName = tag.Attributes["TypeName"]; + switch (System.Environment.OSVersion.Platform) { case PlatformID.MacOSX: @@ -148,11 +151,25 @@ namespace UniversalEditor.UserInterface EditorReference editor = null; try { - Common.Reflection.GetAvailableEditorByID(new Guid(tag.Attributes["ID"].Value)); + if (attID != null) + { + Common.Reflection.GetAvailableEditorByID(new Guid(attID.Value)); + } + else if (attTypeName != null) + { + Common.Reflection.GetAvailableEditorByTypeName(attTypeName.Value); + } } catch (Exception ex) { - Console.WriteLine("couldn't load editor " + tag.Attributes["ID"].Value); + if (attID != null) + { + Console.WriteLine("couldn't load editor with ID '{0}'", (new Guid(attID.Value)).ToString("B")); + } + else if (attTypeName != null) + { + Console.WriteLine("couldn't load editor with typename '{0}'", attTypeName.Value); + } } break; }