; UuidToBytes Example ; ------------------- ; Requires Extended mode. ; A binary save file stores object ids as 16 raw bytes, not text id$="00112233-4455-6677-8899-aabbccddeeff" Print "Object id: "+id Print "" bank=CreateBank(16) ; UUID_BYTES_RFC writes network/display order - the hex bytes ; appear in the same order as the text If UuidToBytes(id,bank,0,UUID_BYTES_RFC)=0 Then RuntimeError "Invalid UUID" Print "RFC layout: "+BankHex(bank) ; UUID_BYTES_WINDOWS writes the mixed-endian Windows GUID / ; .NET Guid.ToByteArray() layout - the first three groups flip If UuidToBytes(id,bank,0,UUID_BYTES_WINDOWS)=0 Then RuntimeError "Invalid UUID" Print "Windows layout: "+BankHex(bank) Print "" Print "Always state which layout a file or protocol uses!" FreeBank bank Print "" Print "Press any key to close the example" WaitKey End ; Render a Bank's bytes as lowercase hex Function BankHex$(bank) hex_text$="" For i=0 To BankSize(bank)-1 hex_text=hex_text+Right(Hex(PeekByte(bank,i)),2) Next Return Lower(hex_text) End Function