/// <summary>
 ///
 /// </summary>
 /// <param name="file"></param>
 static public void GetTypesFromFile(PxDocument file)
 {
     foreach (var k in file.Keywords)
     {
         if (KeywordTypes.ContainsKey(k.Key.Identifier))
         {
             string theType = KeywordTypes[k.Key.Identifier];
             if (theType == k.Element.GetType().Name)
             {
                 continue;
             }
             else
             {
                 if (!KeywordExceptions.ContainsKey(k.Key.Identifier))
                 {
                     KeywordExceptions.Add(k.Key.Identifier, string.Format("{0} different from previous {1}", k.Element.GetType().Name, theType));
                 }
             }
         }
         else
         {
             KeywordTypes.Add(k.Key.Identifier, k.Element.GetType().Name);
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// Similar to GetAllKeywordElementsThatMatchTheIdentifier but will not return values with a language subkey where no language parameter is supplied
        /// </summary>
        /// <param name="pxDoc"></param>
        /// <param name="keywordIdentifier"></param>
        /// <param name="language"></param>
        /// <returns></returns>
        protected IEnumerable <IPxKeywordElement> GetAllKeywordElementsThatMatchTheIdentifierNulllable(PxDocument pxDoc, string keywordIdentifier, string language = null)
        {
            var keys = pxDoc.Keywords.Where(k => k.Key.Identifier == keywordIdentifier && ((String.IsNullOrEmpty(language) && String.IsNullOrEmpty(k.Key.Language)) || k.Key.Language == language));

            if (keys == null)
            {
                return(null);
            }

            if (!keys.Any())
            {
                return(null);
            }
            return(keys);
        }
Exemple #3
0
        /// <summary>
        /// Similar to GetAllKeywordElementsThatMatchTheIdentifier but will not return values with a language subkey where no language parameter is supplied
        /// </summary>
        /// <param name="pxDoc"></param>
        /// <param name="keywordIdentifier"></param>
        /// <param name="language"></param>
        /// <returns></returns>
        protected IEnumerable <IPxKeywordElement> GetAllKeywordElementsThatMatchTheIdentifierStrictly(PxDocument pxDoc, string keywordIdentifier, string language = null)
        {
            var keys = pxDoc.Keywords.Where(k => k.Key.Identifier == keywordIdentifier && ((String.IsNullOrEmpty(language) && String.IsNullOrEmpty(k.Key.Language)) || k.Key.Language == language));


            if (!keys.Any())
            {
                throw new Exception(string.Format(Label.Get("px.schema.key-not-found"), keywordIdentifier, language));
            }
            return(keys);
        }