internal void ReadData(ILicenseItem Data) { int dataSize = Data.DataSize; int dataValue = 0; int dataMask = 1; for (int bit = 0; bit < dataSize; bit++, dataMask <<= 1) { if ((byteArray[byteIndex] & bitMask) != 0) { dataValue |= dataMask; } bitIndex++; bitMask <<= 1; if (bitIndex >= numberOfBitsInData) { bitIndex = 0; bitMask = 1; if (++byteIndex > arraySize) { throw new Exception("Illegal License operation: LicenseBaseByteDeserializer object threw a Buffer Overflow exception in ReadData"); } } } Data.Value = dataValue; }
internal void AppendData(ILicenseItem Data) { int dataValue = Data.Value; int dataSize = Data.DataSize; int dataMask = 1; for(int bit = 0; bit < dataSize; bit++, dataMask <<= 1) { if ((dataValue & dataMask) != 0) { byteArray[byteIndex] |= bitMask; } bitIndex++; bitMask <<= 1; if (bitIndex >= numberOfBitsInData) { bitIndex = 0; bitMask = 1; if (++byteIndex > arraySize) throw new Exception("Illegal License operation: LicenseBaseByteSerializer object threw a Buffer Overflow exception in AppendData"); } } }