Ejemplo n.º 1
0
        private void __bw_DoWork_CompressTar(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            Object[] args = e.Argument as Object[];

            TarLzmaEncoder enc  = args[0] as TarLzmaEncoder;
            String         path = args[1] as String;

            enc.SaveTarball(path);

            enc.Dispose();

            __bw.DoWork -= new System.ComponentModel.DoWorkEventHandler(__bw_DoWork_CompressTar);
        }
Ejemplo n.º 2
0
        private void __bw_DoWork_CompressTarLzma(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            Object[] args = e.Argument as Object[];

            TarLzmaEncoder enc  = args[0] as TarLzmaEncoder;
            String         path = args[1] as String;

            FileSystemInfo[] fsitems = args[2] as FileSystemInfo[];

            BeginInvoke(new MethodInvoker(delegate() {
                _progress.ShowDialog(this);
            }));

            foreach (FileSystemInfo fsi in fsitems)
            {
                ProgressEvent(this, new ProgressEventArgs(0, fsi.FullName));

                DirectoryInfo di = fsi as DirectoryInfo;
                if (di != null)
                {
                    enc.AddDirectory(di);
                }

                FileInfo fi = fsi as FileInfo;
                if (fi != null)
                {
                    enc.AddFile(fi);
                }
            }

            enc.FinishAdding();

            enc.Compress(path);

            enc.Dispose();

            __bw.DoWork -= new System.ComponentModel.DoWorkEventHandler(__bw_DoWork_CompressTarLzma);
        }