Microsoft.Samples.VisualStudio.SourceControlIntegration.SccProvider.DataStreamFromComStream.Write C# (CSharp) Method

Write() public method

Writes a specified number of bytes into the stream object starting at the current seek pointer.
public Write ( byte buffer, int index, int count ) : void
buffer byte The buffer to write into the stream.
index int Index inside the buffer of the first byte to write.
count int Number of bytes to write.
return void
        public override void Write(byte[] buffer, int index, int count)
        {
            uint bytesWritten;

            if (count > 0)
            {

                byte[] b = buffer;

                if (index != 0)
                {
                    b = new byte[buffer.Length - index];
                    buffer.CopyTo(b, 0);
                }

                comStream.Write(b, (uint)count, out bytesWritten);
                if (bytesWritten != count)
                    throw new IOException("Didn't write enough bytes to IStream!");  // @TODO: Localize this.

                if (index != 0)
                {
                    b.CopyTo(buffer, index);
                }
            }
        }