Beispiel #1
0
 public void ExtensionEquals()
 {
     Assert.That(QQnPath.ExtensionEquals("c:/test.txt", ".txt"), Is.True);
     Assert.That(QQnPath.ExtensionEquals("c:/test.txt", ".TXT"), Is.True);
     Assert.That(QQnPath.ExtensionEquals("test.tXt", ".txt"), Is.True);
 }
Beispiel #2
0
        private SortedFileList <ExternalProject> CreateExternalProjectsList()
        {
            SortedFileList <ExternalProject> externalProjects = new SortedFileList <ExternalProject>();

            using (StreamReader sr = File.OpenText(ProjectFile))
            {
                string line;

                while (null != (line = sr.ReadLine()))
                {
                    if (line.StartsWith("Project("))
                    {
                        IList <string> words = Tokenizer.GetCommandlineWords(line);

                        if (words.Count < 5 || words[1] != "=")
                        {
                            continue;
                        }

                        Guid   projectType = new Guid(words[0].Substring(8).TrimEnd(')').Trim('\"'));
                        string projectName = FilterWord(words[2]);
                        string projectFile = QQnPath.Combine(ProjectPath, FilterWord(words[3]));
                        Guid   projectGuid = new Guid(FilterWord(words[4]));

                        if (projectType != solutionItem && File.Exists(projectFile))
                        {
                            if (QQnPath.ExtensionEquals(projectFile, ".vcproj"))
                            {
                                externalProjects.Add(projectFile, new VCBuildProject(projectGuid, projectFile, projectName, Parameters));
                            }
                        }
                    }
                }
            }

            if (BuildProperties == null)
            {
                Refresh();
            }

            // The property CurrentSolutionConfigurationContents contains the 'real' configuration of external projects
            string configData;

            if (BuildProperties.TryGetValue("CurrentSolutionConfigurationContents", out configData))
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(configData);

                foreach (ExternalProject ep in externalProjects)
                {
                    XmlNode node = doc.SelectSingleNode("//ProjectConfiguration[@Project='" + ep.ProjectGuid.ToString("B").ToUpperInvariant() + "']");

                    if (node != null)
                    {
                        ep.AddBuildConfiguration(node.InnerText);
                    }
                }
            }

            return(externalProjects);
        }