public static IEnumerable <ResourceItem> Parse(string file, bool enforceParameterDeclaration, IEnumerable <string> satelites)
        {
            int errors;
            int warnings;

            return(ResourceParser.Parse(file, enforceParameterDeclaration, satelites, out errors, out warnings));
        }
        public static IEnumerable <ResourceItem> Parse(string file, bool enforceParameterDeclaration, IEnumerable <string> satelites, out int errors, out int warnings)
        {
            XmlDocument resource = new XmlDocument();

            resource.Load(file);
            XmlNodeList nodeList = ResourceParser.SelectResources(resource);

            if (nodeList != null && 0 < nodeList.Count)
            {
                ResourceParser      parser = new ResourceParser(file, enforceParameterDeclaration, satelites);
                List <ResourceItem> list   = new List <ResourceItem>();
                void assign(ResourceItem item)
                {
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }

                parser.Parse(nodeList,
                             (string name, string value, string comment) => assign(parser.GenerateInclude(name, value, comment)),
                             (string name, string value, string comment) => assign(parser.GenerateString(name, value, comment))
                             );
                if (parser.errorCount == 0 && parser.satelites != null)
                {
                    parser.VerifySatelites(list);
                }
                errors   = parser.errorCount;
                warnings = parser.warningCount;
                if (parser.errorCount == 0)
                {
                    return(list);
                }
                else
                {
                    return(null);
                }
            }
            errors   = 0;
            warnings = 0;
            return(Enumerable.Empty <ResourceItem>());
        }
        public bool Generate()
        {
            IEnumerable <ResourceItem> list = ResourceParser.Parse(this.File, this.EnforceParameterDeclaration, this.Satelites);

            if (list != null)
            {
                this.Items = list;
                string content        = this.TransformText();
                string oldFileContent = null;
                if (io.File.Exists(this.Code))
                {
                    oldFileContent = io.File.ReadAllText(this.Code, Encoding.UTF8);
                }
                if (!StringComparer.Ordinal.Equals(oldFileContent, content))
                {
                    io.File.WriteAllText(this.Code, content, Encoding.UTF8);
                    Message.Flush();
                }
                Message.Clear();
                return(true);
            }
            return(false);
        }
 public static IEnumerable <ResourceItem> Parse(string file, bool enforceParameterDeclaration, IEnumerable <string> satelites)
 {
     return(ResourceParser.Parse(file, enforceParameterDeclaration, satelites, out int _, out int _));
 }