Пример #1
0
 /// <summary>
 /// Reload all known metadata assets.
 /// </summary>
 public static void ReloadMetaAssets()
 {
     foreach (string key in metadata.Keys.ToList())
     {
         metadata[key] = XMLSimpleParser.GetNestedAttributes(metdataPath, key);
     }
 }
Пример #2
0
        /// <summary>
        /// Get an metadata asset by name.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="assetType"></param>
        /// <returns></returns>
        public static IEnumerable <T> GetMetaEntry <T>(string sectionName) where T : XMLSimpleMetadata, new()
        {
            IEnumerable <XMLAttributesCollection> xml;

            if (!metadata.TryGetValue(sectionName, out xml))
            {
                xml = XMLSimpleParser.GetNestedAttributes(metdataPath, sectionName);

                metadata.Add(sectionName, xml);
            }

            foreach (XMLAttributesCollection collection in xml)
            {
                T entry = new T();

                entry.ParseAttributes(collection);

                yield return(entry);
            }
        }