Table of Contents

Class ApsHelper

Namespace
SunamoDevCode.Aps
Assembly
SunamoDevCode.dll

EN: Helper class for APS (AllProjectsSearch) functionality CZ: Pomocná třída pro APS (AllProjectsSearch) funkcionalitu

public class ApsHelper : ApsPluginStatic
Inheritance
ApsHelper
Inherited Members
Extension Methods

Fields

Instance

EN: Singleton instance of ApsHelper CZ: Singleton instance ApsHelper

public static ApsHelper Instance

Field Value

ApsHelper

pushSolutionsData

Never create new instance, just call method

public PushSolutionsData pushSolutionsData

Field Value

PushSolutionsData

repositoryUsedInApsH

Repository type currently used by this ApsHelper instance.

public RepositoryLocal repositoryUsedInApsH

Field Value

RepositoryLocal

Methods

AbsolutePathOfProject(string, string, string)

Constructs the absolute path to a .csproj file within the VS projects structure.

public string AbsolutePathOfProject(string project, string slnName, string eVsProjects)

Parameters

project string

Project name.

slnName string

Solution folder name.

eVsProjects string

Base path to VS projects directory.

Returns

string

Full path to the .csproj file.

AddProjectsToSln(bool, List<string>, object, Dictionary<string, Guid>, Dictionary<string, Guid>, string)

A2 - must be full paths to projects

public Task AddProjectsToSln(bool addProjectReferencesWhenAlreadyIsInSln, List<string> projectsToAdd, object slnFromWhichIsAdded, Dictionary<string, Guid> projectTypes, Dictionary<string, Guid> projectIds, string slnToWhichAdd)

Parameters

addProjectReferencesWhenAlreadyIsInSln bool
projectsToAdd List<string>
slnFromWhichIsAdded object
projectTypes Dictionary<string, Guid>
projectIds Dictionary<string, Guid>
slnToWhichAdd string

Returns

Task

AllProjects(ILogger, RepositoryLocal, WebNonWeb, bool)

Gets all projects filtered by web/non-web category.

public List<string>? AllProjects(ILogger logger, RepositoryLocal vs17, WebNonWeb webNonWeb, bool withCsprojs = true)

Parameters

logger ILogger

Logger instance.

vs17 RepositoryLocal

Repository location, must be Vs17.

webNonWeb WebNonWeb

Filter for web, non-web, or both project types.

withCsprojs bool

If true, returns csproj paths; if false, returns directory paths.

Returns

List<string>

Filtered list of project paths.

AllSolutions(RepositoryLocal)

Retrieves all solution folders across all registered FoldersWithSolutions instances for the specified repository.

public List<SolutionFolder> AllSolutions(RepositoryLocal vs17)

Parameters

vs17 RepositoryLocal

Repository type to filter solutions by.

Returns

List<SolutionFolder>

List of all solution folders found.

CheckForPushInThread(object, Func<List<string>, Task<List<List<string>>>>, string, string)

Pushes solutions to git in a thread, building bash commands and showing output window.

public Task CheckForPushInThread(object asyncPushSolutionsObject, Func<List<string>, Task<List<List<string>>>> psInvoke, string eVs, string pathGetMessagesFromGitOutput)

Parameters

asyncPushSolutionsObject object

AsyncPushSolutions instance containing push configuration.

psInvoke Func<List<string>, Task<List<List<string>>>>

PowerShell invoke function for executing git commands.

eVs string

Environment variable for the drive path.

pathGetMessagesFromGitOutput string

Path to file for storing git output messages.

Returns

Task

DetectDocumentsFolder(SolutionFolder)

Detects the documents folder that contains the given solution folder by searching all registered FoldersWithSolutions instances.

public string? DetectDocumentsFolder(SolutionFolder sln)

Parameters

sln SolutionFolder

Solution folder to find the containing documents folder for.

Returns

string

Path to the documents folder, or null if not found.

EnterOutputOfPowershellGit_ChangeDialogResult(bool?)

Handles the dialog result change event for the git output processing window.

public void EnterOutputOfPowershellGit_ChangeDialogResult(bool? shouldProcessMessages)

Parameters

shouldProcessMessages bool?

Whether to process messages from the output.

EnterOutputOfPowershellGit_ChangeDialogResult(bool?, GitBashBuilder, string, string)

Processes git output messages and prepares the result for clipboard, adjusting paths for VPS if needed.

public Task EnterOutputOfPowershellGit_ChangeDialogResult(bool? shouldProcessMessages, GitBashBuilder stringBuilder, string eVs, string pathGetMessagesFromGitOutput)

Parameters

shouldProcessMessages bool?

Whether to process messages from git output.

stringBuilder GitBashBuilder

Git bash builder containing the generated commands.

eVs string

Base path for Visual Studio projects.

pathGetMessagesFromGitOutput string

Path to the file with git output messages.

Returns

Task

FullPathsFromSolutionsNames(List<KeyValuePair<string, string>>)

EN: Converts solution names to full paths CZ: Převede názvy solution na úplné cesty

public static List<string> FullPathsFromSolutionsNames(List<KeyValuePair<string, string>> slnNames)

Parameters

slnNames List<KeyValuePair<string, string>>

List of solution names as key-value pairs

Returns

List<string>

GetCsprojsOnlyTopDirectory(ILogger, string)

Gets all .csproj files in the top level of the specified project directory.

public List<string> GetCsprojsOnlyTopDirectory(ILogger logger, string projectPath)

Parameters

logger ILogger

Logger instance for diagnostics.

projectPath string

Path to the project directory.

Returns

List<string>

List of .csproj file paths found.

GetFilesForGitExcludeTemporary(ILogger, string, string)

EN: Gets files for git excluding temporary files CZ: Získá soubory pro git s vyloučením dočasných souborů

public List<string> GetFilesForGitExcludeTemporary(ILogger logger, string folder, string typedExt)

Parameters

logger ILogger

Logger instance

folder string

Folder to search in

typedExt string

File extension to search for

Returns

List<string>

GetMessagesFromGitOutput(List<string>)

Parses git output lines to identify failed restore sections and copies them to clipboard.

public IList<string>? GetMessagesFromGitOutput(List<string> lines)

Parameters

lines List<string>

Lines of git output to parse.

Returns

IList<string>

Always returns null after processing.

GetMessagesFromGitOutput(bool?, ref List<string>, GitTypesOfMessages, string)

Filters git output lines for fatal/error messages and returns the names of affected solutions.

public List<string> GetMessagesFromGitOutput(bool? shouldProcessMessages, ref List<string> lines, GitTypesOfMessages gitMessageTypes, string eVs)

Parameters

shouldProcessMessages bool?

Whether to actually process messages or return empty.

lines List<string>

Git output lines to process.

gitMessageTypes GitTypesOfMessages

Types of git messages to check for (fatal, error).

eVs string

Environment variable for the drive path.

Returns

List<string>

List of solution names with matching error messages.

GetProjectFolderAndSlnPath(SolutionFolder, string?)

Save to A1 variables projectFolder and slnFullPath A2 can be null, then will be detected automatically

public void GetProjectFolderAndSlnPath(SolutionFolder sln, string? documentsFolder = null)

Parameters

sln SolutionFolder
documentsFolder string

GetRelativePathFromSolution(SolutionFolder, string)

Return without ../ Get relative path to A2 without solution base folder

A1 = Scripts_Project A2 = E:\vs\Projects\PlatformIndependentNuGetPackages\dll\HtmlAgilityPack.dll Result = sunamo\dll\HtmlAgilityPack.dll

public string GetRelativePathFromSolution(SolutionFolder sln, string fullPathCsproj)

Parameters

sln SolutionFolder
fullPathCsproj string

Returns

string

GetRelativePathToProject(string, string, char)

Computes a relative path from a solution structure file to a project, prepending appropriate parent directory references.

public string GetRelativePathToProject(string file, string slnFullPath, char delimiter)

Parameters

file string

File path within the sunamo solution structure.

slnFullPath string

Solution folder path used to calculate depth for relative navigation.

delimiter char

Path separator character to use.

Returns

