示例#1
0
        public Node GetNode()
        {
            if (!this.IsConnected)
            {
                return(null);
            }

            if (string.IsNullOrEmpty(this._pathSet.Share))
            {
                // Requested Server
                return(NodeFactory.Get(
                           this._pathSet.FullPath,
                           NodeType.Server,
                           this._paramSet
                           ));
            }

            // Requested Share, or Sub Node on Share

            using (var share = ShareFactory.Get(this._client, this._pathSet.Share))
            {
                if (!share.IsConnected)
                {
                    this.AddError("GetNode", $"Share Not Found: {this._pathSet.Share}");

                    return(null);
                }

                Node result;
                if (this._pathSet.Elements.Length <= 0)
                {
                    // Requested Share
                    result = NodeFactory.Get(
                        this._pathSet.FullPath,
                        NodeType.Folder,
                        this._paramSet
                        );
                }
                else
                {
                    // Requested Sub Node on Share;
                    result = share.GetNode(this._pathSet, this._paramSet);
                    if (result == null)
                    {
                        this.CopyErrors(share);

                        return(null);
                    }
                }

                return(result);
            }
        }
示例#2
0
 public IShare GetShare()
 {
     return(ShareFactory.Get(this._client, this._pathSet.Share));
 }