/// <summary>
 /// Calls into helper functions to add different rows for a resultant files set
 /// </summary>
 /// <param name="files"></param>
 private void UpdateResultsTable(ResultantFiles files)
 {
     ResultFiles.Rows.Add(CreateHeaderRow(files._modifiedFile));
     ResultFiles.Rows.Add(CreateModifiedFileRow(files._modifiedFile, files._modifiedFileSizeInKB));
     ResultFiles.Rows.Add(CreateOutputFileRow(files._outputFile, files._outputFileSizeInKB));
     ResultFiles.Rows.Add(CreateSummaryRow(files._summaryFile, files._summaryFileSizeInKB));
 }
        // Results are shown in an ASP Table, which is dynamically populated based on the number
        // of modified files provided. For each set of result files, which includes the modified file itself,
        // output file (.rtf/.wdf etc) and summary file (.xml), a separate row is created in the table.

        /// <summary>
        /// Prepares and stores the result objects for use by HandleFinalResults, based on output format
        /// selected by user, e.g. .rtf or .wdf etc.
        /// </summary>
        /// <param name="results"></param>
        /// <param name="responseOptions"></param>
        /// <param name="modifiedFileVirtualPath"></param>
        /// <param name="modifiedFileSizeInKB"></param>
        private void HandleIntermediateResults(CompareResults results, ResponseOptions responseOptions, string modifiedFileVirtualPath, double modifiedFileSizeInKB)
        {
            string outputFileVirtualPath  = string.Empty;
            string summaryFileVirtualPath = string.Empty;

            double outputFileSizeInKB  = 0;
            double summaryFileSizeInKB = 0;

            if (results.Redline != null)
            {
                outputFileVirtualPath = Path.GetDirectoryName(modifiedFileVirtualPath);
                outputFileSizeInKB    = (double)results.Redline.Length / 1024;
                switch (responseOptions)
                {
                case ResponseOptions.Rtf:
                case ResponseOptions.RtfWithSummary:
                    outputFileVirtualPath = Path.Combine(outputFileVirtualPath, "redline.rtf");
                    break;

                case ResponseOptions.Wdf:
                case ResponseOptions.WdfWithSummary:
                    outputFileVirtualPath = Path.Combine(outputFileVirtualPath, "redline.wdf");
                    break;

                case ResponseOptions.Doc:
                case ResponseOptions.DocWithSummary:
                    outputFileVirtualPath = Path.Combine(outputFileVirtualPath, "redline.doc");
                    break;

                case ResponseOptions.DocX:
                case ResponseOptions.DocXWithSummary:
                    outputFileVirtualPath = Path.Combine(outputFileVirtualPath, "redline.docx");
                    break;

                case ResponseOptions.Pdf:
                case ResponseOptions.PdfWithSummary:
                    outputFileVirtualPath = Path.Combine(outputFileVirtualPath, "redline.pdf");
                    break;
                }

                string filePhysicalPath = Server.MapPath(outputFileVirtualPath);
                if (File.Exists(filePhysicalPath))
                {
                    File.Delete(filePhysicalPath);
                }

                File.WriteAllBytes(filePhysicalPath, results.Redline);
            }

            if ((responseOptions & ResponseOptions.Xml) == ResponseOptions.Xml)
            {
                if (results.ChangeSummary != null)
                {
                    summaryFileVirtualPath = Path.GetDirectoryName(modifiedFileVirtualPath);
                    summaryFileVirtualPath = Path.Combine(summaryFileVirtualPath, "redline.xml");
                    summaryFileSizeInKB    = (double)results.ChangeSummary.Length / 1024;

                    string filePhysicalPath = Server.MapPath(summaryFileVirtualPath);
                    if (File.Exists(filePhysicalPath))
                    {
                        File.Delete(filePhysicalPath);
                    }

                    File.WriteAllText(filePhysicalPath, results.ChangeSummary);
                }
            }

            modifiedFileVirtualPath = Server.HtmlEncode(modifiedFileVirtualPath);
            outputFileVirtualPath   = Server.HtmlEncode(outputFileVirtualPath);
            summaryFileVirtualPath  = Server.HtmlEncode(summaryFileVirtualPath);

            ResultantFiles resultantFiles = new ResultantFiles(modifiedFileVirtualPath, outputFileVirtualPath, summaryFileVirtualPath,
                                                               modifiedFileSizeInKB, outputFileSizeInKB, summaryFileSizeInKB);

            _resultantFiles.Add(resultantFiles);
        }