Пример #1
0
		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;
		}
Пример #2
0
		private bool GetResponse()
		{
			object[] errors = null;
			try
			{
				m_response = CallContentScanner();
                ResponseAnalyser.CollectAndSendEvents(m_response, ResponseAnalyser.EventType.PolicySet);

				if (m_response == null)
				{
					Logger.LogError("RequestManager.GetResponse(): ContentScanner returned null");
					m_processResult = ProcessResult.ERROR_SCAN_FAILURE;// Indicate total scanning failure.
					return false;
				}

				m_uiResponse = ResponseAdapter.UIResponseFromResponse(m_request, m_response);

				errors = m_uiResponse.GetErrors();
				if (errors.Length == 0)
				{
					return true;
				}
			}
			catch (Exception ex)
			{
				Logger.LogError(ex);
			}

			RecordDiscoveryErrors(errors);
			return false;
		}