Exemple #1
0
        private static void ParseReplacements(XElement root, ProjectImpl project, IProjectContext context)
        {
            List <Replacement> replacements = new List <Replacement>();

            XElement node = root.Element("replacements");

            if (node != null)
            {
                foreach (XElement item in node.Elements("replace"))
                {
                    XAttribute tmp = null;

                    Replacement v = new Replacement();

                    if ((tmp = item.Attribute("file")) != null)
                    {
                        v.FileName = tmp.Value;
                    }
                    if ((tmp = item.Attribute("with")) != null)
                    {
                        v.ReplacementFile = context.GetPhysicalFile(tmp.Value, project);
                    }
                    if ((tmp = item.Attribute("mode")) != null)
                    {
                        v.Mode = (FileNameMode)Enum.Parse(typeof(FileNameMode), tmp.Value, true);
                    }

                    replacements.Add(v);
                }
            }

            project.Replacements = replacements;
        }