VirtualStorageLibrary
Search Results for

    Show / Hide Table of Contents

    Class VirtualSymbolicLink

    Represents a virtual symbolic link. A virtual symbolic link provides a virtual reference to other nodes (directories, items, or other symbolic links). This class represents symbolic links within the virtual storage library and manages paths to other nodes.

    The virtual symbolic link supports the concept of NULL links. When the TargetPath is null, the link resolution is not performed during path traversal. This feature can be useful when the target is undefined or dynamically determined.

    Inheritance
    object
    VirtualNode
    VirtualSymbolicLink
    Implements
    IVirtualDeepCloneable<VirtualNode>
    Inherited Members
    VirtualNode.Name
    VirtualNode.CreatedDate
    VirtualNode.UpdatedDate
    VirtualNode.VID
    VirtualNode.IsReferencedInStorage
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: AkiraNetwork.VirtualStorageLibrary
    Assembly: VirtualStorageLibrary.dll
    Syntax
    public class VirtualSymbolicLink : VirtualNode, IVirtualDeepCloneable<VirtualNode>

    Constructors

    VirtualSymbolicLink()

    Initializes a new instance of the VirtualSymbolicLink class. The node name is automatically generated using the VirtualNodeName.GenerateNodeName method.

    Declaration
    public VirtualSymbolicLink()

    VirtualSymbolicLink(VirtualNodeName)

    Initializes a new instance of the VirtualSymbolicLink class with the specified name.

    Declaration
    public VirtualSymbolicLink(VirtualNodeName name)
    Parameters
    Type Name Description
    VirtualNodeName name

    The name of the symbolic link.

    VirtualSymbolicLink(VirtualNodeName, VirtualPath?)

    Initializes a new instance of the VirtualSymbolicLink class with the specified name and target path.

    Declaration
    public VirtualSymbolicLink(VirtualNodeName name, VirtualPath? targetPath)
    Parameters
    Type Name Description
    VirtualNodeName name

    The name of the symbolic link.

    VirtualPath targetPath

    The target path of the symbolic link.

    VirtualSymbolicLink(VirtualNodeName, VirtualPath?, DateTime)

    Initializes a new instance of the VirtualSymbolicLink class with the specified name, target path, creation date, and update date.

    Declaration
    public VirtualSymbolicLink(VirtualNodeName name, VirtualPath? targetPath, DateTime createdDate)
    Parameters
    Type Name Description
    VirtualNodeName name

    The name of the symbolic link.

    VirtualPath targetPath

    The target path of the symbolic link.

    DateTime createdDate

    The creation date.

    VirtualSymbolicLink(VirtualNodeName, VirtualPath?, DateTime, DateTime)

    Initializes a new instance of the VirtualSymbolicLink class with the specified name, target path, creation date, and update date.

    Declaration
    public VirtualSymbolicLink(VirtualNodeName name, VirtualPath? targetPath, DateTime createdDate, DateTime updatedDate)
    Parameters
    Type Name Description
    VirtualNodeName name

    The name of the symbolic link.

    VirtualPath targetPath

    The target path of the symbolic link.

    DateTime createdDate

    The creation date.

    DateTime updatedDate

    The update date.

    Properties

    NodeType

    Gets the type of the node. This class always returns SymbolicLink.

    Declaration
    public override VirtualNodeType NodeType { get; }
    Property Value
    Type Description
    VirtualNodeType
    Overrides
    VirtualNode.NodeType

    TargetNodeType

    Gets or sets the type of the target node of the symbolic link.

    Declaration
    public VirtualNodeType TargetNodeType { get; set; }
    Property Value
    Type Description
    VirtualNodeType

    TargetPath

    Gets or sets the target path of the symbolic link.

    Declaration
    public VirtualPath? TargetPath { get; }
    Property Value
    Type Description
    VirtualPath

    Methods

    DeepClone(bool)

    Creates a deep clone of the symbolic link.

    Declaration
    public override VirtualNode DeepClone(bool recursive = false)
    Parameters
    Type Name Description
    bool recursive

    If true, all links are recursively cloned.

    Returns
    Type Description
    VirtualNode

    A deep clone of the symbolic link.

    Overrides
    VirtualNode.DeepClone(bool)

    ToString()

    Returns a string representation of the symbolic link.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string representation of the symbolic link.

    Overrides
    object.ToString()

    Update(VirtualNode)

    Updates the current symbolic link with the data from the specified node.

    Declaration
    public override void Update(VirtualNode node)
    Parameters
    Type Name Description
    VirtualNode node

    The node to use for the update.

    Overrides
    VirtualNode.Update(VirtualNode)
    Remarks

    After updating an instance of VirtualSymbolicLink that has been added to VirtualStorage, call the RefreshLinkDictionary method of the VirtualStorage class to update the link dictionary. However, this is not necessary if the symbolic link is updated using the SetNode method of the VirtualStorage class.

    VirtualStorage<UserType> vs = new();
    
    vs.AddDirectory("/dir1");
    vs.AddItem("/dir1/item1");
    vs.AddDirectory("/dir2");
    vs.AddItem("/dir2/item1");
    vs.AddSymbolicLink("/link1", "/dir1/item1");
    
    VirtualSymbolicLink link = vs.GetSymbolicLink("/link1");
    VirtualSymbolicLink newLink = new("/link1", "/dir2/item1");
    
    link.Update(newLink);
    vs.RefreshLinkDictionary("/link1");
    Exceptions
    Type Condition
    ArgumentException

    Thrown if the specified node is not a VirtualSymbolicLink.

    Operators

    implicit operator VirtualSymbolicLink(VirtualPath?)

    Performs an implicit conversion from VirtualPath to VirtualSymbolicLink. The node name is automatically generated using the VirtualNodeName.GenerateNodeName method.

    Declaration
    public static implicit operator VirtualSymbolicLink(VirtualPath? targetPath)
    Parameters
    Type Name Description
    VirtualPath targetPath

    The target path to convert.

    Returns
    Type Description
    VirtualSymbolicLink

    implicit operator VirtualSymbolicLink((VirtualNodeName nodeName, VirtualPath? targetPath))

    Performs an implicit conversion from a tuple to VirtualSymbolicLink.

    Declaration
    public static implicit operator VirtualSymbolicLink((VirtualNodeName nodeName, VirtualPath? targetPath) tuple)
    Parameters
    Type Name Description
    (VirtualNodeName nodeName, VirtualPath targetPath) tuple

    The tuple to convert.

    Returns
    Type Description
    VirtualSymbolicLink

    Implements

    IVirtualDeepCloneable<T>

    Extension Methods

    VirtualNodeExtensions.ResolveNodeType(VirtualNode)
    VirtualTextFormatter.GenerateSingleTableDebugText<T>(T)
    In this article
    Back to top Generated by DocFX