@@ -16,10 +16,31 @@ namespace UI__Editor.Controllers
1616{
1717 public static class XMLToClassModel
1818 {
19+ private static string ColorConverter ( string s )
20+ {
21+ if ( s . StartsWith ( "#" ) )
22+ { return s ; }
23+ else if ( ! string . IsNullOrEmpty ( s ) )
24+ {
25+ return "#" + s ;
26+ }
27+ else
28+ {
29+ return s ;
30+ }
31+ }
32+
1933 public static UIpp GenerateUIpp ( XmlDocument xmlDoc , string path )
2034 {
2135 UIpp uipp = new UIpp ( ) ;
2236
37+ // Strip Comments
38+ XmlNodeList allComments = xmlDoc . SelectNodes ( "//comment()" ) ;
39+ foreach ( XmlNode c in allComments )
40+ {
41+ c . ParentNode . RemoveChild ( c ) ;
42+ }
43+
2344 // Set Attributes
2445 XmlElement uippNode = xmlDoc . DocumentElement ;
2546 if ( ! string . IsNullOrEmpty ( uippNode . GetAttribute ( "AlwaysOnTop" ) ) )
@@ -30,7 +51,9 @@ public static UIpp GenerateUIpp(XmlDocument xmlDoc, string path)
3051 {
3152 uipp . AlwaysOnTop = true ;
3253 }
33- uipp . Color = uippNode . GetAttribute ( "Color" ) ;
54+
55+ uipp . Color = ColorConverter ( uippNode . GetAttribute ( "Color" ) ) ;
56+
3457 if ( ! string . IsNullOrEmpty ( uippNode . GetAttribute ( "DialogSidebar" ) ) )
3558 {
3659 uipp . DialogSidebar = Convert . ToBoolean ( uippNode . GetAttribute ( "DialogSidebar" ) ) ;
@@ -246,9 +269,9 @@ private static IElement NewAction(XmlNode xmlNode, IElement parent = null)
246269 Image = importNode . GetAttribute ( "Image" )
247270 } ;
248271 if ( ! string . IsNullOrEmpty ( importNode . GetAttribute ( "BackgroundColor" ) ) )
249- infoFullScreen . BackgroundColor = importNode . GetAttribute ( "BackgroundColor" ) ;
272+ infoFullScreen . BackgroundColor = ColorConverter ( importNode . GetAttribute ( "BackgroundColor" ) ) ;
250273 if ( ! string . IsNullOrEmpty ( importNode . GetAttribute ( "TextColor" ) ) )
251- infoFullScreen . TextColor = importNode . GetAttribute ( "TextColor" ) ;
274+ infoFullScreen . TextColor = ColorConverter ( importNode . GetAttribute ( "TextColor" ) ) ;
252275 if ( ! string . IsNullOrEmpty ( importNode . InnerXml ) )
253276 {
254277 infoFullScreen . Content = CDATARemover ( importNode . InnerXml ) ;
@@ -617,7 +640,7 @@ private static IElement NewAction(XmlNode xmlNode, IElement parent = null)
617640 Condition = importNode . GetAttribute ( "Condition" )
618641 } ;
619642 if ( ! string . IsNullOrEmpty ( importNode . GetAttribute ( "Color" ) ) )
620- inputInfo . Color = importNode . GetAttribute ( "Color" ) ;
643+ inputInfo . Color = ColorConverter ( importNode . GetAttribute ( "Color" ) ) ;
621644 if ( int . TryParse ( importNode . GetAttribute ( "DropDownSize" ) , out int inputInfoNumberOfLines ) )
622645 inputInfo . NumberOfLines = inputInfoNumberOfLines ;
623646 if ( ! string . IsNullOrEmpty ( importNode . InnerXml ) )
0 commit comments