private TelegramType readRxPacket(DataBuffer replyData) { string str = "Received packet ( 6 bytes):"; string str2 = "\n\rOK\n\r>"; replyData.NumItems = 0; while (this._readRxPacketEnabled && (replyData.NumItems < (str.Length * 2))) { int num5 = this._ddi.readAppend(this._adtRec.PortAddress.handle, replyData, 1); if (num5 < 0) { replyData.NumItems = 0; return TelegramType.DeviceFailure; } if ((num5 > 0) && (replyData[replyData.NumItems - 1] == 0x3a)) { break; } Thread.Sleep(10); } if (replyData.NumItems == 0) { return TelegramType.DataAcknowledgeOK; } if (replyData[replyData.NumItems - 1] != 0x3a) { replyData.objectInfo(true); replyData.NumItems = 0; return TelegramType.DeviceFailure; } int num3 = replyData.indexOf('('); if (num3 == -1) { replyData.NumItems = 0; return TelegramType.DataAcknowledgeERROR; } int bytesToRead = int.Parse(replyData.objectInfo(num3 + 1, replyData.NumItems - 9, true)) + str2.Length; replyData.NumItems = 0; int num4 = 0; for (int i = 0; (i <= 5) || ((num4 > 0) && (i <= 50)); i++) { num4 = this._ddi.readAppend(this._adtRec.PortAddress.handle, replyData, bytesToRead); if (num4 < 0) { replyData.NumItems = 0; return TelegramType.DeviceFailure; } bytesToRead -= num4; if (bytesToRead <= 0) { bytesToRead = 1; } if (replyData.endsWith(str2)) { replyData.NumItems -= str2.Length; return TelegramType.DataAcknowledgeOK; } } return TelegramType.DataAcknowledgeERROR; }