示例#1
0
 private H5NamedReference GetObjectReference(LinkMessage linkMessage, H5LinkAccess linkAccess)
 {
     return(linkMessage.LinkInfo switch
     {
         HardLinkInfo hard => new H5NamedReference(linkMessage.LinkName, hard.HeaderAddress, this.File),
         SoftLinkInfo soft => new H5SymbolicLink(linkMessage, this).GetTarget(linkAccess),
         ExternalLinkInfo external => new H5SymbolicLink(linkMessage, this).GetTarget(linkAccess),
         _ => throw new Exception($"Unknown link type '{linkMessage.LinkType}'.")
     });
        internal H5SymbolicLink(LinkMessage linkMessage, H5Group parent)
        {
            this.Name = linkMessage.LinkName;

            (this.Value, this.ObjectPath) = linkMessage.LinkInfo switch
            {
                SoftLinkInfo softLink => (softLink.Value, null),
                ExternalLinkInfo externalLink => (externalLink.FilePath, externalLink.FullObjectPath),
                _ => throw new Exception($"The link info type '{linkMessage.LinkInfo.GetType().Name}' is not supported.")
            };

            this.Parent = parent;
        }