예제 #1
0
        public static Component CreateComponent(this XmlDocument dom)
        {
            var c = new Component();

            ComponentStorage.Instance.Add(c);

            return c;
        }
예제 #2
0
        public static Component CreateComponent(this XmlDocument dom, LinqComponent component)
        {
            var c = new Component();

            var name = "";

            var comp = component.CreateComponent(ref name);

            var doc = new XmlDocument();

            doc.Load(comp.CreateReader());

            c.Node = doc.DocumentElement;

            c.Name = name;

            ComponentStorage.Instance.Add(c);

            return c;
        }
예제 #3
0
        public static Component CreateComponent(this XmlDocument dom, string name, string src)
        {            
            if (src == null)
                throw new System.ArgumentNullException(nameof(src));
            if (name == null)
                throw new System.ArgumentNullException(nameof(name));

            Contract.Requires(name != null);
            Contract.Requires(src != null);

            var c = new Component();

            if (ComponentStorage.Instance[name] == null)
            {
                ComponentStorage.Instance.Add(c);
            }

            c.Name = name;
            c.Load(src);

            return c;
        }
예제 #4
0
        public static Component CreateComponent(this XmlDocument dom, string src)
        {
            if (src == null)
                throw new System.ArgumentNullException(nameof(src));

            Contract.Requires(src != null);

            var c = new Component();
            var d = new XmlDocument();
            d.LoadXml(src);

            var node = d.DocumentElement.FirstChild;

            c.Name = d.DocumentElement.Name;
            c.Node = node;

            if (ComponentStorage.Instance[c.Name] == null)
            {
                ComponentStorage.Instance.Add(c);
            }

            return c;
        }