Esempio n. 1
0
 /// <summary>
 /// Main constructor.
 /// </summary>
 public ReportEngine(ICompareEngine compareEngine, IProfileManager profileManager)
 {
     _profileManager         = profileManager;
     msNewFile               = compareEngine.NewFile;
     msOldFile               = compareEngine.OldFile;
     mnMinChars              = compareEngine.MinChars;
     mnMinLines              = compareEngine.MinLines;
     mnLimitCharacters       = compareEngine.LimitCharacters;
     mnLimitLines            = compareEngine.LimitLines;
     mnSubLineMatchLimit     = compareEngine.SubLineMatchLimit;
     mbCompleteLines         = compareEngine.CompleteLines;
     mbIdentical             = compareEngine.Identical;
     mcSections              = compareEngine.Sections;
     mdCompleteTaskStartTime = compareEngine.CompleteTaskStartTime;
     moInterrupt             = compareEngine.Interrupt;
     msLogPath               = profileManager.SystemProfile.LogPath;
     msVersion               = profileManager.ApplicationProfile.Version;
     //TODO: I had to use Wordpad.exe instead of Notepad.exe because Notepad.exe doesn't recognise unix \n end-of-line markers while Wordpad.exe does.
     msViewerProgram = profileManager.SystemProfile.ViewerUnix;
 }
Esempio n. 2
0
 internal Presenter(ICompareEngine compareEngine, ICompareViewer compareViewer, IProfileManager profileManager)
 {
     _compareEngine = compareEngine;
     _compareViewer = compareViewer;
     _compareViewer.OnPreviousSelectionSelectedIndexChanged += new PreviousSelectionSelectedIndexChangedHandler(_compareViewer_OnPreviousSelectionSelectedIndexChanged);
     _compareViewer.OnRemovePreviousSelection += new RemovePreviousSelectionHandler(_compareViewer_OnRemovePreviousSelection);
     _compareViewer.OnChooseNewBaseDirectory  += new ChooseNewBaseDirectoryHandler(_compareViewer_OnChooseNewBaseDirectory);
     _compareViewer.OnChooseOldBaseDirectory  += new ChooseOldBaseDirectoryHandler(_compareViewer_OnChooseOldBaseDirectory);
     _compareViewer.OnCopyNewBaseDirectory    += new CopyNewBaseDirectoryHandler(_compareViewer_OnCopyNewBaseDirectory);
     _compareViewer.OnCopyOldBaseDirectory    += new CopyOldBaseDirectoryHandler(_compareViewer_OnCopyOldBaseDirectory);
     _compareViewer.OnChooseNewFile           += new ChooseNewFileHandler(_compareViewer_OnChooseNewFile);
     _compareViewer.OnChooseOldFile           += new ChooseOldFileHandler(_compareViewer_OnChooseOldFile);
     _compareViewer.OnCompareAction           += new CompareActionHandler(_compareViewer_OnCompareAction);
     _compareViewer.OnCompareMeldAction       += new CompareMeldActionHandler(_compareViewer_OnCompareMeldAction);
     _compareViewer.OnCancelAction            += new CancelActionHandler(_compareViewer_OnCancelAction);
     _profileManager          = profileManager;
     _currentActivityProgress = new ProgressLink();
     _overallProgress         = new ProgressLink();
     _compareViewer.EnableControls(true);
     LoadParameters();
     RefreshCombo();
 }
Esempio n. 3
0
 /// <summary>
 /// Main constructor.
 /// </summary>
 public ReportEngineText(ICompareEngine compareEngine, IProfileManager profileManager) : base(compareEngine, profileManager)
 {
 }
