public void Test_01_CleanPDFMarkups() { string master = Path.Combine(TestRoot, _testInputFileNameTemplate); _testInputFile = TestCopy(master, "Test_01_CleanPDFMarkups.pdf"); ActionPropertySet pdfActionProperties = new ActionPropertySet(); pdfActionProperties.SystemProperties.Add(strings.SysProp_FileType, new ActionProperty(strings.SysProp_FileType, typeof(string), PropertyDisplayType.Default, false, false, ".pdf", true)); pdfActionProperties.Add(PDFCleanOption.Markups, new ActionProperty(PDFCleanOption.Markups, true)); _testOutputFile = CleanFile(_testInputFile, pdfActionProperties); Metadata pdfCheckBefore = StaticShared.DiscoverMetadata(master); Metadata pdfCheckAfter = StaticShared.DiscoverMetadata(_testOutputFile); Assert.AreEqual(0, pdfCheckAfter.Markups, "Marksups not cleaned"); // Check nothing else has changed Assert.AreEqual(pdfCheckBefore.Attachments, pdfCheckAfter.Attachments, "Attachments number changed"); Assert.AreEqual(pdfCheckBefore.Bookmarks, pdfCheckAfter.Bookmarks, "Bookmarks number changed"); Assert.AreEqual(pdfCheckBefore.Properties, pdfCheckAfter.Properties, "Properties different"); }
ActionPropertySet InitializeNewPropertySet() { ActionPropertySet retVal = new ActionPropertySet(); retVal.Add(TagMimeActionStringTable.SubjectPrefix, new ActionProperty(Workshare.Policy.Actions.Properties.Resources.SubjectPrefix, Type.GetType("System.String"), PropertyDisplayType.TextBox, true, true, (object) "", false)); retVal.Add(TagMimeActionStringTable.RemoveAllAttachments, new ActionProperty(Workshare.Policy.Actions.Properties.Resources.RemoveAllAttachments, typeof(Boolean), PropertyDisplayType.Checkbox, true, true, false, false)); retVal.Add(TagMimeActionStringTable.InsertAttachment, new ActionProperty(Workshare.Policy.Actions.Properties.Resources.InsertAttachment, typeof(Boolean), PropertyDisplayType.Checkbox, true, true, false, false)); return retVal; }
public ActionPropertySet MergeProperties(ActionPropertySet[] sets) { ActionPropertySet retVal = new ActionPropertySet(); retVal.Add(RPostActionStringTable.SendRegistered, new ActionProperty(RPost.Action.Properties.Resources.SendRegistered, typeof(Boolean), Workshare.Policy.PropertyDisplayType.Checkbox, true, true, true, false)); retVal.Add(RPostActionStringTable.Unmarked, new ActionProperty(RPost.Action.Properties.Resources.Unmarked, typeof(Boolean), Workshare.Policy.PropertyDisplayType.Checkbox, true, true, false, false)); return retVal; }
private IActionPropertySet GetTestPropertySet() { ActionPropertySet properties = new ActionPropertySet(); properties.Add("Convert", new MockActionProperty("Convert to PDF", typeof(bool), PropertyDisplayType.Checkbox, true, true)); properties.Add("Security", new MockActionProperty("Make PDF secure", typeof(bool), PropertyDisplayType.Checkbox, false, true)); MockActionProperty invisibleProp = new MockActionProperty("Invisible", typeof(bool), PropertyDisplayType.Checkbox, true, true); invisibleProp.Visible = false; properties.Add("Invisible", invisibleProp); properties.Add("Password", new MockActionProperty("Password", typeof(string), PropertyDisplayType.TextBox, "", true)); properties.Add(ActionPropertyController.APPLY_TO_ALL, new MockActionProperty(ActionPropertyController.APPLY_TO_ALL, typeof(bool), PropertyDisplayType.Checkbox, false, false)); properties.Add("ExcludeStuff", new MockActionProperty("Exclude Stuff", typeof(bool), PropertyDisplayType.Checkbox, true, true)); properties.Add("CustomProperties", new MockActionProperty("Custom Properties", typeof(string), PropertyDisplayType.TextBox, "", true)); return properties; }
public UserAction() { properties = new ActionPropertySet(); properties.Add(PGPActionStringTable.SubjectPrefix, new ActionProperty(PGP.Action.Properties.Resources.Subject, typeof(string), Workshare.Policy.PropertyDisplayType.TextBox, false, false, "PGP: ", false)); }
public ActionPropertySet MergeProperties(ActionPropertySet[] sets) { ActionPropertySet retVal = new ActionPropertySet(); retVal.Add(PGPActionStringTable.SubjectPrefix, new ActionProperty(PGP.Action.Properties.Resources.Subject, typeof(string), Workshare.Policy.PropertyDisplayType.TextBox, false, false, "PGP: ", false)); return retVal; }
public void Test_05_CleanAll() { _testInputFile = TestCopy(Path.Combine(TestRoot, _testInputFileNameTemplate), "Test_05_CleanAll.pdf"); ActionPropertySet pdfActionProperties = new ActionPropertySet(); pdfActionProperties.SystemProperties.Add(strings.SysProp_FileType, new ActionProperty(strings.SysProp_FileType, typeof(string), PropertyDisplayType.Default, false, false, ".pdf", true)); pdfActionProperties.Add(PDFCleanOption.Attachments, new ActionProperty(PDFCleanOption.Attachments, true)); pdfActionProperties.Add(PDFCleanOption.Bookmarks, new ActionProperty(PDFCleanOption.Bookmarks, true)); pdfActionProperties.Add(PDFCleanOption.Markups, new ActionProperty(PDFCleanOption.Markups, true)); pdfActionProperties.Add(PDFCleanOption.Properties, new ActionProperty(PDFCleanOption.Properties, true)); _testOutputFile = CleanFile(_testInputFile, pdfActionProperties); Metadata pdfCheckAfter = StaticShared.DiscoverMetadata(_testOutputFile); Assert.AreEqual(0, pdfCheckAfter.Attachments, "Attachments not cleaned"); Assert.AreEqual(0, pdfCheckAfter.Bookmarks, "Bookmarks not cleaned"); Assert.AreEqual(0, pdfCheckAfter.Markups, "Markups not cleaned"); Assert.IsTrue(pdfCheckAfter.Properties == 3, "Properties not cleaned"); }
internal virtual ActionPropertySet BuildActionProperties(string sourceFilePath) { ActionPropertySet result = new ActionPropertySet(); CleanActionPropertySet temp = new CleanActionPropertySet(); var dict = temp.GetFCSContentTypeDict(); foreach (string key in temp.Keys) { result.Add(new ActionProperty(key, temp[key].Value)); } foreach (MetadataType mdt in m_metadataExclusions) { ContentType ct = Utils.ConvertContentType(mdt); string contentType; if (dict.TryGetValue(ct, out contentType)) { result[contentType].Value = false; } } foreach (CommonFieldType cft in m_fieldExclusions) { string fieldType = "ExcludeFieldCodes" + Utils.ConvertFieldType(cft); result[fieldType].Value = true; } result[CleanOption.UseWordOptimizingAddin].Value = true; result[CleanOption.ExcludeCustomProperties].Value = Normalize(CustomPropertyExclusionList); result[CleanOption.ExcludeFieldCodes].Value = Normalize(AdvancedFieldExclusionList); result[CleanOption.DeleteFieldCodes].Value = Normalize(FieldDeletionList); result[CleanOption.ExcludeDocumentVariables].Value = Normalize(DocumentVariableExclusionList); result[CleanOption.HandleFootnotesHiddenData].Value = TreatFootNotesAsMetadata; //result.Add(new ActionProperty("EnableFootnotes", true)); // always set this so that the cleaning is controlled by the excluded metadata types if (!string.IsNullOrEmpty(sourceFilePath)) { var fileType = ValidateFileType(sourceFilePath); result.SystemProperties.Add("FileType", new ActionProperty("FileType", FileTypeBridge.GetFileType(fileType))); } return result; }
private ActionPropertySet InitializeNewPropertySet() { ActionPropertySet retVal = new ActionPropertySet(); retVal.Add(ZipActionStringTable.PasswordRequired, new ActionProperty(LanguageResources.PasswordRequired, typeof(bool), PropertyDisplayType.Checkbox, false, false, false, false)); retVal.Add(ZipActionStringTable.EnforceStrongPassword, new ActionProperty(LanguageResources.EnforceStrongPassword, typeof(bool), PropertyDisplayType.Checkbox, false, false, false, false)); retVal.Add(ZipActionStringTable.Password, new ActionProperty(LanguageResources.Password, typeof(string), PropertyDisplayType.TextBox, true, true, "", false)); retVal.Add(ZipActionStringTable.ZIPAttachedFiles, new ActionProperty(LanguageResources.ZIPAttachedFiles, typeof(bool), PropertyDisplayType.Checkbox, false, false, false, false)); retVal.Add(ZipActionStringTable.AES128, new ActionProperty(LanguageResources.AES128, typeof(bool), PropertyDisplayType.Checkbox, false, false, false, false)); retVal.Add(ActionPropertyController.APPLY_TO_ALL, new ActionProperty(LanguageResources.ApplyToAll, typeof(bool), PropertyDisplayType.Checkbox, true, true, false, false)); return retVal; }
public void TestMergePra() { BasicAction basic = new BasicAction(); ActionPropertySet set = new ActionPropertySet(); set.Add("Test", new ActionProperty("Test","test")); basic.PropertySet = set; PolicyResponseAction pra = new PolicyResponseAction(); pra.Action = basic; pra.InternalProperties = set; PolicyResponseActionMerger merger = new PolicyResponseActionMerger(pra); set["Test"].Value = "test2"; merger.AddActionPropertySet(set); PolicyResponseAction praNew = (PolicyResponseAction) merger.MergePra(); Assert.AreEqual(praNew.InternalProperties["ThisWasMerged"].Value.ToString(), "sisterhood", "Property value should be - sisterhood"); Assert.AreEqual(2, basic.CountMerged, "Expected 2 property sets to be sent to the action"); Assert.AreNotEqual(praNew, pra, "Expected a new {0} back", praNew.GetType().ToString()); }