public async Task CreatePeerDirectoryIfNotExist(IPeer peer) { if (this._ftpClient.GetShortDirectoryList().Any(dirName => dirName == peer.EscapePeerAddress())) { return; } this._ftpClient.MakeDir(peer.EscapePeerAddress()); var createQueueDirectoryTask = Task.Factory.StartNew(() => this._ftpClient.MakeDir(peer.QueueLocation())); var createSentDirectoryTask = Task.Factory.StartNew(() => this._ftpClient.MakeDir(peer.SentLocation())); await createQueueDirectoryTask; await createSentDirectoryTask; }
/// <summary> /// Create a path to sent queue for the given <paramref name="peer"/>. /// </summary> /// <param name="peer">The instance of <see cref="IPeer"/>.</param> /// <returns>A path to sent queue for the given peer.</returns> public static string SentLocation(this IPeer peer) { var messageLocation = string.Format( CultureInfo.InvariantCulture, "/{0}/sent/", peer.EscapePeerAddress()); return(messageLocation); }
/// <summary> /// Create a path to queue for the given <paramref name="peer"/> and <paramref name="messageQueuedTime"/>. /// </summary> /// <param name="peer">The peer to build the path for.</param> /// <param name="messageQueuedTime">The message file time to build a path for.</param> /// <returns>A path to queue for the given <paramref name="peer"/> and <paramref name="messageQueuedTime"/>.</returns> public static string MessageLocation(IPeer peer, DateTime messageQueuedTime) { var messageLocation = string.Format( CultureInfo.InvariantCulture, "/{0}/queue/{1}", peer.EscapePeerAddress(), messageQueuedTime.ToFileTimeUtc()); return(messageLocation); }
/// <summary> /// Create a path to queue for the given <paramref name="peer"/> and <paramref name="messageQueuedTime"/>. /// </summary> /// <param name="peer">The peer to build the path for.</param> /// <param name="messageQueuedTime">The message file time to build a path for.</param> /// <returns>A path to queue for the given <paramref name="peer"/> and <paramref name="messageQueuedTime"/>.</returns> public static string MessageLocation(IPeer peer, DateTime messageQueuedTime) { var messageLocation = string.Format( CultureInfo.InvariantCulture, "/{0}/queue/{1}", peer.EscapePeerAddress(), messageQueuedTime.ToFileTimeUtc()); return messageLocation; }