源战役客户端
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

25 rindas
985 B

pirms 4 nedēļām
  1. using System;
  2. using UnityEditor.MemoryProfiler;
  3. namespace MemoryProfilerWindow
  4. {
  5. static class StringTools
  6. {
  7. public static string ReadString(BytesAndOffset bo, VirtualMachineInformation virtualMachineInformation)
  8. {
  9. var lengthPointer = bo.Add(virtualMachineInformation.objectHeaderSize);
  10. var length = lengthPointer.ReadInt32();
  11. var firstChar = lengthPointer.Add(4);
  12. return System.Text.Encoding.Unicode.GetString(firstChar.bytes, firstChar.offset, length * 2);
  13. }
  14. public static int ReadStringObjectSizeInBytes(BytesAndOffset bo, VirtualMachineInformation virtualMachineInformation)
  15. {
  16. var lengthPointer = bo.Add(virtualMachineInformation.objectHeaderSize);
  17. var length = lengthPointer.ReadInt32();
  18. return virtualMachineInformation.objectHeaderSize + /*lengthfield*/ 1 + (length * /*utf16=2bytes per char*/ 2) + /*2 zero terminators*/ 2;
  19. }
  20. }
  21. }