public void parseSystemDataFolders(DbfRow row) { GeneralType = PlcParser.DatabaseType.SystemDataFolders; DatabaseId = row.GetValue("ID").ToString(); SystemDataMLFB = row.GetValue("MLFB").ToString(); bSystemDataMLFB = encoding.GetBytes(SystemDataMLFB); }
public void parseSystemDataBlock(DbfRow row, string path) { GeneralType = PlcParser.DatabaseType.SystemDataBlock; DatabaseId = row.GetValue("ID").ToString(); BlockNumber = row.GetValue("NUMBER").ToString(); bBlockNumber = ushort.Parse(BlockNumber); string blockType = row.GetValue("TYPE").ToString(); iBlockType = int.Parse(blockType); BlockType = "SDB"; string time1 = row.GetValue("TS1").ToString(); byte[] A = encoding.GetBytes(time1); parseS7Time(A, out DateTime time, out byte[] time_ms, out byte[] time_dy); CodeTime = time; CodeTime_ms = time_ms; CodeTime_dy = time_dy; string time2 = row.GetValue("TS2").ToString(); byte[] B = encoding.GetBytes(time2); parseS7Time(B, out time, out time_ms, out time_dy); IntfTime = time; IntfTime_ms = time_ms; IntfTime_dy = time_dy; string blkLength = row.GetValue("SIZE").ToString(); BlockTotLen = uint.Parse(blkLength); LoadMemLen = uint.Parse((BlockTotLen - 6).ToString()); string attr = row.GetValue("ATTRIBUTE").ToString(); Attribute = byte.Parse(attr); Author = row.GetValue("PRODUCER").ToString(); bAuthor = encoding.GetBytes(Author); Name = row.GetValue("SDBNAME").ToString(); bName = encoding.GetBytes(Name); Version = byte.Parse(row.GetValue("VERSION").ToString()); parsePGfile(path); }
public void parseBlockFolders(DbfRow row) { GeneralType = PlcParser.DatabaseType.NormalBlockFolders; DatabaseId = row.GetValue("ID").ToString(); NumFB = ushort.Parse(row.GetValue("ANZFB").ToString()); NumFC = ushort.Parse(row.GetValue("ANZFC").ToString()); NumOB = ushort.Parse(row.GetValue("ANZOB").ToString()); NumDB = ushort.Parse(row.GetValue("ANZDB").ToString()); TotNumberOfBlocks = (int)NumFB + (int)NumFC + (int)NumOB + (int)NumDB; string time1 = row.GetValue("Lastmod").ToString(); byte[] A = encoding.GetBytes(time1); parseS7Time(A, out DateTime time, out byte[] time_ms, out byte[] time_dy); CodeTime = time; CodeTime_ms = time_ms; CodeTime_dy = time_dy; string time2 = row.GetValue("Crdate").ToString(); byte[] B = encoding.GetBytes(time2); parseS7Time(B, out time, out time_ms, out time_dy); IntfTime = time; IntfTime_ms = time_ms; IntfTime_dy = time_dy; }
public void parseNormalBlock(DbfRow row) { GeneralType = PlcParser.DatabaseType.NormalBlocks; DatabaseId = row.GetValue("OBJECTID").ToString(); BlockNumber = row.GetValue("BLKNUMBER").ToString(); bBlockNumber = ushort.Parse(BlockNumber); string lanStrig = row.GetValue("BLKLANG").ToString(); bBlockLanguage = byte.Parse(lanStrig); try { BlockLanguage = BlockLanguages[int.Parse(lanStrig)]; } catch { } string blockTypeNr = row.GetValue("SUBBLKTYP").ToString(); bBlockType = byte.Parse(blockTypeNr); BlockType = BlockTypes.TryGetValue(bBlockType, out string BlkType) ? BlkType : blockTypeNr; string time1 = row.GetValue("TIMESTAMP1").ToString(); byte[] A = encoding.GetBytes(time1); parseS7Time(A, out DateTime time, out byte[] time_ms, out byte[] time_dy); CodeTime = time; CodeTime_ms = time_ms; CodeTime_dy = time_dy; string time2 = row.GetValue("TIMESTAMP2").ToString(); byte[] B = encoding.GetBytes(time2); parseS7Time(B, out DateTime time_2, out time_ms, out time_dy); IntfTime = time_2; IntfTime_ms = time_ms; IntfTime_dy = time_dy; Checksum = ushort.Parse(row.GetValue("CHECKSUM").ToString()); if (bBlockType != 6 && bBlockType != 5) { Mc5Len = ushort.Parse(row.GetValue("MC5LEN").ToString()); SsbLen = ushort.Parse(row.GetValue("SSBLEN").ToString()); AddLen = ushort.Parse(row.GetValue("ADDLEN").ToString()); LocDataLen = ushort.Parse(row.GetValue("LOCDATALEN").ToString()); } else { uintMc5Len = uint.Parse(row.GetValue("MC5LEN").ToString()); uintSsbLen = uint.Parse(row.GetValue("SSBLEN").ToString()); uintAddLen = uint.Parse(row.GetValue("ADDLEN").ToString()); uintLocDataLen = uint.Parse(row.GetValue("LOCDATALEN").ToString()); } string blkLength = row.GetValue("BLKTOTLEN").ToString(); BlockTotLen = uint.Parse(blkLength); LoadMemLen = uint.Parse((BlockTotLen - 6).ToString()); /// Attribute /// Non-retain: 00X0 0000: 1:Non retain=yes, 0=Non retain=no string attr = row.GetValue("ATTRIBUTE").ToString(); Attribute = byte.Parse(attr); AgReserved = encoding.GetBytes(row.GetValue("AGRESERVED").ToString()); Password = byte.Parse(row.GetValue("PASSWORD").ToString()); Author = row.GetValue("USERNAME").ToString(); bAuthor = encoding.GetBytes(Author); Family = row.GetValue("BLOCKFNAME").ToString(); bFamily = encoding.GetBytes(Family); Name = row.GetValue("BLOCKNAME").ToString(); bName = encoding.GetBytes(Name); Version = byte.Parse(row.GetValue("VERSION").ToString()); try { MC5CODE = row.GetValue("MC5CODE").ToString(); bMC5CODE = encoding.GetBytes(MC5CODE); SSBPART = row.GetValue("SSBPART").ToString(); bSSBPART = encoding.GetBytes(SSBPART); ADDINFO = row.GetValue("ADDINFO").ToString(); bADDINFO = encoding.GetBytes(ADDINFO); } catch (Exception Ex) { Console.WriteLine(Ex); } }