// Copyright (c) Microsoft Corporation. All rights reserved.
// This file is best viewed using outline mode (Ctrl-M Ctrl-O)
// This program uses code hyperlinks available as part of the HyperAddin Visual Studio plug-in.
// It is available from http://www.codeplex.com/hyperAddin
static public int CopyStream(Stream fromStream, Stream toStream)
byte buffer = new byte;
int totalBytes = 0;
for (; ; )
int count = fromStream.Read(buffer, 0, buffer.Length);
if (count == 0)
toStream.Write(buffer, 0, count);
totalBytes += count;