Example #1
0
        public object DOMParse(XmlElement element, params object[] parameters)
        {
            var r = new ResourcesUni();

            r.setName(element.GetAttribute("name"));

            foreach (XmlElement asset in element.SelectNodes("asset"))
            {
                r.addAsset(
                    asset.GetAttribute("type"),
                    asset.GetAttribute("uri"));
            }

            r.setConditions(DOMParserUtility.DOMParse <Conditions>(element.SelectSingleNode("condition"), parameters) ?? new Conditions());

            return(r);
        }
        public object Clone()
        {
            ResourcesUni r = (ResourcesUni)this.MemberwiseClone();

            if (assets != null)
            {
                r.assets = new Dictionary <string, string>();
                foreach (string s in assets.Keys)
                {
                    string s2 = (assets[s] != null ? assets[s] : null);
                    r.assets.Add(s, s2);
                }
            }
            r.name       = (name != null ? name : null);
            r.conditions = (conditions != null ? (Conditions)conditions.Clone() : null);
            return(r);
        }
        private ResourcesUni parseResources(XmlElement resources, params object[] parameters)
        {
            XmlNodeList assets;

            var currentResources = new ResourcesUni();

            currentResources.setName(resources.GetAttribute("name") ?? "");

            assets = resources.SelectNodes("asset");
            foreach (XmlElement asset in assets)
            {
                string type = asset.GetAttribute("type") ?? "";
                string path = asset.GetAttribute("uri") ?? "";

                currentResources.addAsset(type, path);
            }

            currentResources.setConditions(DOMParserUtility.DOMParse <Conditions> (resources.SelectSingleNode("condition"), parameters) ?? new Conditions());

            return(currentResources);
        }
 /**
  * Adds some resources to the list of resources
  *
  * @param resources
  *            the resources to add
  */
 public void addResources(ResourcesUni resources)
 {
     this.resources.Add(resources);
 }