From b1c34db78f668441510722bcd8b5a749b8040c79 Mon Sep 17 00:00:00 2001 From: Thomas Herrmann Date: Fri, 27 Sep 2024 16:30:22 +0200 Subject: [PATCH] TiaGitHandler - add additional namespace for delete date attribute and save csv file as UTF8 without BOM --- TiaGitHandler/Program.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/TiaGitHandler/Program.cs b/TiaGitHandler/Program.cs index 876d504a..6aa7a519 100644 --- a/TiaGitHandler/Program.cs +++ b/TiaGitHandler/Program.cs @@ -254,7 +254,7 @@ public static void ConvertPlcAlarmTextListXlsxToCsv(string sourceFile, string ta var maxColumnNumber = worksheet.Dimension.End.Column; var totalRowCount = worksheet.Dimension.End.Row; - using (var writer = new StreamWriter(targetFile, false, Encoding.UTF8)) + using (var writer = new StreamWriter(targetFile, false, new UTF8Encoding(false))) { for (int row = 1; row <= totalRowCount; row++) { @@ -401,6 +401,7 @@ private static void ParseFolder(ProjectFolder folder, string dir, List s ns.AddNamespace("smns3", "http://www.siemens.com/automation/Openness/SW/NetworkSource/StatementList/v3"); ns.AddNamespace("smns4", "http://www.siemens.com/automation/Openness/SW/NetworkSource/StructuredText/v2"); ns.AddNamespace("smns5", "http://www.siemens.com/automation/Openness/SW/NetworkSource/StructuredText/v4"); + ns.AddNamespace("smns6", "http://www.siemens.com/automation/Openness/SW/NetworkSource/StatementList/v5"); try { @@ -552,6 +553,18 @@ private static void ParseFolder(ProjectFolder folder, string dir, List s { } + try + { + var nodes = xmlDoc.SelectNodes("//smns6:DateAttribute[@Name='ParameterModifiedTS']", ns); + foreach (var node in nodes.Cast()) + { + node.ParentNode.RemoveChild(node); + } + } + catch + { + } + //try //{ // var nodes = xmlDoc.SelectNodes("//smns:Address[@Area='None' and @Informative='true']", ns);