MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / WriteStr

Method WriteStr

Source/Editor/Utilities/Utils.cs:609–625  ·  view source on GitHub ↗
(this BinaryWriter stream, string str, int check)

Source from the content-addressed store, hash-verified

607 }
608
609 internal static unsafe void WriteStr(this BinaryWriter stream, string str, int check)
610 {
611 int length = str?.Length ?? 0;
612 stream.Write(length);
613 if (length == 0)
614 return;
615 var bytes = System.Text.Encoding.Unicode.GetBytes(str);
616 if (bytes.Length != length * 2)
617 throw new ArgumentException();
618 fixed (byte* bytesPtr = bytes)
619 {
620 var ptr = (char*)bytesPtr;
621 for (int j = 0; j < length; j++)
622 ptr[j] = (char)(ptr[j] ^ check);
623 }
624 stream.Write(bytes);
625 }
626
627 internal static unsafe void WriteStrAnsi(this BinaryWriter stream, string str, int check)
628 {

Callers 5

WriteVariantMethod · 0.80
SaveGraphMethod · 0.80
GetSignatureDataMethod · 0.80
OnLoadedMethod · 0.80
SaveMethod · 0.80

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected