public static GetNode ( string path ) : Node | ||
path | string | |
Résultat | Node |
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); }
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(); } }