Esempio n. 1
0
 public AssemblyInfo(CodeFile codeFile, CsProjFile projFile)
 {
     this._codeFile   = codeFile;
     this._projFile   = projFile;
     this._fileSystem = new FileSystem();
     this.Initialize();
 }
Esempio n. 2
0
        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);
            });
        }
Esempio n. 3
0
        private void InitializeFromSolution(CsProjFile projFile, Solution solution)
        {
            GlobalSection tfsSourceControl = solution.Sections.FirstOrDefault((GlobalSection section) => section.SectionName.Equals("TeamFoundationVersionControl"));

            if (tfsSourceControl != null)
            {
                this.InitializeTfsSourceControlSettings(projFile, solution, tfsSourceControl);
            }
        }
Esempio n. 4
0
        public void RemoveProject(CsProjFile project)
        {
            SolutionProject existing = this.FindProject(project.ProjectName);

            if (existing == null)
            {
                return;
            }
            this._projects.Remove(existing);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        public static CsProjFile CreateAtSolutionDirectory(string assemblyName, string directory)
        {
            string fileName = FubuCore.StringExtensions.AppendPath(FubuCore.StringExtensions.AppendPath(directory, new string[]
            {
                assemblyName
            }), new string[]
            {
                assemblyName
            }) + ".csproj";
            MSBuildProject project = MSBuildProject.Create(assemblyName);

            return(CsProjFile.CreateCore(project, fileName));
        }
Esempio n. 7
0
        public SolutionProject(CsProjFile csProjFile, string solutionDirectory, string relativePath = "")
        {
            this._project     = new Lazy <CsProjFile>(() => csProjFile);
            this._projectName = csProjFile.ProjectName;

            string fileName = csProjFile.FileName;

            if (!string.IsNullOrWhiteSpace(relativePath))
            {
                fileName = relativePath;
            }
            this._relativePath = fileName;
            this._projectType  = csProjFile.ProjectTypes().LastOrDefault <Guid>();
            this._projectGuid  = csProjFile.ProjectGuid;
        }
Esempio n. 8
0
        private static CsProjFile CreateCore(MSBuildProject project, string fileName)
        {
            MSBuildPropertyGroup arg_42_0;

            if ((arg_42_0 = project.PropertyGroups.FirstOrDefault((MSBuildPropertyGroup x) => x.Properties.Any((MSBuildProperty p) => p.Name == "ProjectGuid"))) == null)
            {
                arg_42_0 = (project.PropertyGroups.FirstOrDefault <MSBuildPropertyGroup>() ?? project.AddNewPropertyGroup(true));
            }
            MSBuildPropertyGroup group = arg_42_0;

            group.SetPropertyValue("ProjectGuid", Guid.NewGuid().ToString().ToUpper(), true);
            CsProjFile file = new CsProjFile(fileName, project);

            file.AssemblyName = (file.RootNamespace = file.ProjectName);
            return(file);
        }
Esempio n. 9
0
        private void InitializeTfsSourceControlSettings(CsProjFile projFile, Solution solution, GlobalSection tfsSourceControl)
        {
            string projUnique = tfsSourceControl.Properties.FirstOrDefault((string item) => item.EndsWith(Path.GetFileName(projFile.FileName)));

            if (projUnique == null)
            {
                return;
            }
            int index = Convert.ToInt32(projUnique.Substring("SccProjectUniqueName".Length, projUnique.IndexOf('=') - "SccProjectUniqueName".Length).Trim());

            projFile.SourceControlInformation = new SourceControlInformation(tfsSourceControl.Properties.First((string item) => item.StartsWith("SccProjectUniqueName" + index)).Split(new char[]
            {
                '='
            })[1].Trim(), tfsSourceControl.Properties.First((string item) => item.StartsWith("SccProjectName" + index)).Split(new char[]
            {
                '='
            })[1].Trim(), tfsSourceControl.Properties.First((string item) => item.StartsWith("SccLocalPath" + index)).Split(new char[]
            {
                '='
            })[1].Trim());
        }
Esempio n. 10
0
 public void AddProject(CsProjFile project)
 {
     this.AddProject(this.ParentDirectory, project, String.Empty);
 }
Esempio n. 11
0
 public ProjectReference(CsProjFile targetProject, CsProjFile reference) : base("ProjectReference")
 {
     base.Include     = Path.Combine(FubuCore.StringExtensions.PathRelativeTo(reference.ProjectDirectory, targetProject.ProjectDirectory), Path.GetFileName(reference.FileName));
     this.ProjectGuid = reference.ProjectGuid;
     this.ProjectName = reference.ProjectName;
 }
Esempio n. 12
0
        public static SolutionProject CreateNewAt(string solutionDirectory, string projectName)
        {
            CsProjFile csProjFile = CsProjFile.CreateAtSolutionDirectory(projectName, solutionDirectory);

            return(new SolutionProject(csProjFile, solutionDirectory));
        }
Esempio n. 13
0
 public static CsProjFile CreateAtLocation(string fileName, string assemblyName)
 {
     return(CsProjFile.CreateCore(MSBuildProject.Create(assemblyName), fileName));
 }
Esempio n. 14
0
 public void AddProject(CsProjFile project)
 {
     GenericEnumerableExtensions.Fill <CsProjFile>(this._projects, project);
 }