Esempio n. 1
0
        /// <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));
        }
Esempio n. 2
0
        /// <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));
        }