private int ac_Read(IntPtr buffer, int length, IntPtr user) { if (dataStream == null) { return(0); } try { if (length > readBuffer.Length) { readBuffer = new byte[length]; } if (!dataStream.CanRead) { return(0); } int readBytes = dataStream.Read(readBuffer, 0, length); Marshal.Copy(readBuffer, 0, buffer, readBytes); return(readBytes); } catch { } return(0); }
int ac_Read(IntPtr buffer, int length, IntPtr user) { if (dataStream == null) return 0; try { if (length > readBuffer.Length) readBuffer = new byte[length]; if (!dataStream.CanRead) return 0; int readBytes = dataStream.Read(readBuffer, 0, length); Marshal.Copy(readBuffer, 0, buffer, readBytes); return readBytes; } catch { } return 0; }