コード例 #1
0
		private void AddMetadataObserver(NotifierVisitor notifierVisitor)
		{
			m_wordDocumentVisitor = new WordDocumentVisitor();
			notifierVisitor.Add(m_wordDocumentVisitor);
		}
コード例 #2
0
		private void AddContentAnalysisObserver(NotifierVisitor notifierVisitor)
		{
			if (!Workshare.Interop.Options.OptionApi.GetBool("EnableContentDiscovery"))
				return;

			PolicyLoader policyLoader = new PolicyLoader();
			WsScanRules scanRules = policyLoader.LoadScanRulesFromPolicy();
			m_contentAnalysisVisitor = new ContentAnalysisVisitor(scanRules);
			notifierVisitor.Add(m_contentAnalysisVisitor);
		}
コード例 #3
0
		public void Execute(System.Object document, System.Object metadataElements)
		{
			if(typeof(string) != document.GetType())
				throw new ArgumentException("The first parameter should be of type string.", "document");

			string filename = (string)document;
			if(false == System.IO.File.Exists(filename))
				throw new ArgumentException(string.Format("The file [{0}] does not exist.", filename));

			NotifierVisitor notifierVisitor = new NotifierVisitor();
			AddMetadataObserver(notifierVisitor);
			AddContentAnalysisObserver(notifierVisitor);

			using(DocumentReader reader = DocumentReaderFactory.Create(filename))
			{
				reader.Read(notifierVisitor);
			}

			ProcessMetadata(metadataElements);
			ProcessContentAnalysisResults();
		}