コード例 #1
0
        /// <summary>
        /// Exports the conversation at <paramref name="inputFilePath"/> as JSON to <paramref name="outputFilePath"/>.
        /// </summary>
        /// <param name="inputFilePath">
        /// The input file path.
        /// </param>
        /// <param name="outputFilePath">
        /// The output file path.
        /// </param>
        /// <param name="userName">
        /// The username to filter.
        /// </param>
        /// <param name="encryptUserNames">
        /// Boolean flag indicating whether to encrypt usernames or not.
        /// </param>
        /// <param name="hideNumbers">
        /// Boolean flag indicating whether to hide numbers or not.
        /// </param>
        /// <exception cref="ArgumentException">
        /// Thrown when a path is invalid.
        /// </exception>
        /// <exception cref="Exception">
        /// Thrown when something bad happens.
        /// </exception>
        public void ExportConversation(
            string inputFilePath,
            string outputFilePath,
            string userName,
            string keyword,
            string blacklist,
            bool encryptUserNames,
            bool hideNumbers)
        {
            Conversation conversation = this.ReadConversation(inputFilePath, userName, keyword, blacklist);

            if (hideNumbers)
            {
                ContentParser.HideNumbersFromConvesation(conversation);
            }

            if (encryptUserNames)
            {
                UserNameEncryption.EncryptUserNames(conversation);
            }

            Activity.SetUserActivityInConversation(conversation);

            this.WriteConversation(conversation, outputFilePath);

            Console.WriteLine("Conversation exported from '{0}' to '{1}'", inputFilePath, outputFilePath);
        }