|
16 | 16 | using System; |
17 | 17 | using System.Collections.Generic; |
18 | 18 | using System.Linq; |
| 19 | +using System.Text; |
19 | 20 |
|
20 | 21 | namespace S7CommPlusDriver |
21 | 22 | { |
@@ -88,6 +89,23 @@ public enum ProgrammingLanguage : int |
88 | 89 | CEM = 600, |
89 | 90 | } |
90 | 91 |
|
| 92 | + public enum BinaryArtifacts : uint |
| 93 | + { |
| 94 | + Undefined = 0u, |
| 95 | + PlcFamily = 2147483649u, |
| 96 | + PlcMc7plusData = 2147483650u, |
| 97 | + PlcOptimizationInfoData = 2147483651u, |
| 98 | + PlcClosedImmediateData = 2147483652u, |
| 99 | + SimulatorFamily = 2147483665u, |
| 100 | + SimulatorMc7plusData = 2147483666u, |
| 101 | + SimulatorOptimizationInfoData = 2147483667u, |
| 102 | + SimulatorClosedImmediateData = 2147483668u, |
| 103 | + VirtualPlcFamilyKey = 2147483681u, |
| 104 | + VirtualPlcMc7plusDataKey = 2147483682u, |
| 105 | + VirtualPlcOptimizationInfoDataKey = 2147483683u, |
| 106 | + VirtualPlcClosedImmediateDataKey = 2147483684u |
| 107 | + } |
| 108 | + |
91 | 109 | public class BlockInfo |
92 | 110 | { |
93 | 111 | public string name; // Name of the datablock |
@@ -296,10 +314,17 @@ public int GetBlockXml(uint relid, out string xml_linecomment, out Dictionary<ui |
296 | 314 | var xx = (ValueBlobSparseArray)att.Value; |
297 | 315 | BlobDecompressor bd3 = new BlobDecompressor(); |
298 | 316 | var blob_sp3 = xx.GetValue(); |
299 | | - blockBody = new string[blob_sp3.Count]; |
| 317 | + blockBody = new string[blob_sp3.Where(x => x.Key < (uint)BinaryArtifacts.PlcFamily).Count()]; |
300 | 318 | var i = 0; |
301 | | - foreach (var key in blob_sp3.Keys) |
| 319 | + foreach (var key in blob_sp3.Keys.Order()) |
302 | 320 | { |
| 321 | + if (!(key < (uint)BinaryArtifacts.PlcFamily)) |
| 322 | + { |
| 323 | + //TODO: what to do with binary artifacts? |
| 324 | + var binaryArtifactType = (BinaryArtifacts)key; |
| 325 | + continue; |
| 326 | + } |
| 327 | + |
303 | 328 | if (blob_sp3[key].value != null) |
304 | 329 | { |
305 | 330 | var code = bd3.decompress(blob_sp3[key].value, 4); |
|
0 commit comments