コード例 #1
0
ファイル: Zip.cs プロジェクト: arthurzam/peulot-heshbon
        private static void DecompressAndWriteFile(string destination, ZipInputStream source)
        {
            IO.FileStream wstream = null;
            try
            {
                wstream = IO.File.Create(destination);
                const int block = 2048;
                byte[] data = new byte[block];
                while (true)
                {
                    int size = source.Read(data, 0, data.Length);

                    if (size > 0)
                        wstream.Write(data, 0, size);
                    else
                        break;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (wstream != null)
                    wstream.Close();
            }
        }