diff --git a/LibNoDaveConnectionLibrary/DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs b/LibNoDaveConnectionLibrary/DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs index 063dafa2..c74c0d4b 100644 --- a/LibNoDaveConnectionLibrary/DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs +++ b/LibNoDaveConnectionLibrary/DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs @@ -641,7 +641,7 @@ public Block GetBlock(ProjectBlockInfo blkInfo, S7ConvertingOptions myConvOpt) retVal.Parameter = Parameter.GetInterfaceOrDBFromStep7ProjectString(myTmpBlk.blkinterface, ref ParaList, blkInfo.BlockType, false, this, retVal, myConvOpt); } - if (myTmpBlk.blockdescription != null) + if (myTmpBlk.blockdescription != null && myTmpBlk.blockdescription.Length > 3) { retVal.Title = Project.ProjectEncoding.GetString(myTmpBlk.blockdescription, 3, myTmpBlk.blockdescription[1] - 4); retVal.Description = Project.ProjectEncoding.GetString(myTmpBlk.blockdescription, myTmpBlk.blockdescription[1], myTmpBlk.blockdescription.Length - myTmpBlk.blockdescription[1] - 1).Replace("\n", Environment.NewLine); diff --git a/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/Helper.cs b/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/Helper.cs index 88cd45d4..000e10c0 100644 --- a/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/Helper.cs +++ b/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/Helper.cs @@ -410,7 +410,7 @@ static public int GetIntFromHexString(string myString) static public uint GetUIntFromHexString(string myString) { uint val = 0; - foreach (char tmp in myString.ToLower().Replace("dw#16#", "").Replace("w#16#", "").Replace("b#16#", "").Replace("\t", "")) + foreach (char tmp in myString.ToLower().Replace("//", "").Replace("dw#16#", "").Replace("w#16#", "").Replace("b#16#", "").Replace("\t", "").Trim()) { val *= 16; switch (tmp) diff --git a/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/JumpMarks.cs b/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/JumpMarks.cs index b15969cb..1c0e2c33 100644 --- a/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/JumpMarks.cs +++ b/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/JumpMarks.cs @@ -52,7 +52,9 @@ public static List AddJumpmarks(List myBlk, if (JumpMarks != null && JumpMarks.Length >= 5) { - int anzJ = BitConverter.ToInt16(JumpMarks, NetworkCount * 2); //Todo: find out why it does not always contain the right amount of JumpNames + // Comment this out, as the variable anzJ is not used at all and it sometimes throws and IndexOutOfBounds Exception + // Eg. there are 68 jump marks, but the Network count is 40 => access from index 80 --> IOB Exception + // int anzJ = BitConverter.ToInt16(JumpMarks, NetworkCount * 2); //Todo: find out why it does not always contain the right amount of JumpNames for (int n = NetworkCount * 2 + 4; n < JumpMarks.Length; n += 5) { diff --git a/LibNoDaveConnectionLibrary/Projectfiles/Step7ProjectV5.cs b/LibNoDaveConnectionLibrary/Projectfiles/Step7ProjectV5.cs index 2fb0c67f..7ee6e46c 100644 --- a/LibNoDaveConnectionLibrary/Projectfiles/Step7ProjectV5.cs +++ b/LibNoDaveConnectionLibrary/Projectfiles/Step7ProjectV5.cs @@ -1579,7 +1579,11 @@ override protected void LoadProject() foreach (var cp in CPFolders.Where(x => x.SubModul != null)) { if (cp.NetworkInterfaces == null) cp.NetworkInterfaces = new List(); - cp.NetworkInterfaces.AddRange(cp.SubModul.NetworkInterfaces); + + if (cp.SubModul.NetworkInterfaces != null) + { + cp.NetworkInterfaces.AddRange(cp.SubModul.NetworkInterfaces); + } CPFolders.Remove(cp.SubModul); cp.SubModul = null; repeat = true;