Table of Contents

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

logger ILogger
documentsFolder string
toSelling PpkOnDriveDC
addAlsoSolutions bool

FoldersWithSolutions(FoldersWithSolutions)

Creates a copy of another FoldersWithSolutions instance, sharing the same solutions and static data.

public FoldersWithSolutions(FoldersWithSolutions fws2)

Parameters

fws2 FoldersWithSolutions

Source 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

string

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

FoldersWithSolutionsList

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

List<string>

ProjectsWithDuplicateName

Gets or sets the list of project names that have duplicate entries across solutions.

public static List<string> ProjectsWithDuplicateName { get; set; }

Property Value

List<string>

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

List<SolutionFolder>

UsedRepository

Gets or sets the repository type used for solution lookups.

public static RepositoryLocal UsedRepository { get; set; }

Property Value

RepositoryLocal

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

Dictionary<string, List<string>>

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

logger ILogger

Logger instance for logging operations.

listToClipboardInsteadOfThrowEx bool

If 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

logger ILogger

Logger instance for diagnostics.

documentsFolder string

Path to the documents folder.

solutionFolder SolutionFolderSerialize

Serialized solution folder data.

toSelling PpkOnDriveDC

Package configuration.

projName string

Optional 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

logger ILogger

Logger instance

documentsFolder string

Documents folder path

solutionFolderData SolutionFolderSerialize

Serialized solution folder data (can be null)

solutionFolder string

Solution folder path

toSelling PpkOnDriveDC

Selling configuration (can be null)

projName string

Project 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

logger ILogger

Logger instance.

documentsFolder string

Documents folder path.

solutionFolder string

Solution folder path.

toSelling PpkOnDriveDC

Selling configuration (can be null).

projName string

Project 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

usedRepository RepositoryLocal

Repository to get folders from

solutionFoldersMap Dictionary<string, SolutionFolder>

Optional dictionary to populate with solution folder mappings

returnOnlyThese List<string>

Optional filter for specific solution names

Returns

List<string>

List of full path folders

FullPathFolders(RepositoryLocal, List<string>?)

Gets full path folders from repository

public static List<string> FullPathFolders(RepositoryLocal usedRepository, List<string>? returnOnlyThese = null)

Parameters

usedRepository RepositoryLocal

Repository to get folders from

returnOnlyThese List<string>

Optional filter for specific solution names

Returns

List<string>

List of full path folders

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

repository RepositoryLocal

Repository to get solutions from

isLoadingAll bool

If false and debugger attached, excludes working solutions

skipThese IList<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

documentsFolder string

Root documents folder path.

solutionFolder string

Full path to the solution folder.

solutionFolderData SolutionFolder

Solution 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

logger ILogger

Logger instance for diagnostics.

documentsFolder string

Path to the documents folder.

toSelling PpkOnDriveDC

Package configuration, can be null.

addAlsoSolutions bool

Whether 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

isListToClipboardInsteadOfThrowEx bool

If 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

logger ILogger

Logger instance for diagnostics.

documentsFolder string

Path 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

logger ILogger

Logger instance for diagnostics.

documentsFolder string

Path to the documents folder containing project directories.

toSelling PpkOnDriveDC

Package 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

folder string

Folder path to analyze

Returns

Tuple<List<string>, List<string>>

Tuple of (normal folders, special folders)

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

folder string

Folder path to analyze

specialFolders List<string>

Output: folders starting with _

normalFolders List<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

skipThese IList<string>

Solution names to skip (optional).

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

repository RepositoryLocal

Repository to search in

wildcardPattern string

Wildcard 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.