private static string GetStringFromBlob(IDxcBlob blob) { unsafe { blob = Library.GetBlobAstUf16(blob); return(new string(blob.GetBufferPointer(), 0, (int)(blob.GetBufferSize() / 2))); } }
internal static string GetStringFromBlob(IDxcLibrary library, IDxcBlob blob) { unsafe { blob = library.GetBlobAstUf16(blob); return(new string(blob.GetBufferPointer(), 0, (int)(blob.GetBufferSize() / 2) - 1)); } }
public static byte[] BlobToBytes(IDxcBlob blob) { byte[] bytes; unsafe { char *pBuffer = blob.GetBufferPointer(); uint size = blob.GetBufferSize(); bytes = new byte[size]; IntPtr ptr = new IntPtr(pBuffer); System.Runtime.InteropServices.Marshal.Copy(ptr, bytes, 0, (int)size); } return(bytes); }
private static unsafe byte[] GetBytesFromBlob(IDxcBlob blob) { byte *pMem = (byte *)blob.GetBufferPointer(); uint size = blob.GetBufferSize(); byte[] result = new byte[size]; fixed(byte *pTarget = result) { for (uint i = 0; i < size; ++i) { pTarget[i] = pMem[i]; } } return(result); }