private void normalRead(string text) { if (text.StartsWith("Global")) { this._read = new Action <string>(this.lookForGlobalSection); return; } if (text.StartsWith("ProjectSection")) { this._read = new Action <string>(this.lookForProjectSection); return; } if (Solution.SolutionReader.IncludeAsProject(text)) { this._solutionProject = new SolutionProject(text, FubuCore.StringExtensions.ParentDirectory(this._parent._filename)); this._solutionProject.Solution = this._parent; this._parent._projects.Add(this._solutionProject); this._read = new Action <string>(this.readProject); return; } this._parent._header.Add(text); if (FubuCore.StringExtensions.IsEmpty(this._parent.Version)) { foreach (KeyValuePair <string, string[]> versionLine in Solution._versionLines.ToDictionary()) { if (text.Trim() == versionLine.Value[1]) { this._parent.Version = versionLine.Key; } } } }
public SolutionProject(string text, string solutionDirectory) { SolutionProject solution = this; string[] parts = FubuCore.StringExtensions.ToDelimitedArray(text, '='); this._projectType = Guid.Parse(parts.First <string>().TextBetweenSquiggles()); this._projectGuid = Guid.Parse(parts.Last <string>().TextBetweenSquiggles()); string[] secondParts = FubuCore.StringExtensions.ToDelimitedArray(parts.Last <string>()); this._projectName = secondParts.First <string>().TextBetweenQuotes(); this._relativePath = secondParts.ElementAt(1).TextBetweenQuotes().Replace("\\", "/"); this._project = new Lazy <CsProjFile>(delegate { string filename = FubuCore.StringExtensions.AppendPath(solutionDirectory, new string[] { solution._relativePath }); if (File.Exists(filename)) { CsProjFile projFile = CsProjFile.LoadFrom(filename); solution.InitializeFromSolution(projFile, solution.Solution); return(projFile); } CsProjFile project = CsProjFile.CreateAtLocation(filename, solution._projectName); project.ProjectGuid = solution._projectGuid; return(project); }); }
public void RemoveProject(CsProjFile project) { SolutionProject existing = this.FindProject(project.ProjectName); if (existing == null) { return; } this._projects.Remove(existing); }
public void AddProject(string solutionDirectory, CsProjFile project, string relativeTo) { SolutionProject existing = this.FindProject(project.ProjectName); if (existing != null) { return; } SolutionProject reference = new SolutionProject(project, solutionDirectory, relativeTo); this._projects.Add(reference); }
public SolutionProject AddProject(string solutionFolder, string projectName) { SolutionProject existing = this.FindProject(projectName); if (existing != null) { return(existing); } SolutionProject reference = SolutionProject.CreateNewAt(this.ParentDirectory, projectName); this._projects.Add(reference); return(reference); }
public void WriteProjectConfiguration(SolutionProject solutionProject, GlobalSection section) { section.Read(FubuCore.StringExtensions.ToFormat("\t\t{{{0}}}.{1}.ActiveCfg = {2}", new object[] { solutionProject.ProjectGuid.ToString().ToUpper(), this.Key, this.Value })); section.Read(FubuCore.StringExtensions.ToFormat("\t\t{{{0}}}.{1}.Build.0 = {2}", new object[] { solutionProject.ProjectGuid.ToString().ToUpper(), this.Key, this.Value })); }
public SolutionProject AddProjectFromTemplate(string projectName, string templateFile) { SolutionProject existing = this.FindProject(projectName); if (existing != null) { throw new ArgumentOutOfRangeException("projectName", FubuCore.StringExtensions.ToFormat("Project with this name ({0}) already exists in the solution", new object[] { projectName })); } MSBuildProject project = MSBuildProject.CreateFromFile(projectName, templateFile); SolutionProject reference = new SolutionProject(new CsProjFile(FubuCore.StringExtensions.AppendPath(this.ParentDirectory, new string[] { projectName, projectName + ".csproj" }), project) { ProjectGuid = Guid.NewGuid() }, this.ParentDirectory); this._projects.Add(reference); return(reference); }