public static hlStreamRead ( IntPtr pStream, IntPtr lpData, uint uiBytes ) : uint | ||
pStream | IntPtr | |
lpData | IntPtr | |
uiBytes | uint | |
return | uint |
public override int Read(byte[] buffer, int offset, int count) { IntPtr dataPtr = Marshal.AllocHGlobal((int)(_size > count ? count : _size)); HLLib.hlStreamRead(_streamPtr, dataPtr, (uint)(_size > count ? count : _size)); unsafe { var source = (byte *)dataPtr; fixed(byte *dest = buffer) { for (int i = offset; i < (_size - offset > count ? count : _size - offset); i++) { dest[i] = source[i]; } } } Marshal.FreeHGlobal(dataPtr); return((int)(_size - offset > count ? count : _size - offset)); }