Exemplo n.º 1
0
 private void DiscardArchive()
 {
     if (tarWriter != null)
     {
         tarWriter.Close();
         SharedData.Instance.OpenDisposables.Remove(tarWriter);
         tarWriter = null;
     }
     //if (gzStream != null)
     //{
     //    gzStream.Close();
     //    SharedData.Instance.OpenDisposables.Remove(gzStream);
     //    gzStream = null;
     //}
     if (tarFile != null)
     {
         tarFile.Close();
         SharedData.Instance.OpenDisposables.Remove(tarFile);
         tarFile = null;
     }
     if (lzmaInput != null)
     {
         lzmaInput.Close();
         SharedData.Instance.OpenDisposables.Remove(lzmaInput);
         lzmaInput = null;
     }
     if (lzmaOutput != null)
     {
         lzmaOutput.Close();
         SharedData.Instance.OpenDisposables.Remove(lzmaOutput);
         lzmaOutput = null;
     }
     if (archiveFileName1 != null)
     {
         File.Delete(archiveFileName1);
         SharedData.Instance.TempFiles.Remove(archiveFileName1);
         archiveFileName1 = null;
     }
     if (archiveFileName2 != null)
     {
         File.Delete(archiveFileName2);
         SharedData.Instance.TempFiles.Remove(archiveFileName2);
         archiveFileName2 = null;
     }
 }
Exemplo n.º 2
0
 private void InitializeArchive()
 {
     if (archiveFileName1 == null)
     {
         archiveFileName1 = Path.GetTempFileName();
         SharedData.Instance.ArchiveFileName = archiveFileName1;
         SharedData.Instance.TempFiles.Add(archiveFileName1);
     }
     //gzFile = File.Create(archiveFileName1);
     //gzFile.SetLength(0);
     //SharedData.Instance.OpenDisposables.Add(gzFile);
     //gzStream = new GZipStream(gzFile, CompressionMode.Compress, false);
     //SharedData.Instance.OpenDisposables.Add(gzStream);
     //tarWriter = new TarWriter(gzStream);
     tarFile = File.Create(archiveFileName1);
     tarFile.SetLength(0);
     SharedData.Instance.OpenDisposables.Add(tarFile);
     tarWriter = new TarWriter(tarFile);
     SharedData.Instance.OpenDisposables.Add(tarWriter);
     createdDirs.Clear();
 }
Exemplo n.º 3
0
 private void CloseArchive()
 {
     tarWriter.Close();
     SharedData.Instance.OpenDisposables.Remove(tarWriter);
     tarWriter = null;
     //gzStream.Close();
     //gzStream = null;
     tarFile.Close();
     SharedData.Instance.OpenDisposables.Remove(tarFile);
     tarFile = null;
 }