Exemple #1
0
        // Token: 0x06000940 RID: 2368 RVA: 0x0004B800 File Offset: 0x00049A00
        public IEnumerable <INode> GetNodes()
        {
            this.EnsureLoggedIn();
            GetNodesRequest request = new GetNodesRequest(null);

            Node[] nodes = this.Request <GetNodesResponse>(request, this.masterKey).Nodes;
            if (this.trashNode == null)
            {
                this.trashNode = nodes.First((Node n) => n.Type == NodeType.Trash);
            }
            return(nodes.Distinct <Node>().OfType <INode>());
        }
        /// <summary>
        /// Retrieve all filesystem nodes
        /// </summary>
        /// <returns>Flat representation of all the filesystem nodes</returns>
        /// <exception cref="NotSupportedException">Not logged in</exception>
        /// <exception cref="ApiException">Mega.co.nz service reports an error</exception>
        public IEnumerable <INode> GetNodes()
        {
            this.EnsureLoggedIn();

            GetNodesRequest  request  = new GetNodesRequest();
            GetNodesResponse response = this.Request <GetNodesResponse>(request, this._masterKey);

            Node[] nodes = response.Nodes;
            if (this._trashNode == null)
            {
                this._trashNode = nodes.First(n => n.Type == NodeType.Trash);
            }

            return(nodes.Distinct().Cast <INode>());
        }
Exemple #3
0
        // Token: 0x0600094A RID: 2378 RVA: 0x0004BD1C File Offset: 0x00049F1C
        public IEnumerable <INode> GetNodesFromLink(Uri uri)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }
            this.EnsureLoggedIn();
            string shareId;

            byte[] array;
            byte[] array2;
            byte[] key;
            this.GetPartsFromUri(uri, out shareId, out array, out array2, out key);
            GetNodesRequest request = new GetNodesRequest(shareId);

            return((from x in this.Request <GetNodesResponse>(request, key).Nodes
                    select new PublicNode(x, shareId)).OfType <INode>());
        }
Exemple #4
0
        /// <summary>
        /// Retrieve list of nodes from a specified Uri
        /// </summary>
        /// <param name="uri">Uri</param>
        /// <exception cref="NotSupportedException">Not logged in</exception>
        /// <exception cref="ApiException">Mega.co.nz service reports an error</exception>
        /// <exception cref="ArgumentNullException">uri is null</exception>
        /// <exception cref="ArgumentException">Uri is not valid (id and key are required)</exception>
        public IEnumerable <INode> GetNodesFromLink(Uri uri)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            this.EnsureLoggedIn();

            string shareId;

            byte[] iv, metaMac, key;
            this.GetPartsFromUri(uri, out shareId, out iv, out metaMac, out key);

            // Retrieve attributes
            GetNodesRequest  getNodesRequest  = new GetNodesRequest(shareId);
            GetNodesResponse getNodesResponse = this.Request <GetNodesResponse>(getNodesRequest, key);

            return(getNodesResponse.Nodes.Select(x => new PublicNode(x, shareId)).OfType <INode>());
        }