bool ProcessMarkupItem(string markupItem, XamlNsReplacingContext wxsc, Assembly localAssembly)
        {
            XamlXmlReaderSettings settings = new XamlXmlReaderSettings()
            {
                LocalAssembly = localAssembly, ProvideLineInfo = true, AllowProtectedMembersOnRoot = true
            };

            using (StreamReader streamReader = new StreamReader(markupItem))
            {
                var             xamlReader       = new XamlXmlReader(XmlReader.Create(streamReader), wxsc, settings);
                ClassValidator  validator        = new ClassValidator(markupItem, localAssembly, this.RootNamespace);
                IList <LogData> validationErrors = null;
                if (validator.ValidateXaml(xamlReader, false, this.AssemblyName, out validationErrors))
                {
                    return(true);
                }
                else
                {
                    foreach (LogData logData in validationErrors)
                    {
                        this.LogData.Add(logData);
                    }
                    return(false);
                }
            }
        }
Exemple #2
0
 bool ValidateXaml(XamlNodeList xamlNodeList, string xamlFileName)
 {
     using (XamlReader xamlReader = xamlNodeList.GetReader())
     {
         IList <LogData> validationErrors = null;
         ClassValidator  validator        = new ClassValidator(xamlFileName, null, null);
         return(validator.ValidateXaml(xamlReader, true, this.AssemblyName, out validationErrors));
     }
 }
 bool ProcessMarkupItem(string markupItem, XamlNsReplacingContext wxsc, Assembly localAssembly)
 {
     XamlXmlReaderSettings settings = new XamlXmlReaderSettings() { LocalAssembly = localAssembly, ProvideLineInfo = true, AllowProtectedMembersOnRoot = true };
     using (StreamReader streamReader = new StreamReader(markupItem))
     {
         var xamlReader = new XamlXmlReader(XmlReader.Create(streamReader), wxsc, settings);
         ClassValidator validator = new ClassValidator(markupItem, localAssembly, this.RootNamespace);
         IList<LogData> validationErrors = null;
         if (validator.ValidateXaml(xamlReader, false, this.AssemblyName, out validationErrors))
         {
             return true;
         }
         else
         {
             foreach (LogData logData in validationErrors)
             {
                 this.LogData.Add(logData);
             }
             return false;
         }
     }
 }
 bool ValidateXaml(XamlNodeList xamlNodeList, string xamlFileName)
 {
     using (XamlReader xamlReader = xamlNodeList.GetReader())
     {
         IList<LogData> validationErrors = null;
         ClassValidator validator = new ClassValidator(xamlFileName, null, null);
         return validator.ValidateXaml(xamlReader, true, this.AssemblyName, out validationErrors);
     }
 }