public bool readFromStream(FileStream stream) { byte[] buffer = new byte[length]; int result = stream.Read(buffer, 0, buffer.Length); if (result != buffer.Length) { return(false); } MemoryInputStream ms = new MemoryInputStream(buffer, isLittleEndian); downTime = ms.readInt64(); upTimeFromDownTime = ms.readInt32(); pageId = ms.readInt32(); status = (byte)ms.ReadByte(); penTipType = (byte)ms.ReadByte(); penTipColor = ms.readInt32(); codeTableFileNumber = ms.readInt16(); codeTableFileOffset = ms.readInt32(); codeCount = ms.readInt16(); successRate = (byte)ms.ReadByte(); checkSum = (byte)ms.ReadByte(); byte sum = ms.getByteCheckSum(0, buffer.Length - 1); return(sum == checkSum); }
public bool readFromStream(FileStream stream) { byte[] buffer = new byte[length]; int result = stream.Read(buffer, 0, buffer.Length); if (result != buffer.Length) { return(false); } isLittleEndian = buffer[endianByteIndex] != 0; MemoryInputStream ms = new MemoryInputStream(buffer, isLittleEndian); fileType = (byte)ms.ReadByte(); if ((char)fileType != 'C') { return(false); } version = ms.readInt16(); fileNumber = ms.readInt16(); long n = ms.readInt64(); sectionId = (int)(n >> 56); ownerId = (int)(n >> 32) & 0x00ffffff; noteId = (int)(n & 0xffffffff); ms.Read(macAddress, 0, macAddress.Length); ms.Read(reserved, 0, reserved.Length); checkSum = (byte)ms.ReadByte(); byte sum = ms.getByteCheckSum(0, buffer.Length - 1); return(sum == checkSum); }