Skip to content

Commit

Permalink
Merge pull request #111 from 7evenk/master
Browse files Browse the repository at this point in the history
Export awl as xml including defaults and read only values. Remove all date nodes in xml files.
  • Loading branch information
jogibear9988 authored Apr 3, 2019
2 parents 4e39e5e + 631a256 commit 1bce1eb
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public override string Export(ExportFormat exportFormat)
var file = Path.Combine(tmp, "tmp_dnspt_" + Guid.NewGuid().ToString().Replace("{", "").Replace("}", "").Replace("-", "").Replace(" ", "") + "." + ext);
if (ext == "xml")
{
plcBlock.Export(new FileInfo(file), Siemens.Engineering.ExportOptions.None);
plcBlock.Export(new FileInfo(file), ExportOptions.WithDefaults | ExportOptions.WithReadOnly);
}
else
{
Expand Down
126 changes: 126 additions & 0 deletions TiaGitHandler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,69 @@ private static void ParseFolder(ProjectFolder folder, string dir, List<string> s
catch
{
}
try
{
var nodes = xmlDoc.SelectNodes("//CodeModifiedDate");
var node = nodes[0];
node.ParentNode.RemoveChild(node);
}
catch
{
}
try
{
var nodes = xmlDoc.SelectNodes("//CompileDate");
var node = nodes[0];
node.ParentNode.RemoveChild(node);
}
catch
{
}
try
{
var nodes = xmlDoc.SelectNodes("//CreationDate");
var node = nodes[0];
node.ParentNode.RemoveChild(node);
}
catch
{
}
try
{
var nodes = xmlDoc.SelectNodes("//InterfaceModifiedDate");
var node = nodes[0];
node.ParentNode.RemoveChild(node);
}
catch
{
}
try
{
var nodes = xmlDoc.SelectNodes("//ModifiedDate");
var node = nodes[0];
node.ParentNode.RemoveChild(node);
}
catch
{
}
try
{
var nodes = xmlDoc.SelectNodes("//ParameterModified");
var node = nodes[0];
node.ParentNode.RemoveChild(node);
}
catch
{
}
try
{
var nodes = xmlDoc.SelectNodes("//StructureModified");
var node = nodes[0];
node.ParentNode.RemoveChild(node);
}
catch
{
}

StringBuilder sb = new StringBuilder();
XmlWriterSettings settings = new XmlWriterSettings
Expand Down Expand Up @@ -391,6 +454,69 @@ private static void ParseFolder(ProjectFolder folder, string dir, List<string> s
}
catch
{ }
try
{
var nodes = xmlDoc2.SelectNodes("//CodeModifiedDate");
var node = nodes[0];
node.ParentNode.RemoveChild(node);
}
catch
{
}
try
{
var nodes = xmlDoc2.SelectNodes("//CompileDate");
var node = nodes[0];
node.ParentNode.RemoveChild(node);
}
catch
{
}
try
{
var nodes = xmlDoc2.SelectNodes("//CreationDate");
var node = nodes[0];
node.ParentNode.RemoveChild(node);
}
catch
{
}
try
{
var nodes = xmlDoc2.SelectNodes("//InterfaceModifiedDate");
var node = nodes[0];
node.ParentNode.RemoveChild(node);
}
catch
{
}
try
{
var nodes = xmlDoc2.SelectNodes("//ModifiedDate");
var node = nodes[0];
node.ParentNode.RemoveChild(node);
}
catch
{
}
try
{
var nodes = xmlDoc2.SelectNodes("//ParameterModified");
var node = nodes[0];
node.ParentNode.RemoveChild(node);
}
catch
{
}
try
{
var nodes = xmlDoc2.SelectNodes("//StructureModified");
var node = nodes[0];
node.ParentNode.RemoveChild(node);
}
catch
{
}

if (removeCodeFromXml && !xml.Contains("$$GITHANDLER-KEEPCODE$$"))
{
Expand Down

0 comments on commit 1bce1eb

Please sign in to comment.