Esempio n. 1
0
        IProject IProjectParser.Parse(IProjectContext context, Stream stream)
        {
            XDocument doc = XDocument.Load(stream);

            Validate(doc);

            XElement root = doc.Root;

            ProjectImpl project = new ProjectImpl();

            project.Name       = root.Element("name").Value;
            project.BasePath   = context.GetPhysicalDirectory(root.Element("basePath").Value);
            project.PackedName = root.Element("packedName").Value;

            if (root.Element("outPath") != null)
            {
                project.OutPath = context.GetPhysicalDirectory(root.Element("outPath").Value);
            }
            else
            {
                project.OutPath = project.BasePath;
            }

            project.IsRecursiveMode     = bool.Parse(root.Element("basePath").Attribute("recursive").Value);
            project.IncludeAllByDefault = bool.Parse(root.Element("inclusions").Attribute("all").Value);

            ParseExclusions(root, project);
            ParseInclusions(root, project);
            ParseReplacements(root, project, context);

            return(project);
        }