public static void ExportXml(string xmlPath) { List <Type> list = new List <Type>(); current.Controls.ForEach(child => child.ForTree(node => { list.Add(node.GetType()); })); list.Add(typeof(UFControl)); list = list.Distinct().ToList(); var attributes = new XmlAttributes(); list.ForEach(t => attributes.XmlArrayItems.Add(new XmlArrayItemAttribute(t))); var attrOverride = new XmlAttributeOverrides(); attrOverride.Add(typeof(UFControl), "childList", attributes); attrOverride.Add(typeof(UFProject), "Controls", attributes); UFUtility.ExportXml(xmlPath, current, attrOverride: attrOverride); }
public static void ImportXml(string xmlPath) { var assembly = Assembly.GetAssembly(typeof(UFControl)); var list = assembly.GetTypes() .Where(t => t.BaseType == typeof(UFControl)) .ToList(); list.Add(typeof(UFControl)); list = list.Distinct().ToList(); var attributes = new XmlAttributes(); list.ForEach(t => attributes.XmlArrayItems.Add(new XmlArrayItemAttribute(t))); var attrOverride = new XmlAttributeOverrides(); attrOverride.Add(typeof(UFControl), "childList", attributes); attrOverride.Add(typeof(UFProject), "Controls", attributes); current = UFUtility.ImportXml <UFProject>(xmlPath, attrOverride: attrOverride); current.Controls.ForEach(child => child.RefleshHierarchy()); }
public override void RefleshHierarchy() { base.RefleshHierarchy(); this.Image = UFUtility.LoadAssetFromGUID <Texture>(this.GUID); }