Exemplo n.º 1
0
        private static byte[] CopyStream(Deployment.WindowsInstaller.Record record, int index)
        {
            using (var ms = new MemoryStream())
            {
                var buffer = new byte[4096];
                int read = 0;
                var stream = record.GetStream(index);

                do
                {
                    read = stream.Read(buffer, 0, buffer.Length);
                    if (0 < read)
                    {
                        ms.Write(buffer, 0, read);
                    }
                }
                while (0 < read);

                return ms.ToArray();
            }
        }