private void DoAPIClean()
		{
			Stopwatch watch = new Stopwatch();
			watch.Start();
		   
			ActionDataImpl testData = new ActionDataImpl(m_sFileForApiCleanIn);

			CleanUserAction cleaner = new CleanUserAction();
			ActionPropertySet cleanProperties = new ActionPropertySet(new CleanActionPropertySet());
			cleanProperties.SystemProperties.Add("FileType", new ActProp() { Value = ".doc" });
					
			testData.Properties.Add("DisplayName", Guid.NewGuid().ToString() + m_sFileExtension);
			m_sFileForApiClean = cleaner.Execute(testData, cleanProperties);

			watch.Stop();
			m_apiCleanTime = watch.Elapsed.TotalSeconds;
		}
Esempio n. 2
0
 /// <exclude/>
 protected override Policy.Action2.IAction3 BuildAction()
 {
     CleanUserAction action = new CleanUserAction();
     return action;
 }
Esempio n. 3
0
        public void DoAPIClean()
        {
            CleanUserAction cleaner = new CleanUserAction();
            ActionPropertySet cleanProperties = new ActionPropertySet(new CleanActionPropertySet());
            ActionDataImpl testData = new ActionDataImpl(m_filenameIn);
                

            testData.Properties.Add("DisplayName", "BlahBlahBlah" + m_sFileExtension);
            cleanProperties["Footnotes"].Value = false;

                
            m_filenameOut = cleaner.Execute(testData, cleanProperties);
        }
Esempio n. 4
0
		private void TestLoadAndCleanPPTFile(string fileName, FileType fileType, string ext)
		{
		    using (WsActivationContext wsac = new WsActivationContext())
		    {
		        using (TempResourceFile file = new TempResourceFile(fileName))
		        {
		            // Force a create on the foreground thread
		            Workshare.ApplicationControllers.OfficeApplicationCache.Instance.Create(fileType);
		            CleanPropertiesDisplayTranslator displayTranslator = CleanPropertiesDisplayTranslator.Instance;
		            
		            CleanUserAction action = new CleanUserAction();
		            ActionPropertySet props = new ActionPropertySet(new CleanActionPropertySet());
		            props.SystemProperties.Add(displayTranslator.SysProp_FileType, new ActionProperty(displayTranslator.SysProp_FileType, typeof(string),
		                PropertyDisplayType.Default, false, false, ext, true));
		            props[CleanOption.Comments].Value = true;

		            ActionDataImpl testData = new ActionDataImpl(file.Filepath);
		            testData.Properties.Add(displayTranslator.StrmProp_DisplayName, file.Filepath);
		            testData.Properties.Add("CorrectedDisplayName", file.Filepath);

		        	action.Execute(testData, props);

		            Workshare.ApplicationControllers.OfficeApplicationCache.Instance.ShutDown();
		            WaitForPowerPointToShutDown(30000);
		        }
		    }
		}
Esempio n. 5
0
		public void Test_02_TestForRegionalSettings()
		{

		    System.Globalization.CultureInfo oldCultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
		    System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fi-FI");

		    System.Globalization.CultureInfo newCultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;

		    try
		    {
		        Assert.AreNotEqual(oldCultureInfo, newCultureInfo);
		        Assert.AreEqual(newCultureInfo, System.Globalization.CultureInfo.GetCultureInfo("fi-FI"));

		        Process[] pro = Process.GetProcessesByName("excel");
		        if (pro != null && pro.Length != 0)
		            throw new System.InvalidOperationException("excel should not be running");

		        using (WsActivationContext wsac = new WsActivationContext())
		        {
		            using (TempResourceFile file = new TempResourceFile())
		            {
		                file.setTempDir("Temp.xls");
		                file.CreateFile();
		                // Force a create on the foreground thread
		                Workshare.ApplicationControllers.OfficeApplicationCache.Instance.Create(FileType.ExcelSheet);
		                CleanPropertiesDisplayTranslator displayTranslator = CleanPropertiesDisplayTranslator.Instance;

		                CleanUserAction action = new CleanUserAction();
		                ActionPropertySet props = new ActionPropertySet(new CleanActionPropertySet());
		                props.SystemProperties.Add(displayTranslator.SysProp_FileType, new ActionProperty(displayTranslator.SysProp_FileType, typeof(string),
		                    PropertyDisplayType.Default, false, false, ".xls", true));
		                props[CleanOption.Comments].Value = true;
		                props[CleanOption.TrackChanges].Value = true;

		                ActionDataImpl testData = new ActionDataImpl(file.Filepath);
		                testData.Properties.Add(displayTranslator.StrmProp_DisplayName, file.Filepath);

		            	string outputFile = action.Execute(testData, props);
		                
		                Workshare.ApplicationControllers.OfficeApplicationCache.Instance.ShutDown();
		                WaitForExcelToShutDown(30000);

		                Assert.AreEqual(newCultureInfo, System.Globalization.CultureInfo.GetCultureInfo("fi-FI"));
		            }
		        }
		    }
		    catch
		    {
		    }
		    finally
		    {
		        System.Threading.Thread.CurrentThread.CurrentCulture = oldCultureInfo;
		    }
		}
Esempio n. 6
0
		public void Test_01_BasicRoundTripForActionObjectOnly()
		{
		    Process[] pro = Process.GetProcessesByName("winword");
		    if (pro != null && pro.Length != 0)
		        throw new System.InvalidOperationException("winword should not be running");

		    using (WsActivationContext wsac = new WsActivationContext())
		    {
		        using (TempResourceFile file = new TempResourceFile("Doc.doc"))
		        {
		            int revisionCount = 0;
		            int commentCount = 0;
		            GetRevisionAndCommmentCounts(file.Filepath, ref revisionCount, ref commentCount);
		            Assert.AreEqual(1, revisionCount, "There is one track change in the document.");
		            Assert.AreEqual(1, commentCount, "There is one comment in the document.");
		            // Force a create on the foreground thread
		            Workshare.ApplicationControllers.OfficeApplicationCache.Instance.Create(FileType.WordDocument);
		            CleanPropertiesDisplayTranslator displayTranslator = CleanPropertiesDisplayTranslator.Instance;
		            CleanUserAction action = new CleanUserAction();
		            ActionPropertySet props = new ActionPropertySet(new CleanActionPropertySet());
		            props.SystemProperties.Add(displayTranslator.SysProp_FileType, new ActionProperty(displayTranslator.SysProp_FileType, typeof(string),
		            PropertyDisplayType.Default, false, false, ".doc", true));
		            props[CleanOption.Comments].Value = true;
		            props[CleanOption.TrackChanges].Value = true;

					ActionDataImpl testData = new ActionDataImpl(file.Filepath);
		            testData.Properties.Add(displayTranslator.StrmProp_DisplayName, file.Filepath);
		            testData.Properties.Add("CorrectedDisplayName", file.Filepath);

		            string outFile = action.Execute(testData, props);
		            
		            Workshare.ApplicationControllers.OfficeApplicationCache.Instance.ShutDown();
		            WaitForWordToShutDown(30000);

					GetRevisionAndCommmentCounts(outFile, ref revisionCount, ref commentCount);
		            Assert.AreEqual(0, revisionCount, "Track changes should have been removed.");
		            Assert.AreEqual(0, commentCount, "Comments should have been removed.");
		        }
		    }
		}