Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export awl as xml including defaults and read only values. Remove all date nodes in xml files. #111

Merged
merged 1 commit into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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