Class ConfigManager
Managers the loading and saving of solution configurations.
Inherited Members
Namespace: CodeFactory.WinVs.Commands
Assembly: CodeFactory.WinVs.dll
Syntax
public static class ConfigManager
  Properties
Configuration
The configuration loaded into the configuration manager, will be null if not loaded.
Declaration
public static ConfigSolution Configuration { get; }
  Property Value
| Type | Description | 
|---|---|
| ConfigSolution | 
ConfigurationName
The name of the loaded configuration. Will be null if the configuration is not loaded.
Declaration
public static string ConfigurationName { get; }
  Property Value
| Type | Description | 
|---|---|
| string | 
HasConfiguration
Flag that determines if a configuration has been loaded.
Declaration
public static bool HasConfiguration { get; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
HasDefaultConfiguration
Flag that determines if a default configuration has been loaded.
Declaration
public static bool HasDefaultConfiguration { get; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
Methods
CreateDefaultConfigurationAsync(VsSolution, string, string)
Will check to see if a default configuration exists. if it does not will create a new default configuration.
Declaration
public static Task CreateDefaultConfigurationAsync(VsSolution solution, string configName, string fileName)
  Parameters
| Type | Name | Description | 
|---|---|---|
| VsSolution | solution | The solution model from code factory.  | 
      
| string | configName | The name assigned to configuration.  | 
      
| string | fileName | The file name without the extension.  | 
      
Returns
| Type | Description | 
|---|---|
| Task | 
HasAutomationConfigAsync(VsSolution, string)
Determines if a ADK configuration is stored in the solution.
Declaration
public static Task<bool> HasAutomationConfigAsync(VsSolution solution, string fileName)
  Parameters
| Type | Name | Description | 
|---|---|---|
| VsSolution | solution | Solution model hosting the configuration model.  | 
      
| string | fileName | The file name without the extension.  | 
      
Returns
| Type | Description | 
|---|---|
| Task<bool> | True file exists or false if not.  | 
      
LoadCommandByFolderAsync(string, string, VsModel, FolderLoadType)
Identifies the command source for the executing command where the command is expected to execute from a project folder.
Declaration
public static Task<ConfigCommand> LoadCommandByFolderAsync(string commandType, string projectFolder, VsModel commandResult, FolderLoadType loadType = FolderLoadType.TargetFolderOnly)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string | commandType | The fully qualified name of the command type to evaluated.  | 
      
| string | projectFolder | the name of the Project Source project folder to be loaded.  | 
      
| VsModel | commandResult | The loaded model from the requesting command to load the command source.  | 
      
| FolderLoadType | loadType | The type of evaluation that should be performed.  | 
      
Returns
| Type | Description | 
|---|---|
| Task<ConfigCommand> | The command source that meetings the criteria or null if no command source meet the criteria.  | 
      
LoadCommandByProjectAsync(string, VsModel)
Identifies the command source for the executing command where the command is expected to execute from a target project.
Declaration
public static Task<ConfigCommand> LoadCommandByProjectAsync(string commandType, VsModel commandResult)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string | commandType | The fully qualified name of the command type to evaluated.  | 
      
| VsModel | commandResult | The loaded model from the requesting command to load the command source.  | 
      
Returns
| Type | Description | 
|---|---|
| Task<ConfigCommand> | The command source that meetings the criteria or null if no command source meet the criteria.  | 
      
LoadConfiguration(VsSolution, string, IVsActions)
Loads a ADK configuration from a target configuration file.
Declaration
public static ConfigSolution LoadConfiguration(VsSolution solution, string fileName, IVsActions actions)
  Parameters
| Type | Name | Description | 
|---|---|---|
| VsSolution | solution | The solution model used to locate the configuration to be loaded.  | 
      
| string | fileName | The file name without the extension.  | 
      
| IVsActions | actions | The Visual Studio automation for CodeFactory.  | 
      
Returns
| Type | Description | 
|---|---|
| ConfigSolution | Loaded solution configuration.  | 
      
RegisterCommandWithDefaultConfiguration(ConfigCommand)
Registers a command configuration with the configuration manager to be used when building a default configuration.
Declaration
public static void RegisterCommandWithDefaultConfiguration(this ConfigCommand command)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ConfigCommand | command | Command configuration to be registered  | 
      
SaveConfigurationAsync(VsSolution, ConfigSolution, IVsActions, string)
Saves a ADK configuration to a target directory.
Declaration
public static Task SaveConfigurationAsync(VsSolution solution, ConfigSolution configuration, IVsActions actions, string fileName)
  Parameters
| Type | Name | Description | 
|---|---|---|
| VsSolution | solution | The CodeFactory solution model to save the configuration to.  | 
      
| ConfigSolution | configuration | The solution configuration to be saved to disk.  | 
      
| IVsActions | actions | The Visual Studio automation for CodeFactory.  | 
      
| string | fileName | The file name of the configuration file without the extension.  | 
      
Returns
| Type | Description | 
|---|---|
| Task | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | Raised if provided parameters are null.  | 
      
| ArgumentException | Raised if the file path is not provided.  | 
      
| CodeFactoryException | Raised if the save cannot be completed.  | 
      
SetConfiguration(ConfigSolution, IVsActions)
Register a loaded configuration with the configuration manager.
Declaration
public static void SetConfiguration(ConfigSolution configuration, IVsActions actions)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ConfigSolution | configuration | The loaded configuration.  | 
      
| IVsActions | actions | The Visual Studio automation for CodeFactory.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException |