diff --git a/Directory.Build.props b/Directory.Build.props index c9bedebdf..5ff6db8be 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -87,7 +87,6 @@ $(NoWarn);CA1834 $(NoWarn);CA1845 $(NoWarn);CA1850 - $(NoWarn);CA1861 $(NoWarn);CA1862 $(NoWarn);CA1872 $(NoWarn);CA2019 diff --git a/main/POIFS/Crypt/DataSpaceMapUtils.cs b/main/POIFS/Crypt/DataSpaceMapUtils.cs index 52435c5da..92a0342f9 100644 --- a/main/POIFS/Crypt/DataSpaceMapUtils.cs +++ b/main/POIFS/Crypt/DataSpaceMapUtils.cs @@ -32,14 +32,14 @@ public class DataSpaceMapUtils public static void AddDefaultDataSpace(DirectoryEntry dir) { DataSpaceMapEntry dsme = new DataSpaceMapEntry( - new int[] { 0 } - , new String[] { Decryptor.DEFAULT_POIFS_ENTRY } - , "StrongEncryptionDataSpace" + [0] + , [Decryptor.DEFAULT_POIFS_ENTRY] + , "StrongEncryptionDataSpace" ); - DataSpaceMap dsm = new DataSpaceMap(new DataSpaceMapEntry[] { dsme }); + DataSpaceMap dsm = new DataSpaceMap([dsme]); CreateEncryptionEntry(dir, "\u0006DataSpaces/DataSpaceMap", dsm); - DataSpaceDefInition dsd = new DataSpaceDefInition(new String[] { "StrongEncryptionTransform" }); + DataSpaceDefInition dsd = new DataSpaceDefInition(["StrongEncryptionTransform"]); CreateEncryptionEntry(dir, "\u0006DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace", dsd); TransformInfoHeader tih = new TransformInfoHeader( diff --git a/main/POIFS/FileSystem/NPOIFSDocument.cs b/main/POIFS/FileSystem/NPOIFSDocument.cs index 7aee75d9e..f3779fd31 100644 --- a/main/POIFS/FileSystem/NPOIFSDocument.cs +++ b/main/POIFS/FileSystem/NPOIFSDocument.cs @@ -173,7 +173,7 @@ public NPOIFSDocument(String name, int size, NPOIFSFileSystem filesystem, POIFSW Stream innerOs = _stream.GetOutputStream(); DocumentOutputStream os = new DocumentOutputStream(innerOs, size); - POIFSDocumentPath path = new POIFSDocumentPath(name.Split(new string[] { "\\\\" }, StringSplitOptions.RemoveEmptyEntries)); + POIFSDocumentPath path = new POIFSDocumentPath(name.Split([@"\\"], StringSplitOptions.RemoveEmptyEntries)); String docName = path.GetComponent(path.Length - 1); POIFSWriterEvent event1 = new POIFSWriterEvent(os, path, docName, size); Writer.ProcessPOIFSWriterEvent(event1); diff --git a/ooxml/XSSF/Extractor/XSSFExportToXml.cs b/ooxml/XSSF/Extractor/XSSFExportToXml.cs index dbf4aa419..0617542a9 100644 --- a/ooxml/XSSF/Extractor/XSSFExportToXml.cs +++ b/ooxml/XSSF/Extractor/XSSFExportToXml.cs @@ -330,7 +330,7 @@ private static void mapCellOnNode(XSSFCell cell, XmlNode node) private static String RemoveNamespace(String elementName) { - return Regex.IsMatch(elementName,".*:.*") ? elementName.Split(new char[]{':'})[1] : elementName; + return Regex.IsMatch(elementName,".*:.*") ? elementName.Split(':')[1] : elementName; } private static String GetFormattedDate(XSSFCell cell) @@ -342,7 +342,7 @@ private static String GetFormattedDate(XSSFCell cell) private XmlNode GetNodeByXPath(String xpath, XmlNode rootNode, XmlDocument doc, bool CreateMultipleInstances) { - String[] xpathTokens = xpath.Split(new char[]{'/'}); + String[] xpathTokens = xpath.Split('/'); XmlNode currentNode = rootNode; @@ -451,8 +451,8 @@ public int Compare(String leftXpath, String rightXpath) doc.LoadXml(xmlSchema); - String[] leftTokens = leftXpath.Split(new char[]{'/'}); - String[] rightTokens = rightXpath.Split(new char[] { '/' }); + String[] leftTokens = leftXpath.Split('/'); + String[] rightTokens = rightXpath.Split('/'); int minLength = leftTokens.Length < rightTokens.Length ? leftTokens.Length : rightTokens.Length; diff --git a/ooxml/XSSF/UserModel/Helpers/XSSFRowColShifter.cs b/ooxml/XSSF/UserModel/Helpers/XSSFRowColShifter.cs index 9e780904c..045e2588e 100644 --- a/ooxml/XSSF/UserModel/Helpers/XSSFRowColShifter.cs +++ b/ooxml/XSSF/UserModel/Helpers/XSSFRowColShifter.cs @@ -284,7 +284,7 @@ public static void UpdateConditionalFormatting(ISheet sheet, FormulaShifter Shif { CT_ConditionalFormatting cf = conditionalFormattingArray[j]; List cellRanges = new List(); - string[] regions = cf.sqref.ToString().Split(new char[] { ' ' }); + string[] regions = cf.sqref.Split(' '); for (int i = 0; i < regions.Length; i++) { diff --git a/ooxml/XSSF/UserModel/Helpers/XSSFXmlColumnPr.cs b/ooxml/XSSF/UserModel/Helpers/XSSFXmlColumnPr.cs index 221d8d693..8a1ff01aa 100644 --- a/ooxml/XSSF/UserModel/Helpers/XSSFXmlColumnPr.cs +++ b/ooxml/XSSF/UserModel/Helpers/XSSFXmlColumnPr.cs @@ -90,9 +90,9 @@ public String LocalXPath get { using var localXPath = ZString.CreateStringBuilder(); - int numberOfCommonXPathAxis = table.GetCommonXpath().Split(new char[] { '/' }).Length - 1; + int numberOfCommonXPathAxis = table.GetCommonXpath().Split('/').Length - 1; - String[] xPathTokens = ctXmlColumnPr.xpath.Split(new char[] { '/' }); + String[] xPathTokens = ctXmlColumnPr.xpath.Split('/'); for (int i = numberOfCommonXPathAxis; i < xPathTokens.Length; i++) { localXPath.Append("/" + xPathTokens[i]); diff --git a/ooxml/XSSF/UserModel/XSSFConditionalFormatting.cs b/ooxml/XSSF/UserModel/XSSFConditionalFormatting.cs index 47a60be43..d5c8d9dd9 100644 --- a/ooxml/XSSF/UserModel/XSSFConditionalFormatting.cs +++ b/ooxml/XSSF/UserModel/XSSFConditionalFormatting.cs @@ -64,7 +64,7 @@ internal CT_ConditionalFormatting GetCTConditionalFormatting() public CellRangeAddress[] GetFormattingRanges() { List lst = new List(); - String[] regions = _cf.sqref.Split(new char[] { ' ' }); + String[] regions = _cf.sqref.Split(' '); for (int i = 0; i < regions.Length; i++) { lst.Add(CellRangeAddress.ValueOf(regions[i])); diff --git a/ooxml/XSSF/UserModel/XSSFSheet.cs b/ooxml/XSSF/UserModel/XSSFSheet.cs index 960970fbc..eb5cbd126 100644 --- a/ooxml/XSSF/UserModel/XSSFSheet.cs +++ b/ooxml/XSSF/UserModel/XSSFSheet.cs @@ -3617,7 +3617,7 @@ public List GetDataValidations() { CellRangeAddressList addressList = new CellRangeAddressList(); - string[] regions = ctDataValidation.sqref.Split(new char[] { ' ' }); + string[] regions = ctDataValidation.sqref.Split(' '); for(int i = 0; i < regions.Length; i++) { if(regions[i].Length == 0) @@ -3625,7 +3625,7 @@ public List GetDataValidations() continue; } - string[] parts = regions[i].Split(new char[] { ':' }); + string[] parts = regions[i].Split(':'); CellReference begin = new CellReference(parts[0]); CellReference end = parts.Length > 1 ? new CellReference(parts[1]) diff --git a/ooxml/XSSF/UserModel/XSSFTable.cs b/ooxml/XSSF/UserModel/XSSFTable.cs index 04db877cb..bd8b39224 100644 --- a/ooxml/XSSF/UserModel/XSSFTable.cs +++ b/ooxml/XSSF/UserModel/XSSFTable.cs @@ -161,7 +161,7 @@ public String GetCommonXpath() if (column.GetXmlColumnPr() != null) { String xpath = column.GetXmlColumnPr().XPath; - String[] tokens = xpath.Split(new char[] { '/' }); + String[] tokens = xpath.Split('/'); if (commonTokens==null) { commonTokens = tokens; @@ -532,7 +532,7 @@ private void SetCellReferences() { string ref1 = ctTable.@ref; if (ref1 != null) { - string[] boundaries = ref1.Split(new char[] { ':' }, 2); + string[] boundaries = ref1.Split([':'], 2); string from = boundaries[0]; string to = boundaries.Length == 2 ? boundaries[1] : boundaries[0]; startCellReference = new CellReference(from); diff --git a/openxml4Net/OPC/PackagingUriHelper.cs b/openxml4Net/OPC/PackagingUriHelper.cs index d7ff70351..361b9c036 100644 --- a/openxml4Net/OPC/PackagingUriHelper.cs +++ b/openxml4Net/OPC/PackagingUriHelper.cs @@ -288,8 +288,8 @@ public static String Combine(String prefix, String suffix) public static Uri RelativizeUri(Uri sourceURI, Uri targetURI, bool msCompatible) { StringBuilder retVal = new StringBuilder(); - String[] segmentsSource = sourceURI.ToString().Split(new char[] { '/' }); - String[] segmentsTarget = targetURI.ToString().Split(new char[] { '/' }); + String[] segmentsSource = sourceURI.ToString().Split('/'); + String[] segmentsTarget = targetURI.ToString().Split('/'); // If the source Uri is empty if (segmentsSource.Length == 0) @@ -481,7 +481,7 @@ public static Uri ResolvePartUri(Uri sourcePartUri, Uri targetUri) } else if (targetPath.StartsWith("../")) { - string[] segments = path.Split(new char[] { '/' }); + string[] segments = path.Split('/'); int segmentEnd = segments.Length - 1; while (targetPath.StartsWith("../")) @@ -493,8 +493,10 @@ public static Uri ResolvePartUri(Uri sourcePartUri, Uri targetUri) for (int i = 0; i <= segmentEnd;i++ ) { - if(segments[i]!=string.Empty) - path += segments[i]+"/"; + if(segments[i] != string.Empty) + { + path += segments[i]+"/"; + } } path += targetPath; } diff --git a/testcases/main/App.config b/testcases/main/App.config index edc57877b..c3197a7bf 100644 --- a/testcases/main/App.config +++ b/testcases/main/App.config @@ -1,48 +1,33 @@ - - -
- - - - - - - - - - - - - - - - - ..\..\..\test-data - - - - - - - - - - - - - - - - - - - - - - - + + +
+ + + + + + + + + + + + + + + + + + ..\..\..\test-data + + + + diff --git a/testcases/ooxml/App.config b/testcases/ooxml/App.config index e101fd16d..09424b7ca 100644 --- a/testcases/ooxml/App.config +++ b/testcases/ooxml/App.config @@ -15,25 +15,4 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/testcases/openxml4net/App.config b/testcases/openxml4net/App.config index e0753c228..4bd1b0163 100644 --- a/testcases/openxml4net/App.config +++ b/testcases/openxml4net/App.config @@ -3,25 +3,4 @@ - - - - - - - - - - - - - - - - - - - - -