Esempio n. 4
0
        void _compareViewer_OnCompareAction(EventArgs e)
        {
            _compareViewer.EnableControls(false);
            _overallProgress = new ProgressLink();
            _compareViewer.OverallProgress         = _overallProgress;
            _currentActivityProgress               = new ProgressLink();
            _compareViewer.CurrentActivityProgress = _currentActivityProgress;
            if (_compareEngine.Interrupt != null)
            {
                _compareEngine.Interrupt.Reason = "OK";
            }

            //Validate all fields.
            int errorCount = ValidateFields();

            if (errorCount > 0)
            {
                return;
            }

            //Save Parameters.
            _profileManager.UserSettings.Select(_currentKey);
            SaveParameters();
            RefreshCombo();

            //Comparison.
            _compareEngine = new CompareEngine();
            _compareEngine.OnBeginSegment   += new CompareEngine.BeginSegmentHandler(_compareEngine_OnBeginSegment);
            _compareEngine.OnUpdateSegment  += new CompareEngine.UpdateSegmentHandler(_compareEngine_OnUpdateSegment);
            _compareEngine.OnEndOfSegment   += new CompareEngine.EndOfSegmentHandler(_compareEngine_OnEndOfSegment);
            _compareEngine.OnBeginCompare   += new CompareEngine.BeginCompareHandler(_compareEngine_OnBeginCompare);
            _compareEngine.OnUpdateCompare  += new CompareEngine.UpdateCompareHandler(_compareEngine_OnUpdateCompare);
            _compareEngine.OnEndOfCompare   += new CompareEngine.EndOfCompareHandler(_compareEngine_OnEndOfCompare);
            _compareEngine.OnBeginReport    += new CompareEngine.BeginReportHandler(_compareEngine_OnBeginReport);
            _compareEngine.OnUpdateReport   += new CompareEngine.UpdateReportHandler(_compareEngine_OnUpdateReport);
            _compareEngine.OnEndOfReport    += new CompareEngine.EndOfReportHandler(_compareEngine_OnEndOfReport);
            _compareEngine.MinChars          = _profileManager.UserSettings.SelectedItem.MinChars;
            _compareEngine.MinLines          = _profileManager.UserSettings.SelectedItem.MinLines;
            _compareEngine.LimitCharacters   = _profileManager.UserSettings.SelectedItem.LimitCharacters;
            _compareEngine.LimitLines        = _profileManager.UserSettings.SelectedItem.LimitLines;
            _compareEngine.SubLineMatchLimit = _profileManager.UserSettings.SelectedItem.SubLineMatchLimit;
            _compareEngine.CompleteLines     = _profileManager.UserSettings.SelectedItem.CompleteLines;
            _compareEngine.Interrupt         = _profileManager.Interrupt;
            try
            {
                _compareEngine.CompareFiles(_profileManager.UserSettings.SelectedItem.NewFile, _profileManager.UserSettings.SelectedItem.OldFile);
                string reportViewer = _profileManager.ProfileCache.Fetch("ReportViewer");
                switch (reportViewer)
                {
                case "ViewerHtml":
                    _reportEngine = new ReportEngineHtml(_compareEngine, _profileManager);
                    _reportEngine.OnBeginReport  += new ReportEngine.BeginReportHandler(_reportEngine_OnBeginReport);
                    _reportEngine.OnUpdateReport += new ReportEngine.UpdateReportHandler(_reportEngine_OnUpdateReport);
                    _reportEngine.OnEndOfReport  += new ReportEngine.EndOfReportHandler(_reportEngine_OnEndOfReport);
                    _reportEngine.Report();
                    View(_profileManager.ProfileCache.Fetch("ViewerHtml"), _profileManager.ProfileCache.Fetch("HtmlOutputFile"));
                    break;

                case "ViewerUnix":
                    _reportEngine = new ReportEngineText(_compareEngine, _profileManager);
                    _reportEngine.OnBeginReport  += new ReportEngine.BeginReportHandler(_reportEngine_OnBeginReport);
                    _reportEngine.OnUpdateReport += new ReportEngine.UpdateReportHandler(_reportEngine_OnUpdateReport);
                    _reportEngine.OnEndOfReport  += new ReportEngine.EndOfReportHandler(_reportEngine_OnEndOfReport);
                    _reportEngine.Report();
                    break;

                case "Both":
                    _reportEngine = new ReportEngineText(_compareEngine, _profileManager);
                    _reportEngine.OnBeginReport  += new ReportEngine.BeginReportHandler(_reportEngine_OnBeginReport);
                    _reportEngine.OnUpdateReport += new ReportEngine.UpdateReportHandler(_reportEngine_OnUpdateReport);
                    _reportEngine.OnEndOfReport  += new ReportEngine.EndOfReportHandler(_reportEngine_OnEndOfReport);
                    _reportEngine.Report();
                    _reportEngine = new ReportEngineHtml(_compareEngine, _profileManager);
                    _reportEngine.OnBeginReport  += new ReportEngine.BeginReportHandler(_reportEngine_OnBeginReport);
                    _reportEngine.OnUpdateReport += new ReportEngine.UpdateReportHandler(_reportEngine_OnUpdateReport);
                    _reportEngine.OnEndOfReport  += new ReportEngine.EndOfReportHandler(_reportEngine_OnEndOfReport);
                    _reportEngine.Report();
                    View(_profileManager.ProfileCache.Fetch("ViewerHtml"), _profileManager.ProfileCache.Fetch("HtmlOutputFile"));
                    break;

                default:
                    _reportEngine = new ReportEngineText(_compareEngine, _profileManager);
                    _reportEngine.OnBeginReport  += new ReportEngine.BeginReportHandler(_reportEngine_OnBeginReport);
                    _reportEngine.OnUpdateReport += new ReportEngine.UpdateReportHandler(_reportEngine_OnUpdateReport);
                    _reportEngine.OnEndOfReport  += new ReportEngine.EndOfReportHandler(_reportEngine_OnEndOfReport);
                    _reportEngine.Report();
                    break;
                }
            }
            catch (ParameterException pe)
            {
                _compareViewer.SetFieldError(pe.Parameter, pe.Message);
                //_compareViewer.DisplayMessageBox(ae.Message, _compareViewer.Caption, MsgButtons.OK, MsgIcon.Error);
            }
            finally
            {
                _compareViewer.EnableControls(true);
            }
        }