Class VsProjectFolder
Data model that represents a folder in a project hosted in visual studio.
Inherited Members
Namespace: CodeFactory.VisualStudio
Assembly: CodeFactory.VisualStudio.dll
Syntax
public abstract class VsProjectFolder : VsModel, IVsProjectFolder, IVsModel, IModel<VisualStudioModelType>, IParent, IChildren
Constructors
| Improve this Doc View SourceVsProjectFolder(bool, bool, IReadOnlyList<ModelException<VisualStudioModelType>>, string, bool, bool, string)
Constructor for the base class VsProjectFolder
Declaration
protected VsProjectFolder(bool isLoaded, bool hasErrors, IReadOnlyList<ModelException<VisualStudioModelType>> modelErrors, string name, bool hasParent, bool hasChildren, string path)
Parameters
Type | Name | Description |
---|---|---|
bool | isLoaded | Flag that determines if the model is loaded. |
bool | hasErrors | Flag that determines if errors occurred while loading the model. |
IReadOnlyList<ModelException<VisualStudioModelType>> | modelErrors | The list of errors that occurred if any. |
string | name | The name of the model. |
bool | hasParent | Flag that determines if the model has a parent model. |
bool | hasChildren | Flag that determines if the model has child models. |
string | path | The fully qualified path to the project folder. |
Properties
| Improve this Doc View SourceHasChildren
Flag that determines if this visual studio object has child objects.
Declaration
public bool HasChildren { get; }
Property Value
Type | Description |
---|---|
bool |
HasParent
Flag that determines if the visual studio object has a parent.
Declaration
public bool HasParent { get; }
Property Value
Type | Description |
---|---|
bool |
Path
the fully qualified path to the project folder.
Declaration
public string Path { get; }
Property Value
Type | Description |
---|---|
string |
Methods
| Improve this Doc View SourceAddDocumentAsync(string, string)
Adds a document to the project folder.
Declaration
public abstract Task<VsDocument> AddDocumentAsync(string fileName, string content = null)
Parameters
Type | Name | Description |
---|---|---|
string | fileName | The file name for the document. This should be the file name only with extension. |
string | content | The content to be added to the document once its added. Note, this is an optional parameter. |
Returns
Type | Description |
---|---|
Task<VsDocument> | The model of the created project document. |
AddExistingDocumentAsync(string)
Adds an existing document to the project folder.
Declaration
public abstract Task<VsDocument> AddExistingDocumentAsync(string fileName)
Parameters
Type | Name | Description |
---|---|---|
string | fileName | The file name for the document. This should be the file name only with extension. The file must already be in the project folder. |
Returns
Type | Description |
---|---|
Task<VsDocument> | The model of the created project document. |
AddProjectFolderAsync(string)
Adds a new project folder under the current project folder.
Declaration
public abstract Task<VsProjectFolder> AddProjectFolderAsync(string folderName)
Parameters
Type | Name | Description |
---|---|---|
string | folderName | The name of the project folder. The project folder name should be the name only no path. |
Returns
Type | Description |
---|---|
Task<VsProjectFolder> | The model for the created project folder. |
DeleteAsync()
Deletes the project folder.
Declaration
public abstract Task<bool> DeleteAsync()
Returns
Type | Description |
---|---|
Task<bool> | Flag determining if the folder was deleted, True for deleted and false if the folder could not be deleted. |
GetChildrenAsync(bool, bool)
Gets the IVsModel of the items that are direct children of this project folder.
Declaration
public abstract Task<IReadOnlyList<VsModel>> GetChildrenAsync(bool allChildren, bool loadSourceCode = false)
Parameters
Type | Name | Description |
---|---|---|
bool | allChildren | Flag that determines if all children not just the first level children of the project folder. |
bool | loadSourceCode | Flag to determine if code files that support code factory source code will be loaded by default. If enabled this could be memory intensive. |
Returns
Type | Description |
---|---|
Task<IReadOnlyList<VsModel>> | Readonly list of the children that belong to this project folder. If no children are found an empty readonly list will be returned. |
GetCSharpNamespaceAsync()
Gets the target namespace for a document that support c# language to be placed in this folder.
Declaration
public abstract Task<string> GetCSharpNamespaceAsync()
Returns
Type | Description |
---|---|
Task<string> | The fully qualified namespace if the project is a c# project that supports this project folder. Otherwise null will be returned. |
GetParentAsync()
Gets the parent visual studio model that is the parent of this Project folder.
Declaration
public abstract Task<VsModel> GetParentAsync()
Returns
Type | Description |
---|---|
Task<VsModel> | The visual studio model of the parent or null if the project folder does not have a parent. |
RemoveAsync()
Removes the project folder from visual studio, but does not delete it from the file system.
Declaration
public abstract Task<bool> RemoveAsync()
Returns
Type | Description |
---|---|
Task<bool> | Flag determining if the folder was removed, True for removed and false if the folder could not be removed. |