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
pushSolutionsData
Never create new instance, just call method
public PushSolutionsData pushSolutionsData
Field Value
repositoryUsedInApsH
Repository type currently used by this ApsHelper instance.
public RepositoryLocal repositoryUsedInApsH
Field Value
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
projectstringProject name.
slnNamestringSolution folder name.
eVsProjectsstringBase 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
addProjectReferencesWhenAlreadyIsInSlnboolprojectsToAddList<string>slnFromWhichIsAddedobjectprojectTypesDictionary<string, Guid>projectIdsDictionary<string, Guid>slnToWhichAddstring
Returns
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
loggerILoggerLogger instance.
vs17RepositoryLocalRepository location, must be Vs17.
webNonWebWebNonWebFilter for web, non-web, or both project types.
withCsprojsboolIf true, returns csproj paths; if false, returns directory paths.
Returns
AllSolutions(RepositoryLocal)
Retrieves all solution folders across all registered FoldersWithSolutions instances for the specified repository.
public List<SolutionFolder> AllSolutions(RepositoryLocal vs17)
Parameters
vs17RepositoryLocalRepository 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
asyncPushSolutionsObjectobjectAsyncPushSolutions instance containing push configuration.
psInvokeFunc<List<string>, Task<List<List<string>>>>PowerShell invoke function for executing git commands.
eVsstringEnvironment variable for the drive path.
pathGetMessagesFromGitOutputstringPath to file for storing git output messages.
Returns
DetectDocumentsFolder(SolutionFolder)
Detects the documents folder that contains the given solution folder by searching all registered FoldersWithSolutions instances.
public string? DetectDocumentsFolder(SolutionFolder sln)
Parameters
slnSolutionFolderSolution 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
shouldProcessMessagesbool?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
shouldProcessMessagesbool?Whether to process messages from git output.
stringBuilderGitBashBuilderGit bash builder containing the generated commands.
eVsstringBase path for Visual Studio projects.
pathGetMessagesFromGitOutputstringPath to the file with git output messages.
Returns
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
slnNamesList<KeyValuePair<string, string>>List of solution names as key-value pairs
Returns
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
Returns
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
loggerILoggerLogger instance
folderstringFolder to search in
typedExtstringFile extension to search for
Returns
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
Returns
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
shouldProcessMessagesbool?Whether to actually process messages or return empty.
linesList<string>Git output lines to process.
gitMessageTypesGitTypesOfMessagesTypes of git messages to check for (fatal, error).
eVsstringEnvironment variable for the drive path.
Returns
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
slnSolutionFolderdocumentsFolderstring
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
slnSolutionFolderfullPathCsprojstring
Returns
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
filestringFile path within the sunamo solution structure.
slnFullPathstringSolution folder path used to calculate depth for relative navigation.
delimitercharPath 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
loggerILoggerLogger instance for diagnostics.
pathstringPath to the directory to search in.
getFilesArgsGetFilesArgsDCOptional file retrieval arguments.
Returns
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
projectPathstringPath to the project
Returns
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
loggerILoggerLogger instance.
slnSolutionFolderSolution folder to check.
getFileSettingsGetFileSettingsSettings provider for configuration files.
Returns
MainSln(SolutionFolder)
Finds the main solution file for the given SolutionFolder by checking all known solution extensions.
public string? MainSln(SolutionFolder sln)
Parameters
slnSolutionFolderSolution 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
fullPathFolderstringFull 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
builderbool?Dialog result; true to proceed with push.
psInvokeFunc<List<string>, Task<List<List<string>>>>Function to invoke PowerShell commands.
eVsstringPath to Visual Studio root folder.
pathGetMessagesFromGitOutputstringPath for storing git output messages.
Returns
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
gitBashBuilderstringGit bash commands string to copy to clipboard.
pushbool?Whether this is a push operation (true), pull (false), or null for general.
eVsstringEnvironment variable for the drive path.
pathGetMessagesFromGitOutputstringPath to file for storing git output messages.
Returns
SkipTheseGit()
Returns a list of repository names to skip during git operations.
public List<string> SkipTheseGit()
Returns
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
fullPathFolderstringFull 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
loggerILoggerLogger instance.
withCsprojsboolIf true, returns full csproj paths; if false, returns directory paths.