/// <summary> /// 快速安装 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void materialTextButton3_Click(object sender, EventArgs e) { if (this.extractProgress.Value > 0 && this.extractProgress.Value < 100) { MessageBox.Show("正在安装中。。。"); return; } this.customInstallPanel.Visible = false; // 隐藏界面 this.extractProgress.Visible = true; // 显示进度条 string sPath = Path.Combine(Environment.CurrentDirectory, InstallerConfig.Config.Install7ZFile); string tPath = m_curInstallExePath; if (!Directory.Exists(tPath)) { Directory.CreateDirectory(tPath); } var thread = new Thread(() => SevenZipHelper.Extract(sPath, tPath)) { Name = "InstallThread", IsBackground = true }; thread.Start(); }
public void ExtractTest() { string sPath = "C:/Users/zhanghui03/source/repos/DirectorEditor/TestResources/testzip.7z"; string tPath = "C:/Users/zhanghui03/source/repos/DirectorEditor/TestResources/xixi"; SevenZipHelper.Extract(sPath, tPath); }
/// <summary> /// 立即安装 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void materialTextButton1_Click(object sender, EventArgs e) { if (this.extractProgress.Value > 0 && this.extractProgress.Value < 100) { MessageBox.Show("正在安装中。。。"); return; } this.extractProgress.Visible = true;// 显示进度条 string sPath = Path.Combine(Environment.CurrentDirectory, InstallerConfig.Config.Install7ZFile); string tPath = m_curInstallExePath; if (!Directory.Exists(tPath)) { Directory.CreateDirectory(tPath); } if (Directory.GetFiles(tPath).Length > 0) // 如果目标目录存文件, 先删除 { try { FileOperationHelper.RemoveFullFolder(tPath); }catch (Exception ex) { MessageBox.Show(ex.Message); } } var thread = new Thread(() => SevenZipHelper.Extract(sPath, tPath)) { Name = "InstallThread", IsBackground = true }; thread.Start(); }