private void PrepareProtectSimpleResponse(string profileLocation) { InitializeEngine(); AddProtectSimpleProfile(profileLocation); // A profile is a policy, but we chose to call it a Profile :) if (m_encryptionManager == null) { m_encryptionManager = new ContentEncryptionManager(_msgExpander, _msgPacker); } if (m_encryptionUi != null) { m_encryptionUi.OnShowDialog += new ShowDialogEvent(m_encryptionUi_OnShowDialog); } if (!m_encryptionManager.DecryptRequestAttachments(m_request, m_encryptionUi)) { if (!string.IsNullOrEmpty(m_encryptionManager.LastErrorText)) { m_errors.Add(ErrorAsDialogTextKey + m_encryptionManager.LastErrorText);// prepend ErrorAsDialogTextKey constant so that we DO display the message to the user m_encryptionManager.LastErrorText = string.Empty; m_processResult = ProcessResult.ERRORS; m_bUpdateProcessResult = false; } else { m_processResult = ProcessResult.CANCELLED; } return; } m_response = CallContentScanner(); ResponseAnalyser.CollectAndSendEvents(m_response, ResponseAnalyser.EventType.PolicySet); m_uiResponse = ResponseAdapter.UIResponseFromResponse(m_request, m_response); // hey, you know what - something might have gone wrong in that content scanning. Let's check object[] errors = m_uiResponse.GetErrors(); if (errors.Length > 0) { // wow! something bad did happen. Better report it back to the user RecordDiscoveryErrors(errors); return; } string reason = string.Empty; if (!m_uiResponse.Synchronize(out reason)) { Logger.LogError("Unable to synchronize responses. Reason = " + reason); m_processResult = ClientManager.ProcessResult.ERRORS; return; } // Check for violations if (m_uiResponse != null && !m_uiResponse.ContainsViolations()) { m_processResult = ProcessResult.NO_VIOLATIONS; return; } // Check for Actions in uiResponse if (m_uiResponse != null && m_uiResponse.Actions.Count <= 0) { m_processResult = ProcessResult.NO_ACTIONS; return; } m_processResult = ProcessResult.UNDEFINED; CreateOfficeApplicationsUsingUroAttachments(); return; }
private bool ProcessPrematureResponse() { // Means scanning has not completed yet, and the user has pressed Send // We gonna scrap discovery stuff, and apply pre-set actions m_threadKiller.Abort(); m_skipDiscovery = true; InitializeEngine(); if (m_encryptionManager == null) { m_encryptionManager = new ContentEncryptionManager(_msgExpander, _msgPacker); } if (!m_encryptionManager.DecryptRequestAttachments(m_request, m_encryptionUi)) { m_processResult = ProcessResult.CANCELLED; return false; } m_response = CallContentScanner(); m_uiResponse = ResponseAdapter.UIResponseFromResponse(m_request, m_response); m_policyClientDialog.SetResponse(m_uiResponse); // Check for violations if (m_uiResponse != null && !m_uiResponse.ContainsViolations()) { m_processResult = ProcessResult.NO_VIOLATIONS; return false; } // Check for Actions in uiResponse if (m_uiResponse != null && m_uiResponse.Actions.Count <= 0) { m_processResult = ProcessResult.NO_ACTIONS; return false; } m_processResult = ProcessResult.UNDEFINED; CreateOfficeApplicationsUsingUroAttachments(); return true; }