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>());
        }
        private void VerifySatelites(List <ResourceItem> itemList)
        {
            Dictionary <string, ResourceItem> items = new Dictionary <string, ResourceItem>(itemList.Count);

            itemList.ForEach(i => items.Add(i.Name, i));
            string          mainFile        = this.fileName;
            Action <string> unknownResource = name => this.Warning(name, "resource does not exist in the main resource file \"{0}\"", mainFile);

            foreach (string file in this.satelites)
            {
                XmlDocument resource = new XmlDocument();
                resource.Load(file);
                XmlNodeList nodeList = ResourceParser.SelectResources(resource);
                if (nodeList != null && 0 < nodeList.Count)
                {
                    this.fileName = file;
                    this.Parse(nodeList,
                               (string name, string value, string comment) => {
                        ResourceItem item;
                        if (items.TryGetValue(name, out item))
                        {
                            ResourceItem satellite = this.GenerateInclude(name, value, comment);
                            if (item.Type != satellite.Type)
                            {
                                this.Error(name, "type of file resource is different in main resource file \"{0}\" and language resource file \"{1}\"", mainFile, file);
                            }
                        }
                        else
                        {
                            unknownResource(name);
                        }
                    },
                               (string name, string value, string comment) => {
                        ResourceItem item;
                        if (items.TryGetValue(name, out item))
                        {
                            if (!item.SuppressValidation)
                            {
                                int count = this.ValidateFormatItems(name, value, false);
                                if (count != (item.Parameters == null ? 0 : item.Parameters.Count))
                                {
                                    this.Warning(name, "number of parameters is different from the same resource in the main resource file \"{0}\"", mainFile);
                                }
                                else if (item.LocalizationVariants != null)
                                {
                                    if (!item.LocalizationVariants.Contains(value))
                                    {
                                        this.Error(name, "provided value is not in variant list defined in main resource file: \"{0}\"", mainFile);
                                    }
                                }
                            }
                        }
                        else
                        {
                            unknownResource(name);
                        }
                    }
                               );
                }
            }
            this.fileName = mainFile;
        }