private static void CopyStream(SystemIO.Stream source, SystemIO.Stream destination)
 {
     byte[] buffer = new byte[32768];
     int bytesRead;
     do
     {
         bytesRead = source.Read(buffer, 0, buffer.Length);
         destination.Write(buffer, 0, bytesRead);
     } while (bytesRead != 0);
 }
Ejemplo n.º 2
0
        private void PersistStreamInternal(IO.Stream stream, out Guid fileStoreGuid, out long fileSize)
        {
            fileStoreGuid = Guid.NewGuid();

            fileSize = 0;
            using (IO.FileStream fs = new IO.FileStream(rootFolder + "\\" + fileStoreGuid, IO.FileMode.Create))
            {
                byte[] buffer = new byte[1024 * 4];
                int len = -1;
                while ((len = stream.Read(buffer, 0, buffer.Length)) > 0)
                {
                    fs.Write(buffer, 0, len);
                    fileSize += len;
                }
            }
        }