string

Relative path with parent directory prefixes navigating to the project.

GetSlns(ILogger, string, GetFilesArgsDC?)

Gets all solution files (.sln, .slnx, .slnj) in the specified directory. Always uses SearchOption.TopDirectoryOnly.

public List<string> GetSlns(ILogger logger, string path, GetFilesArgsDC? getFilesArgs = null)

Parameters

logger ILogger

Logger instance for diagnostics.

path string

Path to the directory to search in.

getFilesArgs GetFilesArgsDC

Optional file retrieval arguments.

Returns

List<string>

List of solution file paths found.

IsWeb(string)

EN: Determines whether the project is a web project CZ: Určuje zda je projekt webový projekt

public static bool IsWeb(string projectPath)

Parameters

projectPath string

Path to the project

Returns

bool

IsWebProject(ILogger, SolutionFolder, GetFileSettings)

Determines whether the given solution is a web project by matching against web project wildcards.

public Task<bool> IsWebProject(ILogger logger, SolutionFolder sln, GetFileSettings getFileSettings)

Parameters

logger ILogger

Logger instance.

sln SolutionFolder

Solution folder to check.

getFileSettings GetFileSettings

Settings provider for configuration files.

Returns

Task<bool>

True if the solution matches a web project wildcard pattern.

MainSln(SolutionFolder)

Finds the main solution file for the given SolutionFolder by checking all known solution extensions.

public string? MainSln(SolutionFolder sln)

Parameters

sln SolutionFolder

Solution folder to find the solution file for.

Returns

string

Path to the solution file, or null if not found.

MainSln2(string)

Finds the main solution file in the specified folder by checking all known solution extensions.

public string? MainSln2(string fullPathFolder)

Parameters

fullPathFolder string

Full path to the folder to search in.

Returns

string

Path to the solution file, or null if not found.

PushSolutionsContinuouslyWindow_ChangeDialogResult(bool?, Func<List<string>, Task<List<List<string>>>>, string, string)

Handles the dialog result for continuous push solutions window, executing git operations on selected solutions.

public Task PushSolutionsContinuouslyWindow_ChangeDialogResult(bool? builder, Func<List<string>, Task<List<List<string>>>> psInvoke, string eVs, string pathGetMessagesFromGitOutput)

Parameters

builder bool?

Dialog result; true to proceed with push.

psInvoke Func<List<string>, Task<List<List<string>>>>

Function to invoke PowerShell commands.

eVs string

Path to Visual Studio root folder.

pathGetMessagesFromGitOutput string

Path for storing git output messages.

Returns

Task

ShowWindowForEnterOutputOfPowershell(string, bool?, string, string)

Shows a window or CLI prompt for entering PowerShell/git output and processing the results.

public Task ShowWindowForEnterOutputOfPowershell(string gitBashBuilder, bool? push, string eVs, string pathGetMessagesFromGitOutput)

Parameters

gitBashBuilder string

Git bash commands string to copy to clipboard.

push bool?

Whether this is a push operation (true), pull (false), or null for general.

eVs string

Environment variable for the drive path.

pathGetMessagesFromGitOutput string

Path to file for storing git output messages.

Returns

Task

SkipTheseGit()

Returns a list of repository names to skip during git operations.

public List<string> SkipTheseGit()

Returns

List<string>

List of repository names to exclude.

SlnFilePathFromFolder(string)

Returns the path to the solution file within the given folder, trying all known extensions before falling back to .sln.

public string SlnFilePathFromFolder(string fullPathFolder)

Parameters

fullPathFolder string

Full path to the solution folder.

Returns

string

Path to an existing solution file, or a default .sln path if none found.

WebAndNonWebProjects(ILogger, bool)

Separates all projects into web and non-web categories. Do not use XmlDocumentsCache.

public static Tuple<List<string>, List<string>> WebAndNonWebProjects(ILogger logger, bool withCsprojs = true)

Parameters

logger ILogger

Logger instance.

withCsprojs bool

If true, returns full csproj paths; if false, returns directory paths.

Returns

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

Tuple with web projects as Item1 and non-web projects as Item2.