示例#1
0
 private void GenerateSerialNumber(uint offset)
 {
     // the Serial Number is a 128bit value
     mailbox.WriteBytes(offset, BitHelper.GetBytesFromValue((uint)SerialNumberLower, sizeof(uint)));
     mailbox.WriteBytes(offset + 4, BitHelper.GetBytesFromValue((uint)(SerialNumberLower >> 32), sizeof(uint)));
     mailbox.WriteBytes(offset + 8, BitHelper.GetBytesFromValue((uint)SerialNumberUpper, sizeof(uint)));
     mailbox.WriteBytes(offset + 12, BitHelper.GetBytesFromValue((uint)(SerialNumberUpper >> 32), sizeof(uint)));
 }
            public void WriteDoubleWord(long offset, uint value)
            {
                if (offset < 0 || (offset + 4) >= internalMemory.Length)
                {
                    Logger.Log(LogLevel.Error, "Trying to write value 0x{0:X} outside of {1} internal memory, at offset 0x{2:X}", value, Name, offset);
                    return;
                }
                Logger.Log(LogLevel.Debug, "Writing value 0x{0:X} to memory {1} at offset 0x{2:X}", value, Name, offset);

                foreach (var b in BitHelper.GetBytesFromValue(value, sizeof(uint), false))
                {
                    internalMemory[offset] = b;
                    ++offset;
                }
            }
示例#3
0
 public void WriteDoubleWord(long offset, uint value)
 {
     WriteBytes(offset, BitHelper.GetBytesFromValue(value, sizeof(uint)));
 }