Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
0
 public override void RefleshHierarchy()
 {
     base.RefleshHierarchy();
     this.Image = UFUtility.LoadAssetFromGUID <Texture>(this.GUID);
 }