Ejemplo n.º 1
0
        private void extractSelectedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var selItems = this.lvwFiles.SelectedItems.Cast <ListViewItem>();

            if (selItems.Count() == 0)
            {
                return;
            }

            var fileDatas = selItems.Where(item => item.Tag is FileData).Select(item => item.Tag as FileData).ToList();
            var dirDatas  = selItems.Where(item => item.Tag is DirData).Select(item => item.Tag as DirData).ToList();

            if (this.dlgFolder.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            string unzipDir = this.dlgFolder.SelectedPath;

            int decfileCnt = ZipData.UnzipFile(fileDatas, dirDatas, this.zipFilePath, unzipDir);
            var t1         = DateTime.Now;
            var dt         = DateTime.Now - t1;

            MessageBox.Show($"{decfileCnt} files unziped to {unzipDir}.\r\nelapse time : {dt.TotalSeconds:0.0}s");
        }
Ejemplo n.º 2
0
        private void extractAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.zipFilePath == null || this.trvZip.Nodes.Count == 0)
            {
                return;
            }

            var dirData = this.trvZip.Nodes[0].Tag as DirData;

            if (dirData == null)
            {
                return;
            }

            if (this.dlgFolder.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }
            string unzipDir = this.dlgFolder.SelectedPath;

            var t1         = DateTime.Now;
            int decfileCnt = ZipData.UnzipFile(dirData.fileDatas, dirData.dirDatas, this.zipFilePath, unzipDir);
            var dt         = DateTime.Now - t1;

            MessageBox.Show($"{decfileCnt} files unziped to {unzipDir}.\r\nelapse time : {dt.TotalSeconds:0.0}s");
        }