Class VirtualStorage<T>
Manages virtual storage containing user-defined type T item data.
Inherited Members
Namespace: AkiraNetwork.VirtualStorageLibrary
Assembly: VirtualStorageLibrary.dll
Syntax
public class VirtualStorage<T>
Type Parameters
| Name | Description |
|---|---|
| T | The user-defined type within the virtual storage |
Constructors
VirtualStorage()
Initializes a new instance of the VirtualStorage class.
Declaration
public VirtualStorage()
Properties
CurrentPath
Gets or sets the current virtual path.
Declaration
public VirtualPath CurrentPath { get; }
Property Value
| Type | Description |
|---|---|
| VirtualPath | The current virtual path |
CycleDetectorForTarget
Gets the cycle detector class used for the WalkPathToTarget method.
Declaration
public VirtualCycleDetector CycleDetectorForTarget { get; }
Property Value
| Type | Description |
|---|---|
| VirtualCycleDetector | An instance of the cycle detector class |
CycleDetectorForTree
Gets the cycle detector class used for the WalkPathTree method.
Declaration
public VirtualCycleDetector CycleDetectorForTree { get; }
Property Value
| Type | Description |
|---|---|
| VirtualCycleDetector | An instance of the cycle detector class |
this[VirtualPath, bool]
Gets or sets the virtual node corresponding to the specified virtual path.
Declaration
public VirtualDirectory this[VirtualPath path, bool followLinks = true] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The virtual path |
| bool | followLinks | Flag indicating whether to follow symbolic links |
Property Value
| Type | Description |
|---|---|
| VirtualDirectory | The virtual node corresponding to the specified virtual path |
Item
Gets the adapter providing operations for virtual items.
Declaration
public VirtualItemAdapter<T> Item { get; }
Property Value
| Type | Description |
|---|---|
| VirtualItemAdapter<T> | An instance of VirtualItemAdapter<T> |
Link
Gets the adapter providing operations for virtual symbolic links.
Declaration
public VirtualSymbolicLinkAdapter<T> Link { get; }
Property Value
| Type | Description |
|---|---|
| VirtualSymbolicLinkAdapter<T> | An instance of VirtualSymbolicLinkAdapter<T> |
LinkDictionary
Gets the link dictionary.
Declaration
public Dictionary<VirtualPath, HashSet<VirtualPath>> LinkDictionary { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<VirtualPath, HashSet<VirtualPath>> | A dictionary representing the link mappings. |
Root
Gets the root directory of the virtual storage.
Declaration
public VirtualDirectory Root { get; }
Property Value
| Type | Description |
|---|---|
| VirtualDirectory | The root directory of the virtual storage |
Methods
AddDirectory(VirtualPath, VirtualDirectory, bool)
Adds a directory.
Declaration
public void AddDirectory(VirtualPath directoryPath, VirtualDirectory directory, bool createSubdirectories = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | directoryPath | The path of the directory to add |
| VirtualDirectory | directory | The VirtualDirectory to add |
| bool | createSubdirectories | Indicates whether to create intermediate directories |
AddDirectory(VirtualPath, bool)
Adds a directory.
Declaration
public void AddDirectory(VirtualPath path, bool createSubdirectories = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The path of the directory to add |
| bool | createSubdirectories | Indicates whether to create intermediate directories |
AddItem(VirtualPath, VirtualItem<T>, bool)
Adds an item.
Declaration
public void AddItem(VirtualPath itemDirectoryPath, VirtualItem<T> item, bool overwrite = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | itemDirectoryPath | The path of the directory to add the item to |
| VirtualItem<T> | item | The VirtualItem<T> to add |
| bool | overwrite | Indicates whether to overwrite an existing node |
AddItem(VirtualPath, T?, bool)
Adds an item.
Declaration
public void AddItem(VirtualPath itemPath, T? data = default, bool overwrite = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | itemPath | The path of the item to add |
| T | data | The data for the item |
| bool | overwrite | Indicates whether to overwrite an existing node |
AddLinkToDictionary(VirtualPath, VirtualPath)
Adds a new link to the link dictionary.
Declaration
public void AddLinkToDictionary(VirtualPath targetPath, VirtualPath linkPath)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | targetPath | The target path of the link. |
| VirtualPath | linkPath | The path of the link. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the target path is not an absolute path. |
AddNode(VirtualPath, VirtualNode, bool)
Adds a node to the specified directory.
Declaration
public void AddNode(VirtualPath nodeDirectoryPath, VirtualNode node, bool overwrite = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | nodeDirectoryPath | The path of the directory to add the node to |
| VirtualNode | node | The VirtualNode to add |
| bool | overwrite | Indicates whether to overwrite an existing node |
AddSymbolicLink(VirtualPath, VirtualPath?, bool)
Adds a symbolic link.
Declaration
public void AddSymbolicLink(VirtualPath linkPath, VirtualPath? targetPath = null, bool overwrite = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | linkPath | The path of the symbolic link |
| VirtualPath | targetPath | The path of the target |
| bool | overwrite | Indicates whether to overwrite an existing node |
AddSymbolicLink(VirtualPath, VirtualSymbolicLink, bool)
Adds a symbolic link.
Declaration
public void AddSymbolicLink(VirtualPath linkDirectoryPath, VirtualSymbolicLink link, bool overwrite = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | linkDirectoryPath | The path of the directory to add the symbolic link to |
| VirtualSymbolicLink | link | The VirtualSymbolicLink to add |
| bool | overwrite | Indicates whether to overwrite an existing node |
ChangeDirectory(VirtualPath)
Changes the current working directory.
Declaration
public void ChangeDirectory(VirtualPath path)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The path of the new working directory |
ConvertToAbsolutePath(VirtualPath?, VirtualPath?)
Converts a relative path to an absolute path.
Declaration
public VirtualPath ConvertToAbsolutePath(VirtualPath? relativePath, VirtualPath? basePath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | relativePath | The relative path. |
| VirtualPath | basePath | The base path. If not specified, CurrentPath is used. |
Returns
| Type | Description |
|---|---|
| VirtualPath | The absolute path represented by VirtualPath. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if relativePath is null or an empty string. |
CopyNode(VirtualPath, VirtualPath, bool, bool, bool, List<VirtualNodeContext>?)
Copies the node at the specified path.
Declaration
public void CopyNode(VirtualPath sourcePath, VirtualPath destinationPath, bool overwrite = false, bool recursive = false, bool followLinks = false, List<VirtualNodeContext>? destinationContextList = null)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | sourcePath | The source path of the copy. |
| VirtualPath | destinationPath | The destination path of the copy. |
| bool | overwrite | Whether to overwrite existing nodes. |
| bool | recursive | Whether to copy recursively. |
| bool | followLinks | Whether to follow symbolic links. |
| List<VirtualNodeContext> | destinationContextList | List of destination contexts. |
Exceptions
| Type | Condition |
|---|---|
| VirtualNodeNotFoundException | Thrown if the source node is not found. |
| InvalidOperationException | Thrown if the source and destination paths are the same or if a recursive copy would result in a circular reference. |
DirectoryExists(VirtualPath, bool)
Checks if a directory exists at the specified path.
Declaration
public bool DirectoryExists(VirtualPath path, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The directory's path. |
| bool | followLinks | Whether to follow symbolic links. |
Returns
| Type | Description |
|---|---|
| bool | True if the directory exists; otherwise, false. |
ExpandPath(VirtualPath, VirtualNodeTypeFilter, bool, bool)
Expands a path that contains wildcards.
Declaration
public IEnumerable<VirtualPath> ExpandPath(VirtualPath path, VirtualNodeTypeFilter filter = VirtualNodeTypeFilter.All, bool followLinks = true, bool resolveLinks = true)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The path. |
| VirtualNodeTypeFilter | filter | The node type filter. |
| bool | followLinks | Whether to follow symbolic links. |
| bool | resolveLinks | Whether to resolve symbolic links. |
Returns
| Type | Description |
|---|---|
| IEnumerable<VirtualPath> | The expanded paths IEnumerable<T>. |
Remarks
followLinks indicates whether to follow links during the recursive traversal of nodes when the terminal node of the path is a symbolic link.
resolveLinks indicates whether to resolve links when non-terminal nodes of the path are symbolic links.
ExpandPathTree(VirtualPath, VirtualNodeTypeFilter, bool, bool)
Expands the virtual path containing wildcards.
Declaration
public IEnumerable<VirtualNodeContext> ExpandPathTree(VirtualPath path, VirtualNodeTypeFilter filter = VirtualNodeTypeFilter.All, bool followLinks = true, bool resolveLinks = true)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The virtual path containing wildcards |
| VirtualNodeTypeFilter | filter | The filter to apply for node types |
| bool | followLinks | A flag indicating whether to follow symbolic links |
| bool | resolveLinks | A flag indicating whether to resolve symbolic links |
Returns
| Type | Description |
|---|---|
| IEnumerable<VirtualNodeContext> | An enumerable of VirtualNodeContext containing information about the expanded nodes |
Remarks
followLinks indicates whether to follow links during the recursive traversal process when the terminal node in the virtual path is a symbolic link.
resolveLinks indicates whether to resolve links when nodes other than the terminal node in the virtual path are symbolic links.
GetDirectory(VirtualPath, bool)
Gets the directory at the specified path.
Declaration
public VirtualDirectory GetDirectory(VirtualPath path, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The path of the directory. |
| bool | followLinks | Whether to follow symbolic links. |
Returns
| Type | Description |
|---|---|
| VirtualDirectory | The VirtualDirectory at the specified path. |
Exceptions
| Type | Condition |
|---|---|
| VirtualNodeNotFoundException | Thrown if the node cannot be found. |
GetItem(VirtualPath, bool)
Gets the item at the specified path.
Declaration
public VirtualItem<T> GetItem(VirtualPath path, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The path of the item. |
| bool | followLinks | Whether to follow symbolic links. |
Returns
| Type | Description |
|---|---|
| VirtualItem<T> | The VirtualItem<T> at the specified path. |
Exceptions
| Type | Condition |
|---|---|
| VirtualNodeNotFoundException | Thrown if the node cannot be found. |
GetLinksFromDictionary(VirtualPath)
Retrieves all link paths associated with the specified target path from the link dictionary.
Declaration
public HashSet<VirtualPath> GetLinksFromDictionary(VirtualPath targetPath)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | targetPath | The target path. |
Returns
| Type | Description |
|---|---|
| HashSet<VirtualPath> | A set of link paths. |
GetNode(VirtualPath, bool)
Gets the node at the specified path.
Declaration
public VirtualNode GetNode(VirtualPath path, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The node's path. |
| bool | followLinks | Whether to follow symbolic links. |
Returns
| Type | Description |
|---|---|
| VirtualNode | The VirtualNode at the specified path. |
Exceptions
| Type | Condition |
|---|---|
| VirtualNodeNotFoundException | Thrown if the node cannot be found. |
GetNodeID(VirtualPath, bool)
Retrieves the unique identifier (VirtualID) of the node located at the specified path.
Declaration
public VirtualID GetNodeID(VirtualPath path, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The VirtualPath representing the location of the node whose VirtualID is to be retrieved. |
| bool | followLinks | A boolean value indicating whether to follow symbolic links while resolving the node.
If set to |
Returns
| Type | Description |
|---|---|
| VirtualID | The VirtualID of the node located at the specified path. |
GetNodeType(VirtualPath, bool)
Gets the node type at the specified path.
Declaration
public VirtualNodeType GetNodeType(VirtualPath path, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The node's path. |
| bool | followLinks | Whether to follow symbolic links. |
Returns
| Type | Description |
|---|---|
| VirtualNodeType | The VirtualNodeType of the node. |
GetNodes(VirtualNodeTypeFilter, bool, bool)
Gets the nodes in the path tree starting from the current path.
Declaration
public IEnumerable<VirtualNode> GetNodes(VirtualNodeTypeFilter nodeType = VirtualNodeTypeFilter.All, bool recursive = false, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualNodeTypeFilter | nodeType | The node type filter. |
| bool | recursive | Whether to retrieve nodes recursively. |
| bool | followLinks | Whether to follow symbolic links. |
Returns
| Type | Description |
|---|---|
| IEnumerable<VirtualNode> | The nodes in the path tree starting from the current path IEnumerable<T>. |
Remarks
This method may be integrated, reorganized, or deprecated in the near future.
GetNodes(VirtualPath, VirtualNodeTypeFilter, bool, bool)
Gets the nodes in the path tree starting from the specified path.
Declaration
public IEnumerable<VirtualNode> GetNodes(VirtualPath basePath, VirtualNodeTypeFilter nodeType = VirtualNodeTypeFilter.All, bool recursive = false, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | basePath | The base path. |
| VirtualNodeTypeFilter | nodeType | The node type filter. |
| bool | recursive | Whether to retrieve nodes recursively. |
| bool | followLinks | Whether to follow symbolic links. |
Returns
| Type | Description |
|---|---|
| IEnumerable<VirtualNode> | The nodes in the path tree starting from the specified path IEnumerable<T>. |
Remarks
This method may be integrated, reorganized, or deprecated in the near future.
GetPaths(VirtualNodeTypeFilter, bool, bool)
Gets the paths in the path tree starting from the current path.
Declaration
public IEnumerable<VirtualPath> GetPaths(VirtualNodeTypeFilter nodeType = VirtualNodeTypeFilter.All, bool recursive = false, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualNodeTypeFilter | nodeType | The node type filter. |
| bool | recursive | Whether to retrieve paths recursively. |
| bool | followLinks | Whether to follow symbolic links. |
Returns
| Type | Description |
|---|---|
| IEnumerable<VirtualPath> | The paths in the path tree starting from the current path IEnumerable<T>. |
Remarks
This method may be integrated, reorganized, or deprecated in the near future.
GetPaths(VirtualPath, VirtualNodeTypeFilter, bool, bool)
Gets the paths in the path tree starting from the specified path.
Declaration
public IEnumerable<VirtualPath> GetPaths(VirtualPath basePath, VirtualNodeTypeFilter nodeType = VirtualNodeTypeFilter.All, bool recursive = false, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | basePath | The base path. |
| VirtualNodeTypeFilter | nodeType | The node type filter. |
| bool | recursive | Whether to retrieve paths recursively. |
| bool | followLinks | Whether to follow symbolic links. |
Returns
| Type | Description |
|---|---|
| IEnumerable<VirtualPath> | The paths in the path tree starting from the specified path IEnumerable<T>. |
Remarks
This method may be integrated, reorganized, or deprecated in the near future.
GetSymbolicLink(VirtualPath)
Gets the symbolic link at the specified path.
Declaration
public VirtualSymbolicLink GetSymbolicLink(VirtualPath path)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The path of the symbolic link. |
Returns
| Type | Description |
|---|---|
| VirtualSymbolicLink | The VirtualSymbolicLink at the specified path. |
Remarks
This method does not have a followLinks parameter because it retrieves the symbolic link itself.
Exceptions
| Type | Condition |
|---|---|
| VirtualNodeNotFoundException | Thrown if the node cannot be found. |
IsValidWildcardPath(VirtualPath)
Checks if all parts of the given path are valid wildcard patterns.
Declaration
public bool IsValidWildcardPath(VirtualPath path)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The VirtualPath object to validate. |
Returns
| Type | Description |
|---|---|
| bool | True if all parts of the path are valid wildcard patterns; otherwise, false. |
ItemExists(VirtualPath, bool)
Checks if an item exists at the specified path.
Declaration
public bool ItemExists(VirtualPath path, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The item's path. |
| bool | followLinks | Whether to follow symbolic links. |
Returns
| Type | Description |
|---|---|
| bool | True if the item exists; otherwise, false. |
MoveNode(VirtualPath, VirtualPath, bool, bool)
Moves the node at the specified path to a new location.
Declaration
public void MoveNode(VirtualPath sourcePath, VirtualPath destinationPath, bool overwrite = false, bool resolveLinks = true)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | sourcePath | The source path of the node. |
| VirtualPath | destinationPath | The destination path for the node. |
| bool | overwrite | Whether to overwrite existing nodes. |
| bool | resolveLinks | Whether to resolve symbolic links. |
Remarks
resolveLinks indicates whether to resolve links when non-terminal nodes (from the top node to the parent of the terminal node) in the path are symbolic links.
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown if the source and destination paths are the same, if attempting to move the root directory, or if the destination is a subdirectory of the source. |
| VirtualNodeNotFoundException | Thrown if the source node is not found. |
NodeExists(VirtualPath, bool)
Checks if a node exists at the specified path.
Declaration
public bool NodeExists(VirtualPath path, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The node's path. |
| bool | followLinks | Whether to follow symbolic links. |
Returns
| Type | Description |
|---|---|
| bool | True if the node exists; otherwise, false. |
RefreshLinkDictionary(VirtualPath)
Refreshes the link dictionary by updating the target path of the symbolic link at the specified path. If the link is not found in the dictionary, it will be added and the TargetNodeType will be set.
Declaration
public void RefreshLinkDictionary(VirtualPath linkPath)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | linkPath | The path of the symbolic link to be used for updating the link dictionary. |
RemoveLinkByLinkPath(VirtualPath)
Removes the link with the specified link path from the link dictionary.
Declaration
public void RemoveLinkByLinkPath(VirtualPath linkPath)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | linkPath | The link path. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the link path is not an absolute path. |
RemoveLinkFromDictionary(VirtualPath, VirtualPath)
Removes a link from the link dictionary.
Declaration
public void RemoveLinkFromDictionary(VirtualPath targetPath, VirtualPath linkPath)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | targetPath | The target path. |
| VirtualPath | linkPath | The path of the link. |
RemoveNode(VirtualPath, bool, bool, bool)
Removes the node at the specified path.
Declaration
public void RemoveNode(VirtualPath nodePath, bool recursive = false, bool followLinks = false, bool resolveLinks = true)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | nodePath | The path of the node to remove. |
| bool | recursive | Whether to remove recursively. |
| bool | followLinks | Whether to follow symbolic links. |
| bool | resolveLinks | Whether to resolve link targets. |
Remarks
If followLinks is true and the terminal node in the path is a symbolic link, the path tree after resolving the path will be removed, and the symbolic link will also be removed. If false, only the symbolic link itself is removed.
resolveLinks indicates whether to resolve links when non-terminal nodes (from the top node to the parent of the terminal node) in the path are symbolic links.
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown when trying to remove the root node or a non-empty directory. |
ResolveLinkTarget(VirtualPath)
Resolves the target of the symbolic link at the specified path.
Declaration
public VirtualPath ResolveLinkTarget(VirtualPath path)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The path of the symbolic link. |
Returns
| Type | Description |
|---|---|
| VirtualPath | The target path. |
Exceptions
| Type | Condition |
|---|---|
| VirtualNodeNotFoundException | Thrown if the node cannot be found. |
SetLinkTargetNodeType(HashSet<VirtualPath>, VirtualNodeType)
Sets the target node type for all symbolic links in the specified list of link paths.
Declaration
public void SetLinkTargetNodeType(HashSet<VirtualPath> linkPathSet, VirtualNodeType nodeType)
Parameters
| Type | Name | Description |
|---|---|---|
| HashSet<VirtualPath> | linkPathSet | A set of link paths. |
| VirtualNodeType | nodeType | The target node type. |
SetLinkTargetPath(VirtualPath, VirtualPath)
Sets the target path for the specified symbolic link and updates the link dictionary.
Declaration
public void SetLinkTargetPath(VirtualPath linkPath, VirtualPath targetPath)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | linkPath | The path where the symbolic link is set. |
| VirtualPath | targetPath | The target path referenced by the symbolic link. |
SetNode(VirtualPath, VirtualNode)
Sets a node at the specified path.
Declaration
public void SetNode(VirtualPath destinationPath, VirtualNode node)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | destinationPath | The path where the node is set |
| VirtualNode | node | The VirtualNode to set |
SetNodeName(VirtualPath, VirtualNodeName, bool)
Changes the name of a node.
Declaration
public void SetNodeName(VirtualPath nodePath, VirtualNodeName newName, bool resolveLinks = true)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | nodePath | The path of the node to rename |
| VirtualNodeName | newName | The new name |
| bool | resolveLinks | Indicates whether to resolve symbolic links |
SymbolicLinkExists(VirtualPath)
Checks if a symbolic link exists at the specified path.
Declaration
public bool SymbolicLinkExists(VirtualPath path)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The symbolic link's path. |
Returns
| Type | Description |
|---|---|
| bool | True if the symbolic link exists; otherwise, false. |
TryGetDirectory(VirtualPath, bool)
Tries to get the directory at the specified path.
Declaration
public VirtualDirectory? TryGetDirectory(VirtualPath path, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The path of the directory. |
| bool | followLinks | Whether to follow symbolic links. |
Returns
| Type | Description |
|---|---|
| VirtualDirectory | The found VirtualDirectory, or null if not found. |
TryGetItem(VirtualPath, bool)
Tries to get the item at the specified path.
Declaration
public VirtualItem<T>? TryGetItem(VirtualPath path, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The path of the item. |
| bool | followLinks | Whether to follow symbolic links. |
Returns
| Type | Description |
|---|---|
| VirtualItem<T> | The found VirtualItem<T>, or null if not found. |
TryGetNode(VirtualPath, bool)
Tries to get the node at the specified path.
Declaration
public VirtualNode? TryGetNode(VirtualPath path, bool followLinks = false)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The node's path. |
| bool | followLinks | Whether to follow symbolic links. |
Returns
| Type | Description |
|---|---|
| VirtualNode | The found VirtualNode, or null if not found. |
TryGetSymbolicLink(VirtualPath)
Tries to get the symbolic link at the specified path.
Declaration
public VirtualSymbolicLink? TryGetSymbolicLink(VirtualPath path)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The path of the symbolic link. |
Returns
| Type | Description |
|---|---|
| VirtualSymbolicLink | The found VirtualSymbolicLink, or null if not found. |
Remarks
This method does not have a followLinks parameter because it retrieves the symbolic link itself.
TryResolveLinkTarget(VirtualPath)
Tries to resolve the target of the symbolic link at the specified path.
Declaration
public VirtualPath? TryResolveLinkTarget(VirtualPath path)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | path | The path of the symbolic link. |
Returns
| Type | Description |
|---|---|
| VirtualPath | The target path, or null if the node cannot be found. |
UpdateAllTargetNodeTypesInDictionary()
Updates all target node types in the link dictionary.
Declaration
public void UpdateAllTargetNodeTypesInDictionary()
UpdateDirectory(VirtualPath, VirtualDirectory)
Updates a directory.
Declaration
public void UpdateDirectory(VirtualPath directoryPath, VirtualDirectory newDirectory)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | directoryPath | The path of the directory to update |
| VirtualDirectory | newDirectory | The new data for the directory |
UpdateItem(VirtualPath, VirtualItem<T>)
Updates an item.
Declaration
public void UpdateItem(VirtualPath itemPath, VirtualItem<T> newItem)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | itemPath | The path of the item to update |
| VirtualItem<T> | newItem | The new data for the item |
UpdateLinkInDictionary(VirtualPath, VirtualPath)
Updates the target path of a specific symbolic link to a new target path.
Declaration
public void UpdateLinkInDictionary(VirtualPath linkPath, VirtualPath newTargetPath)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | linkPath | The path of the link. |
| VirtualPath | newTargetPath | The new target path. |
UpdateLinksToTarget(VirtualPath, VirtualPath)
Updates the target path of links with a specific target path to a new target path.
Declaration
public void UpdateLinksToTarget(VirtualPath oldTargetPath, VirtualPath newTargetPath)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | oldTargetPath | The old target path. |
| VirtualPath | newTargetPath | The new target path. |
UpdateSymbolicLInk(VirtualPath, VirtualSymbolicLink)
Updates a symbolic link.
Declaration
public void UpdateSymbolicLInk(VirtualPath linkPath, VirtualSymbolicLink newLink)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | linkPath | The path of the symbolic link to update |
| VirtualSymbolicLink | newLink | The new data for the symbolic link |
UpdateTargetNodeTypesInDictionary(VirtualPath)
Updates the target node types in the link dictionary.
Declaration
public void UpdateTargetNodeTypesInDictionary(VirtualPath targetPath)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | targetPath | The target path. |
WalkPathToTarget(VirtualPath, NotifyNodeDelegate?, ActionNodeDelegate?, bool, bool)
Traverses the path to the target node specified by the virtual path.
Declaration
public VirtualNodeContext WalkPathToTarget(VirtualPath targetPath, NotifyNodeDelegate? notifyNode = null, ActionNodeDelegate? actionNode = null, bool followLinks = true, bool exceptionEnabled = true)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | targetPath | The target virtual path |
| NotifyNodeDelegate | notifyNode | A delegate to notify information about the node when each node is reached |
| ActionNodeDelegate | actionNode | A delegate to perform actions when each node is reached |
| bool | followLinks | A flag indicating whether to follow symbolic links |
| bool | exceptionEnabled | A flag indicating whether to enable exceptions. If true, exceptions are thrown; if false, the Node in VirtualNodeContext will be returned as null. |
Returns
| Type | Description |
|---|---|
| VirtualNodeContext | An instance of VirtualNodeContext containing information about the target node |
WalkPathTree(VirtualPath, VirtualNodeTypeFilter, bool, bool, bool)
Traverses the path tree starting from the specified path.
Declaration
public IEnumerable<VirtualNodeContext> WalkPathTree(VirtualPath basePath, VirtualNodeTypeFilter filter = VirtualNodeTypeFilter.All, bool recursive = true, bool followLinks = true, bool resolveLinks = true)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualPath | basePath | The base virtual path |
| VirtualNodeTypeFilter | filter | The filter to apply for node types |
| bool | recursive | A flag indicating whether to traverse recursively |
| bool | followLinks | A flag indicating whether to follow symbolic links |
| bool | resolveLinks | A flag indicating whether to resolve symbolic links |
Returns
| Type | Description |
|---|---|
| IEnumerable<VirtualNodeContext> | An enumerable of VirtualNodeContext containing information about the traversed nodes |
Remarks
followLinks indicates whether to follow links during the recursive traversal process when the terminal node in the virtual path is a symbolic link.
resolveLinks indicates whether to resolve links when nodes other than the terminal node in the virtual path are symbolic links.