Esempio n. 1
0
 private static string GetStringFromBlob(IDxcBlob blob)
 {
     unsafe
     {
         blob = Library.GetBlobAstUf16(blob);
         return(new string(blob.GetBufferPointer(), 0, (int)(blob.GetBufferSize() / 2)));
     }
 }
Esempio n. 2
0
 internal static string GetStringFromBlob(IDxcLibrary library, IDxcBlob blob)
 {
     unsafe
     {
         blob = library.GetBlobAstUf16(blob);
         return(new string(blob.GetBufferPointer(), 0, (int)(blob.GetBufferSize() / 2) - 1));
     }
 }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
    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);
    }