Beispiel #1
0
        public ExternalFile NextFile()
        {
            if (!m_read) {
                ExternalFile file = new ExternalFile();

                file.DataStream = m_file;
                file.Directory = false;
                file.Path = m_filename;
                file.Size = (int) m_file.Length;

                m_read=true;
                return file;
            } else
                return null;
        }
Beispiel #2
0
        public bool PutFile(ExternalFile file)
        {
            if (file.Directory)
                Directory.CreateDirectory(file.Path);
            else {
                string dirname = Path.GetDirectoryName(file.Path);

                Directory.CreateDirectory(dirname);
                FileStream osfs = File.Create(file.Path);

                byte[] data  = Globals.ReadStream(file.DataStream, file.Size);

                osfs.Write(data, 0, data.Length);
                osfs.Flush();

                osfs.Close();
            }

            return true;
        }
Beispiel #3
0
 public void CloseFile(ExternalFile file)
 {
 }
Beispiel #4
0
        public bool PutFile(ExternalFile file)
        {
            //Ignore directories
            if (file.Directory) return true;

            //Read data from file strea,
            byte[] data = new byte[file.Size];
            file.DataStream.Read(data, 0, file.Size);

            //Create entry
            ZipEntry e = new ZipEntry(file.Path);
            m_sink.PutNextEntry(e);
            m_sink.Write(data, 0, file.Size);

            return true;
        }
Beispiel #5
0
 public ExternalFile NextFile()
 {
     ZipEntry e;
     if (null == (e = m_source.GetNextEntry()))
         return null;
     else {
         ExternalFile efile = new ExternalFile();
         efile.DataStream = m_source;
         efile.Path = e.Name;
         efile.Directory = e.IsDirectory;
         efile.Size = Math.Max(0, (int) e.Size);
         return efile;
     }
 }