Beispiel #1
0
        public override void Paste(string path, Buffer buffer)
        {
            var       tempPath       = (buffer as FileBuffer).TempPath;
            const int bytesToCopy    = 16384;
            var       partBufferFile = new byte[bytesToCopy];

            using (var inStream = System.IO.File.Open(tempPath, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                //TO DO : now create entry in the same zip which take it
                //need change this
                //because will be cool copy zip entry and paste it in another zip or folder
                var newEntry = zip.CreateEntry(path);
                using (var outStream = newEntry.Open())
                {
                    var bytesCopied = 0;
                    do
                    {
                        bytesCopied = inStream.Read(partBufferFile, 0, bytesToCopy);
                        if (bytesCopied > 0)
                        {
                            outStream.Write(partBufferFile, 0, bytesCopied);
                        }
                    } while (bytesCopied > 0);
                }
            }
        }