GetNode() 공개 정적인 메소드

public static GetNode ( string path ) : Node
path string
리턴 Node
예제 #1
0
        public void ProcessRespondDirListingMessage(Network network, Node messageFrom, SharedDirectoryInfo info)
        {
            string fullPath = PathUtil.Join(messageFrom.Directory.FullPath, info.FullPath);

            var node = PathUtil.GetNode(fullPath);

            if (node != messageFrom)
            {
                throw new Exception("Directory was for a different node");
            }

            RemoteDirectory remoteDirectory = GetOrCreateRemoteDirectory(fullPath);

            remoteDirectory.UpdateFromInfo(info);

            lock (remoteDirectoryCallbacks)
            {
                if (remoteDirectoryCallbacks.ContainsKey(fullPath))
                {
                    foreach (var callback in remoteDirectoryCallbacks[fullPath])
                    {
                        callback(remoteDirectory);
                    }
                    remoteDirectoryCallbacks.Remove(fullPath);
                }
            }

            network.RaiseReceivedDirListing(messageFrom, remoteDirectory);
        }
예제 #2
0
        public void ProcessFileDetailsMessage(Network network, Node messageFrom, SharedFileListing info)
        {
            string fullPath = PathUtil.Join(messageFrom.Directory.FullPath, info.FullPath);

            var node = PathUtil.GetNode(fullPath);

            if (node != messageFrom)
            {
                throw new Exception("Directory was for a different node");
            }

            bool       created    = false;
            RemoteFile remoteFile = GetOrCreateRemoteFile(fullPath, info, out created);

            if (!created)
            {
                remoteFile.UpdateFromInfo(info);
            }

            lock (remoteFileCallbacks)
            {
                if (remoteFileCallbacks.ContainsKey(fullPath))
                {
                    foreach (var callback in remoteFileCallbacks[fullPath])
                    {
                        callback(remoteFile);
                    }
                }
                remoteFileCallbacks.Remove(fullPath);
            }

            network.RaiseReceivedFileDetails(remoteFile);

            // FIXME: Get rid of all this, just listen for above network.ReceivedFileDetails event!
            var transfer = this.fileTransferManager.Transfers.SingleOrDefault(t => t.File == remoteFile);

            if (transfer != null && transfer.Status == FileTransferStatus.WaitingForInfo)
            {
                ((IFileTransferInternal)transfer).DetailsReceived();
            }
        }