Esempio n. 1
0
        private static void InitializeFilter(Options options)
        {
            XDocument doc = XDocument.Load("Filters.xml");
            foreach (XElement filterElement in doc.Root.Elements("Filter"))
            {
                string name = filterElement.Attribute("name").Value;
                HashSet<string> bones = new HashSet<string>(filterElement.Elements("Bone").Select(x => x.Attribute("name").Value));
                FilterMapper.Add(name, bones);
            }

            foreach (string value in options.Filters)
            {
                string[] filterArgs = value.Split(':');
                if (!FilterMapper.ContainsKey(filterArgs[1]))
                    throw new ArgumentException(filterArgs[1] + " is not a filter.");
                FilterNameMapper.Add(filterArgs[0], filterArgs[1]);
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Options options = new Options();
            if (Parser.Default.ParseArguments(args, options))
            {
                InitializeFilter(options);
                foreach (string fileName in options.Names)
                {
                    IList<XDocument> inputs = options.Directories.Select(x => XDocument.Load(Path.Combine(x, fileName))).ToList();
                    XDocument mergedDocument = Merge(inputs);

                    using (XmlTextWriter writer = new XmlTextWriter(Path.Combine(options.Output, fileName), Encoding.ASCII))
                        WriteXml(mergedDocument, writer);
                }
            }
        }