Пример #1
0
        private static void LoadTranslators()
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(AssemblyResource.GetFileContents("translators.xml"));

            foreach (XmlNode node in doc.DocumentElement.ChildNodes)
            {
                if (node.Name != "language")
                {
                    continue;
                }

                try {
                    string language_code = node.Attributes["code"].Value.Trim();
                    string language_name = node.Attributes["name"].Value.Trim();

                    ProductTranslation translation = new ProductTranslation(language_code, language_name);

                    foreach (XmlNode person in node.ChildNodes)
                    {
                        if (person.Name != "person")
                        {
                            continue;
                        }

                        translation.AddTranslator(person.FirstChild.Value.Trim());
                    }

                    translations.Add(language_name, translation);
                } catch {
                }
            }
        }
Пример #2
0
        private static void LoadContributors()
        {
            List <string> artists_list      = new List <string> ();
            List <string> contributors_list = new List <string> ();

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(AssemblyResource.GetFileContents("contributors.xml"));

            foreach (XmlNode node in doc.DocumentElement.ChildNodes)
            {
                if (node.FirstChild == null || node.FirstChild.Value == null)
                {
                    continue;
                }

                string name = node.FirstChild.Value.Trim();

                switch (node.Name)
                {
                case "author":
                    authors.Add(name, new ProductAuthor(name, node.Attributes["role"].Value));
                    break;

                case "contributor":
                    contributors_list.Add(name);
                    break;

                case "artist":
                    artists_list.Add(name);
                    break;

                default:
                    break;
                }
            }

            artists      = artists_list.ToArray();
            contributors = contributors_list.ToArray();

            Array.Sort(artists);
            Array.Sort(contributors);
        }