/// <summary> /// here we need to know if the selected project has a sln file /// if it does we need the list of projects from it to replace /// the projlist.projects or something like it /// </summary> /// <param name="pList"></param> /// <param name="projPtr"></param> /// <returns></returns> private List <ProjectNameAndSync> GetProjectsForSolutionIfExtant(int projPtr) { //int ptr = lvProjects.SelectedItems[projPtr].Index; var slnPath = ProjList.Projects[projPtr].DevSLNPath; List <ProjectNameAndSync> pList = new List <ProjectNameAndSync>(); if (!string.IsNullOrWhiteSpace(slnPath) && rbSolution.Checked) { // the path may have/not have the filename in it, ensure it there if (Path.GetFileName(slnPath).ToLower().IndexOf(".sln") == -1) { slnPath = Path.Combine(slnPath, $"{Path.GetFileNameWithoutExtension(slnPath)}.sln"); } ProcessSolution ps = new ProcessSolution(slnPath, false); // following line only gets the project fullPath in the PNAS objects pList = ps.ProjectList; // we still need the syncID for the project and ProcessSolution // could not get that for us if (pList.Count > 0) { // the sln had projects, we need a syncID for each var mp = new MaintainProject(); foreach (var p in pList) { string url = mp.GetGitURLFromPath(p.Name); // if a project is not in gitHub the url will be blank if (string.IsNullOrWhiteSpace(url)) { url = Path.GetFileNameWithoutExtension(p.Name); } var o = ProjList.Projects.Find(x => x.GitURL == url && x.DevProjectName == Path.GetFileNameWithoutExtension(p.Name)); if (o != null) { p.SyncID = o.SyncID; } else { // missing a sync record for project, DevProjects table has bad project entry _ = new LogError($"Could not find a SyncID for '{p.Name}', Invalid Project Data in DevProjects Table, project will not be in report.", true, "frmReporter.btnCreateReport_Click(ProjectDetail"); } } } } else { // no solution file, just the selected project will be used pList.Add( new ProjectNameAndSync { Name = ProjList.Projects[projPtr].DevProjectName, SyncID = ProjList.Projects[projPtr].SyncID }); } return(pList); }
static void Main(string[] args) { // test DevProjects var mp = new MaintainProject(); //mp.UpdateSLNPathInDevProjects(); mp.PopulateSyncTableFromDevProjects(); var path = @"C:\VS2019 Projects\DevTracker\.git\config"; DHMisc hlpr = new DHMisc(); List <NotableFileExtension> notableFileExtensions = hlpr.GetNotableFileExtensions(); // Tuple<string, string, string> tuple = mp.GetProjectFromGitConfigSaved(path, notableFileExtensions); path = @"C:\VS2019 Projects\DevTracker\Classes\FileWatcher.cs"; //Tuple<string, string, string> tuple = mp.GetProjectFromDevFileActivity(path, notableFileExtensions, "cs"); var url = mp.GetGitURLFromConfigFile(@"C:\GitRepo\hell-world\.git\config"); url = mp.GetGitURLFromPath(@"C:\GitRepo\hell-world\helloworld.csproj"); Console.WriteLine(url); // test fileanalyzer //var cc = new CodeCounter.FileLineCounter(); //var ret = cc.Process(@"C:\VS2019 Projects\DevTracker\Forms\MiscContainer.cs"); string projectPath = string.Empty; string devProjectName = GetProjectPath(@"C:\DevTrkr DLLs\MaintainDevProject\Properties\AssemblyInfo.cs", out projectPath, "csproj"); Console.WriteLine("Project: " + devProjectName + "Path: " + projectPath); Console.ReadLine(); }