Esempio n. 1
0
        private static void AddZipEntry(java.util.zip.ZipFile zf, VfsDirectory root, java.util.zip.ZipEntry entry)
        {
            if (entry.isDirectory())
            {
                return;
            }
            string[]     path = entry.getName().Split('/');
            VfsDirectory dir  = root;

            for (int i = 0; i < path.Length - 1; i++)
            {
                VfsDirectory existing = dir.GetEntry(path[i]) as VfsDirectory;
                if (existing == null)
                {
                    existing = dir.AddDirectory(path[i]);
                }
                dir = existing;
            }
            dir.Add(path[path.Length - 1], new VfsZipEntry(zf, entry));
        }
Esempio n. 2
0
			internal ZipEntryStream(java.util.zip.ZipFile zipFile, java.util.zip.ZipEntry entry)
			{
				this.zipFile = zipFile;
				this.entry = entry;
				inp = zipFile.getInputStream(entry);
			}
Esempio n. 3
0
			internal VfsZipEntry(java.util.zip.ZipFile zipFile, java.util.zip.ZipEntry entry)
			{
				this.zipFile = zipFile;
				this.entry = entry;
			}
Esempio n. 4
0
        private void saveStreamToZip(string name, System.IO.Stream data, java.util.zip.ZipOutputStream zos)
        {
            java.util.zip.ZipEntry ze = new java.util.zip.ZipEntry(name);
            zos.putNextEntry(ze);

            byte[] buffer = new byte[1024];
            int ReadBytes;
            while ((ReadBytes = data.Read(buffer, 0, 1024)) > 0)
                try
                {
                    byte[] b2 = new byte[ReadBytes];
                    for (int i = 0; i < ReadBytes; i++) b2[i] = (byte)buffer[i];
                    zos.write(b2, 0, ReadBytes);
                }
                catch (System.IO.IOException e) {
                    File.AppendAllText("log_SAve.txt", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + ": " + name + Environment.NewLine);
                    break;
                }

            zos.closeEntry();
        }
Esempio n. 5
0
        private bool AddToZip(java.io.FileOutputStream fos, java.util.zip.ZipOutputStream zos, string sourceFile, string destName)
        {
            try
            {

                Thread.Sleep(6000);
                java.io.FileInputStream fis = new java.io.FileInputStream(sourceFile);
                java.util.zip.ZipEntry ze = new java.util.zip.ZipEntry(destName);
                zos.putNextEntry(ze);

                byte[] buffer = new byte[1024];
                int len;
                while ((len = fis.read(buffer)) >= 0)
                {
                    zos.write(buffer, 0, len);
                }
                zos.closeEntry();
                fis.close();
            }
            catch (Exception)
            {
                File.AppendAllText("log_save.txt", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + ": " + sourceFile + Environment.NewLine);
                AddToZip( fos,  zos,  sourceFile,  destName);
            }

            return true;
        }
Esempio n. 6
0
 internal ZipEntryStream(java.util.zip.ZipFile zipFile, java.util.zip.ZipEntry entry)
 {
     this.zipFile = zipFile;
     this.entry   = entry;
     inp          = zipFile.getInputStream(entry);
 }
Esempio n. 7
0
 internal VfsZipEntry(java.util.zip.ZipFile zipFile, java.util.zip.ZipEntry entry)
 {
     this.zipFile = zipFile;
     this.entry   = entry;
 }