源战役客户端
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

25 lignes
985 B

using System;
using UnityEditor.MemoryProfiler;
namespace MemoryProfilerWindow
{
static class StringTools
{
public static string ReadString(BytesAndOffset bo, VirtualMachineInformation virtualMachineInformation)
{
var lengthPointer = bo.Add(virtualMachineInformation.objectHeaderSize);
var length = lengthPointer.ReadInt32();
var firstChar = lengthPointer.Add(4);
return System.Text.Encoding.Unicode.GetString(firstChar.bytes, firstChar.offset, length * 2);
}
public static int ReadStringObjectSizeInBytes(BytesAndOffset bo, VirtualMachineInformation virtualMachineInformation)
{
var lengthPointer = bo.Add(virtualMachineInformation.objectHeaderSize);
var length = lengthPointer.ReadInt32();
return virtualMachineInformation.objectHeaderSize + /*lengthfield*/ 1 + (length * /*utf16=2bytes per char*/ 2) + /*2 zero terminators*/ 2;
}
}
}