Esempio n. 1
0
 internal Solution(SolutionCollection solutions, FileInfo solutionFile, string name, string sourceFolder, BuildFolder buildFolder,
                   PackageFolder packageFolder, ExternalsFolder externalsFolder, List <SolutionDependency> dependencies)
 {
     _solutions       = solutions;
     _solutionFile    = solutionFile;
     _buildFolder     = buildFolder;
     _packageFolder   = packageFolder;
     _sourceFolder    = sourceFolder;
     _externalsFolder = externalsFolder;
     _dependencies    = dependencies;
     SolutionName     = name;
 }
Esempio n. 2
0
        public Solution ReadSolution(SolutionCollection solutions, FileInfo solutionFile)
        {
            BuildFolder               buildFolder     = null;
            PackageFolder             packageFolder   = null;
            ExternalsFolder           externalsFolder = null;
            List <SolutionDependency> dependencies    = new List <SolutionDependency>();
            string name   = string.Empty;
            string source = string.Empty;

            using (FileStream stream = solutionFile.OpenRead())
            {
                using (XmlReader reader = XmlReader.Create(stream))
                {
                    MoveToElement(reader, SolutionElementName);

                    //Read Element attributes
                    while (reader.MoveToNextAttribute())
                    {
                        switch (reader.Name)
                        {
                        case SolutionNameAttributeName:
                            name = reader.ReadContentAsString();
                            break;
                        }
                    }

                    //Move back to Element
                    reader.MoveToElement();

                    //Read Element content
                    while (reader.Read())
                    {
                        if (reader.NodeType == XmlNodeType.EndElement &&
                            string.Equals(SolutionElementName, reader.Name))
                        {
                            break;
                        }
                        if (reader.NodeType != XmlNodeType.Element)
                        {
                            continue;
                        }
                        switch (reader.Name)
                        {
                        case BuildElementName:
                            buildFolder = ReadBuildFolder(reader);
                            break;

                        case PackageElementName:
                            packageFolder = ReadPackageFolder(reader);
                            break;

                        case SourceElementName:
                            source = reader.ReadInnerXml();
                            break;

                        case ExternalsElementName:
                            externalsFolder = ReadExternalsFolder(reader);
                            break;

                        case DependenciesElementName:
                            ReadDependencies(reader, dependencies);
                            break;
                        }
                    }
                }
            }
            Solution solution = new Solution(solutions, solutionFile, name, source, buildFolder, packageFolder, externalsFolder, dependencies);

            return(solution);
        }