/// <summary> /// Gets the hash of an object on the server using the currently selected hash algorithm. /// </summary> public async Task <FtpHash> HashCommandInternalAsync(string path, CancellationToken token = default(CancellationToken)) { FtpReply reply; if (!(reply = await ExecuteAsync("HASH " + path, token)).Success) { throw new FtpCommandException(reply); } // parse hash from the server reply return(HashParser.Parse(reply.Message)); }
public static HashAlgorithms GetHashAlgorithm(this Membership membership) { if (string.IsNullOrEmpty(membership.HashAlgorithm)) { return(Core.Constants.Defaults.DEFAULT_HASH_ALGORITHM); } if (!HashParser.TryParseHashAlgorithm(membership.HashAlgorithm, out var algorithm, out _, out _)) { algorithm = Core.Constants.Defaults.DEFAULT_HASH_ALGORITHM; Console.WriteLine($"Membership hash algorithm could not parsed! ('{membership.HashAlgorithm}')"); } return(algorithm); }
/// <summary> /// Gets the hash of an object on the server using the currently selected hash algorithm. /// </summary> internal FtpHash HashCommandInternal(string path) { FtpReply reply; #if !CORE14 lock (m_lock) { #endif if (!(reply = Execute("HASH " + path)).Success) { throw new FtpCommandException(reply); } #if !CORE14 } #endif // parse hash from the server reply return(HashParser.Parse(reply.Message)); }