public Resource this[Identity id]
 {
     get
     {
         return getResource(id, true);
     }
 }
Example #2
0
 public Resource(ResourceManager aManager, XmlElement myElement)
 {
     pManager = aManager;
     string id = myElement.GetAttribute("ID");
     if (id != null && id.Length > 0) ID = new Identity(XmlConvert.ToInt32(id));
     Name = myElement.GetAttribute("Name");
     Filename = myElement.GetAttribute("Filename");
     string t = myElement.GetAttribute("ResourceType");
     if (t != null && t.Length > 0) Type = (ResourceType)Enum.Parse(typeof(ResourceType), t);
 }
 public Resource getResource(Identity anID, bool isRequired)
 {
     Resource r = (Resource)pResourcesID[anID];
     if (isRequired && r == null) throw new ArgumentNullException(string.Format("Cannot find ID:{0}", anID.ID));
     return r;
 }
 public void Add(Identity ID, Resource res)
 {
     pResourcesID.Add(ID, res);
     pResourcesName.Add(res.Name, res);
 }
Example #5
0
        /// <summary>
        /// Build from XML based on type
        /// </summary>
        /// <param name="type"></param>
        /// <param name="xmlConfigData"></param>
        protected Resource(ResourceFactory factory, ResourceType type, XmlElement xmlConfigData)
        {
            this.type = type;
            this.xmlConfigData = xmlConfigData;
            this.factory = factory;

            identity = new Identity(int.Parse(xmlConfigData.GetAttribute("ID")));
            name = xmlConfigData.GetAttribute("Name");
            if (xmlConfigData.HasAttribute("Description"))
            {
                description = xmlConfigData.GetAttribute("Description");
            }
        }