Ejemplo n.º 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            var filePath = textBox1.Text;
            var savePath = textBox2.Text;

            if (string.IsNullOrEmpty(filePath) || string.IsNullOrEmpty(savePath))
            {
                MessageBox.Show("文件路径为空或者输出地址为空");
            }
            //判断有没有路径 有的话删除
            try
            {
                //如果存在这个文件夹删除之
                if (Directory.Exists(savePath))
                {
                    DeleteFolder(savePath);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("删除失败" + ex.Message + "点击确认将解压到带时间后缀的文件夹");
                savePath = savePath + DateTime.Now.ToString("_MMdd_HHmmss");
            }
            ExtractOptions extractOptions = new ExtractOptions()
            {
                Input           = filePath,
                OutputDirectory = savePath
            };

            Extract.Action(extractOptions);
            System.Diagnostics.Process.Start(savePath);
        }