protected static List<Exclusion> GetListOfExcludedElements(CleanActionPropertySet elementsToClean) { List<Exclusion> listExclusions = new List<Exclusion>(); List<string> excludedMetawallPropNames = elementsToClean.GetExcludedMetawallPropertyList(); foreach (KeyValuePair<string, IActionProperty> kvp in elementsToClean) { string key = kvp.Key; IActionProperty property = kvp.Value; if (!excludedMetawallPropNames.Contains(key)) continue; string excludeKey = CleanActionPropertySet.ExcludedKeyToName(key); Exclusion exclusion = new Exclusion(); if (exclusion != null) { exclusion.Name = excludeKey; // property.DefaultDisplayName; exclusion.Value = property.Value; listExclusions.Add(exclusion); } } return listExclusions; }
private void ValidateFieldsWithExclusions(string outputFile, ContentType contentType, Exclusion exclusion, string NonExclusion) { using (DocxDocumentProcessor ddp2 = new DocxDocumentProcessor(File.Open(outputFile, FileMode.Open))) { ddp2.ExcludeList = null; ddp2.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(ddp2.DocumentText, "expected the document text object to be valid"); IAbstractTextType tt = ddp2.DocumentText.GetUniqueTextType(contentType); Assert.IsNotNull(tt, "expected the content type '" + contentType + "' to be valid"); CommonTestUtilities.CheckFieldAgainstStringExclusions(tt, exclusion, NonExclusion); } }
private void ValidateNoMetaDataWithExclusions(string outputFile, ContentType contentType, Exclusion exclusion) { using (XlsxDocumentProcessor xdp2 = new XlsxDocumentProcessor(File.Open(outputFile, FileMode.Open))) { xdp2.ExcludeList = null; xdp2.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(xdp2.DocumentText, "expected the Workbook text object to be valid"); IAbstractTextType tt = xdp2.DocumentText.GetUniqueTextType(contentType); Assert.IsNotNull(tt, "expected the content type '" + contentType + "' to be valid"); CommonTestUtilities.CheckAgainstStringExclusions(tt, exclusion); } }
public static List<Exclusion> CreateExclusionList() { List<Exclusion> exclusionList = new List<Exclusion>(); Exclusion exclusion = new Exclusion(); exclusion.Name = "ExcludeCustomProperties"; exclusion.Value = string.Empty; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "ExcludeFieldCodesAuthor"; exclusion.Value = false; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "ExcludeFieldCodesDocument"; exclusion.Value = false; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "ExcludeFieldCodesFormFields"; exclusion.Value = false; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "ExcludeFieldCodesIncludeFields"; exclusion.Value = false; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "ExcludeFieldCodesTables"; exclusion.Value = true; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "ExcludeFieldCodesNumbering"; exclusion.Value = true; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "ExcludeFieldCodesHyperlinks"; exclusion.Value = true; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "ExcludeFieldCodesLinks"; exclusion.Value = false; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "ExcludeFieldCodesReferences"; exclusion.Value = true; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "ExcludeFieldCodesFormulas"; exclusion.Value = false; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "ExcludeFieldCodesAutomation"; exclusion.Value = false; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "ExcludeDocVariables"; exclusion.Value = string.Empty; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "ExcludeFieldCodes"; exclusion.Value = string.Empty; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "DeleteFieldCodes"; exclusion.Value = string.Empty; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "EnableFootnotes"; exclusion.Value = false; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "EnableScriptRunning"; exclusion.Value = false; exclusionList.Add(exclusion); exclusion = new Exclusion(); exclusion.Name = "ScriptToRunName"; exclusion.Value = string.Empty; exclusionList.Add(exclusion); return exclusionList; }
internal static void CheckFieldAgainstStringExclusions(IAbstractTextType tt, Exclusion exclusion, string NonExclusion) { string exclusionValue = exclusion.Value as string; char[] seps = new char[] { ';' }; List<string> exclusionList = new List<string>(exclusionValue.Split(seps)); foreach (IAbstractTextNode node in tt.Nodes) { Assert.IsTrue(exclusionList.Contains(FieldTypeGroupHelper.TrimmedField(node.Info[0].value)), node.Info[0].value + " should still be present"); Assert.IsFalse(NonExclusion == node.Info[0].value, node.Info[0].value + " should still be present"); } }
public static void CheckAgainstStringExclusions(IAbstractTextType tt, Exclusion exclusion) { string exclusionValue = exclusion.Value as string; char[] seps = new char[] { ';' }; List<string> exclusionList = new List<string>(exclusionValue.Split(seps)); foreach (IAbstractTextNode node in tt.Nodes) { Assert.IsTrue(exclusionList.Contains(node.Info[0].value), node.Info[0].value + " should still be present"); } }