コード例 #1
0
        public unsafe int WriteBlocks(int NumBytesToWrite)
        {
            int   num  = 0;
            int   num2 = 0;
            byte *ptr  = (byte *)this.pBuffer;
            int   num3 = NumBytesToWrite;

            while (true)
            {
                int num4 = Math.Min(num3, 65536);
                if (!WinFileIO.WriteFile(this.pHandle, (void *)ptr, num4, &num, 0))
                {
                    break;
                }
                ptr  += num4;
                num2 += num4;
                num3 -= num4;
                if (num3 <= 0)
                {
                    return(num2);
                }
            }
            Win32Exception       ex  = new Win32Exception();
            ApplicationException ex2 = new ApplicationException("WinFileIO:WriteBlocks - Error occurred writing a file. - " + ex.Message);

            throw ex2;
        }
コード例 #2
0
        public unsafe int Write(int BytesToWrite)
        {
            int result;

            if (!WinFileIO.WriteFile(this.pHandle, this.pBuffer, BytesToWrite, &result, 0))
            {
                Win32Exception       ex  = new Win32Exception();
                ApplicationException ex2 = new ApplicationException("WinFileIO:Write - Error occurred writing a file. - " + ex.Message);
                throw ex2;
            }
            return(result);
        }