Class FoldersWithSolutions
- Namespace
- SunamoDevCode.SunamoSolutionsIndexer
- Assembly
- SunamoDevCode.dll
Manages a collection of solution folders and provides methods for enumerating projects across all solutions.
public class FoldersWithSolutions
- Inheritance
-
FoldersWithSolutions
- Inherited Members
- Extension Methods
Constructors
FoldersWithSolutions(ILogger, string, PpkOnDriveDC, bool)
A1 = D:\Documents This class should be instaniate only once and then call reload by needs A1 toSelling can be null
public FoldersWithSolutions(ILogger logger, string documentsFolder, PpkOnDriveDC toSelling, bool addAlsoSolutions = true)
Parameters
loggerILoggerdocumentsFolderstringtoSellingPpkOnDriveDCaddAlsoSolutionsbool
FoldersWithSolutions(FoldersWithSolutions)
Creates a copy of another FoldersWithSolutions instance, sharing the same solutions and static data.
public FoldersWithSolutions(FoldersWithSolutions fws2)
Parameters
fws2FoldersWithSolutionsSource instance to copy data from.
Properties
DocumentsFolder
EN: Path to documents folder, e.g., D:\Documents CZ: D:\Documents
public string DocumentsFolder { get; set; }
Property Value
Fwss
EN: Folder where to search for Projects folder and Visual Studio folders. Added here when calling FoldersWithSolutions ctor. If no sln, call new FoldersWithSolutions(BasePathsHelper.Vs, null); CZ: Složka ve které se má hledat na složku Projects a složky Visual Studia. Přidává se mi zde když volám ctor FoldersWithSolutions. Pokud nemám sln, zavolat new FoldersWithSolutions(BasePathsHelper.Vs, null);
public static FoldersWithSolutionsList Fwss { get; set; }
Property Value
OnlyRealLoadedSolutionsFolders
Gets or sets the list of solution folder paths that were actually loaded from disk.
public static List<string> OnlyRealLoadedSolutionsFolders { get; set; }
Property Value
ProjectsWithDuplicateName
Gets or sets the list of project names that have duplicate entries across solutions.
public static List<string> ProjectsWithDuplicateName { get; set; }
Property Value
Solutions
EN: Was static on 3-10-23 but don't know why when solutions is instance field CZ: 3-10-23 bylo static ale nevím proč když solutions je instanční
public List<SolutionFolder> Solutions { get; set; }
Property Value
UsedRepository
Gets or sets the repository type used for solution lookups.
public static RepositoryLocal UsedRepository { get; set; }
Property Value
allCsprojGlobal
EN: In key is filename without .csproj, in value is full path CZ: V klíči je jméno souboru bez .csproj, v hodnotě je úplná cesta
public static Dictionary<string, List<string>> allCsprojGlobal { get; set; }
Property Value
Methods
AllGlobalCsprojs(ILogger, bool)
Builds and returns the global dictionary of all csproj files across all solution folders.
public static Task<Dictionary<string, List<string>>?> AllGlobalCsprojs(ILogger logger, bool listToClipboardInsteadOfThrowEx = false)
Parameters
loggerILoggerLogger instance for logging operations.
listToClipboardInsteadOfThrowExboolIf true, lists duplicates instead of throwing an exception.
Returns
- Task<Dictionary<string, List<string>>>
Dictionary mapping csproj filenames to their full paths, or null if not found.
CreateSolutionFolder(ILogger, string, SolutionFolderSerialize, PpkOnDriveDC, string?)
Creates a SolutionFolder from a serialized solution folder data object.
public static SolutionFolder CreateSolutionFolder(ILogger logger, string documentsFolder, SolutionFolderSerialize solutionFolder, PpkOnDriveDC toSelling, string? projName = null)
Parameters
loggerILoggerLogger instance for diagnostics.
documentsFolderstringPath to the documents folder.
solutionFolderSolutionFolderSerializeSerialized solution folder data.
toSellingPpkOnDriveDCPackage configuration.
projNamestringOptional project name override.
Returns
- SolutionFolder
A new SolutionFolder instance.
CreateSolutionFolder(ILogger, string, SolutionFolderSerialize, string, PpkOnDriveDC, string?)
toSelling can be null
public static SolutionFolder CreateSolutionFolder(ILogger logger, string documentsFolder, SolutionFolderSerialize solutionFolderData, string solutionFolder, PpkOnDriveDC toSelling, string? projName = null)
Parameters
loggerILoggerLogger instance
documentsFolderstringDocuments folder path
solutionFolderDataSolutionFolderSerializeSerialized solution folder data (can be null)
solutionFolderstringSolution folder path
toSellingPpkOnDriveDCSelling configuration (can be null)
projNamestringProject name (optional)
Returns
- SolutionFolder
Created SolutionFolder
CreateSolutionFolder(ILogger, string, string, PpkOnDriveDC, string?)
toSelling can be null
public static SolutionFolder CreateSolutionFolder(ILogger logger, string documentsFolder, string solutionFolder, PpkOnDriveDC toSelling, string? projName = null)
Parameters
loggerILoggerLogger instance.
documentsFolderstringDocuments folder path.
solutionFolderstringSolution folder path.
toSellingPpkOnDriveDCSelling configuration (can be null).
projNamestringProject name (optional).
Returns
- SolutionFolder
Created SolutionFolder.
FullPathFolders(RepositoryLocal, Dictionary<string, SolutionFolder>?, List<string>?)
Gets full path folders from repository with optional solution folder mapping
public static List<string> FullPathFolders(RepositoryLocal usedRepository, Dictionary<string, SolutionFolder>? solutionFoldersMap, List<string>? returnOnlyThese = null)
Parameters
usedRepositoryRepositoryLocalRepository to get folders from
solutionFoldersMapDictionary<string, SolutionFolder>Optional dictionary to populate with solution folder mappings
returnOnlyTheseList<string>Optional filter for specific solution names
Returns
FullPathFolders(RepositoryLocal, List<string>?)
Gets full path folders from repository
public static List<string> FullPathFolders(RepositoryLocal usedRepository, List<string>? returnOnlyThese = null)
Parameters
usedRepositoryRepositoryLocalRepository to get folders from
returnOnlyTheseList<string>Optional filter for specific solution names
Returns
GetSolutions(RepositoryLocal, bool, IList<string>?)
Gets solutions from repository with optional filtering Excludes from SolutionsIndexerConsts.SolutionsExcludeWhileWorkingOnSourceCode if Debugger is attached and !loadAll skipThese can use wildcard patterns
public List<SolutionFolder> GetSolutions(RepositoryLocal repository, bool isLoadingAll = true, IList<string>? skipThese = null)
Parameters
repositoryRepositoryLocalRepository to get solutions from
isLoadingAllboolIf false and debugger attached, excludes working solutions
skipTheseIList<string>Solution names to skip (supports wildcards)
Returns
- List<SolutionFolder>
Filtered list of solutions
IdentifyProjectType(string, string, SolutionFolder)
Identifies and sets the project type for a solution folder based on its path within the documents folder.
protected static void IdentifyProjectType(string documentsFolder, string solutionFolder, SolutionFolder solutionFolderData)
Parameters
documentsFolderstringRoot documents folder path.
solutionFolderstringFull path to the solution folder.
solutionFolderDataSolutionFolderSolution folder data object to update with project type information.
InsertIntoFwss(ILogger, string, PpkOnDriveDC, bool)
Creates a new FoldersWithSolutions instance and adds it to the global Fwss list.
public static void InsertIntoFwss(ILogger logger, string documentsFolder, PpkOnDriveDC toSelling, bool addAlsoSolutions = true)
Parameters
loggerILoggerLogger instance for diagnostics.
documentsFolderstringPath to the documents folder.
toSellingPpkOnDriveDCPackage configuration, can be null.
addAlsoSolutionsboolWhether to also load solution folders.
IsAllProjectNamesUnique(bool)
Checks whether all project names in the global csproj dictionary are unique.
public static bool IsAllProjectNamesUnique(bool isListToClipboardInsteadOfThrowEx = false)
Parameters
isListToClipboardInsteadOfThrowExboolIf true, collects duplicate paths instead of throwing.
Returns
- bool
True if all project names are unique.
PairProjectFolderWithEnum(ILogger, string)
Pairs project folder names with their corresponding ProjectsTypes enum values by scanning the documents folder.
public static void PairProjectFolderWithEnum(ILogger logger, string documentsFolder)
Parameters
loggerILoggerLogger instance for diagnostics.
documentsFolderstringPath to the documents folder to scan for project directories.
Reload(ILogger, string, PpkOnDriveDC)
Gets all projects in the documents folder (Visual Studio Projects) and GitHub folder, rebuilding the solutions list.
public List<SolutionFolder> Reload(ILogger logger, string documentsFolder, PpkOnDriveDC toSelling)
Parameters
loggerILoggerLogger instance for diagnostics.
documentsFolderstringPath to the documents folder containing project directories.
toSellingPpkOnDriveDCPackage configuration, can be null.
Returns
- List<SolutionFolder>
List of loaded solution folders.
ReturnNormalAndSpecialFolders(string)
Separates folders into normal and special (starting with _)
public static Tuple<List<string>, List<string>> ReturnNormalAndSpecialFolders(string folder)
Parameters
folderstringFolder path to analyze
Returns
ReturnNormalAndSpecialFolders(string, out List<string>, out List<string>)
Separates subfolders into those starting with _ (special) and others (normal)
public static void ReturnNormalAndSpecialFolders(string folder, out List<string> specialFolders, out List<string> normalFolders)
Parameters
folderstringFolder path to analyze
specialFoldersList<string>Output: folders starting with _
normalFoldersList<string>Output: other folders
SolutionsUap(IList<string>?)
Returns UAP (Universal App Platform) solutions from the VS17 repository.
public List<SolutionFolder> SolutionsUap(IList<string>? skipThese = null)
Parameters
Returns
- List<SolutionFolder>
List of UAP solution folders.
SolutionsWildcard(RepositoryLocal, string)
Gets solutions matching a wildcard pattern
public IList<SolutionFolder> SolutionsWildcard(RepositoryLocal repository, string wildcardPattern)
Parameters
repositoryRepositoryLocalRepository to search in
wildcardPatternstringWildcard pattern (can be plain text)
Returns
- IList<SolutionFolder>
List of matching solutions
SolutionsWithFiles()
Wraps each solution folder into a SolutionFolderWithFiles object for file-level access.
public List<SolutionFolderWithFiles> SolutionsWithFiles()
Returns
- List<SolutionFolderWithFiles>
List of solution folders with file information.