<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System.Net.FtpClient.Extensions {
    /// <summary>
    /// Retrieve checksum of file on the server
    /// </summary>
    public static class ChecksumExtension {
        delegate FtpHash AsyncGetChecksum(string path);
        static Dictionary<IAsyncResult, AsyncGetChecksum> m_asyncmethods = new Dictionary<IAsyncResult, AsyncGetChecksum>();

        /// <summary>
        /// Retrieves a checksum of the given file using a checksumming method
        /// that the server supports, if any. The algorithm used goes in this order:
        /// 1. HASH command; server preferred algorithm. See FtpClient.SetHashAlgorithm()
        /// 2. MD5 / XMD5 commands
        /// 3. XSHA1 command
        /// 4. XSHA256 command
        /// 5. XSHA512 command
        /// 6. XCRC command
        /// </summary>
        /// <param name="client">FtpClient Object</param>
        /// <param name="path">Full or relative path of the file to checksum</param>
        /// <returns>FtpHash object containing the value and algorithm. Use the IsValid property to
        /// determine if this command was successfull. FtpCommandException's can be thrown from
        /// the underlying calls.</returns>
        public static FtpHash GetChecksum(this FtpClient client, string path) {
            if (client.Capabilities.HasFlag(FtpCapability.HASH)) {
                return client.GetHash(path);<commit_msg>Added code example link in XML doc for GetChecksum() so that example will be included in CHM when it's built.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System.Net.FtpClient.Extensions {
    /// <summary>
    /// Retrieve checksum of file on the server
    /// </summary>
    public static class ChecksumExtension {
        delegate FtpHash AsyncGetChecksum(string path);
        static Dictionary<IAsyncResult, AsyncGetChecksum> m_asyncmethods = new Dictionary<IAsyncResult, AsyncGetChecksum>();

        /// <summary>
        /// Retrieves a checksum of the given file using a checksumming method
        /// that the server supports, if any. The algorithm used goes in this order:
        /// 1. HASH command; server preferred algorithm. See FtpClient.SetHashAlgorithm()
        /// 2. MD5 / XMD5 commands
        /// 3. XSHA1 command
        /// 4. XSHA256 command
        /// 5. XSHA512 command
        /// 6. XCRC command
        /// </summary>
        /// <param name="client">FtpClient Object</param>
        /// <param name="path">Full or relative path of the file to checksum</param>
        /// <returns>FtpHash object containing the value and algorithm. Use the IsValid property to
        /// determine if this command was successfull. FtpCommandException's can be thrown from
        /// the underlying calls.</returns>
        /// <example><code source="..\Examples\GetChecksum.cs" lang="cs" /></example>
        public static FtpHash GetChecksum(this FtpClient client, string path) {
            if (client.Capabilities.HasFlag(FtpCapability.HASH)) {
                return client.GetHash(path);
{'fraction_non_alphanumeric': 0.1026448362720403, 'fraction_numerical': 0.009445843828715366, 'mean_word_length': 2.506622516556291, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1361181', 'n_tokens_mistral': 848, 'n_tokens_neox': 835, 'n_words': 292}