(this BinaryWriter stream, string str, int check)
| 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 | { |
no test coverage detected