void CMainFrame::OnFileDefrag() { CzpEditorDoc* document = (CzpEditorDoc*)GetActiveDocument(); ZpExplorer& explorer = document->GetZpExplorer(); if (!explorer.isOpen()) { return; } //zp::u64 fragSize = explorer.getPack()->countFragmentSize(); //if (fragSize == 0) //{ // ::MessageBox(NULL, _T("No fragment found in package."), _T("Note"), MB_OK | MB_ICONINFORMATION); // return; //} //StringStream tip; //tip << _T("You can save ") << fragSize << _T(" bytes, continue?"); if (::MessageBox(NULL, _T("It will take minutes for large package, continue?"), _T("Note"), MB_YESNO | MB_ICONQUESTION) != IDYES) { return; } ProgressDialog progressDlg; progressDlg.m_explorer = &(document->GetZpExplorer()); progressDlg.m_running = true; progressDlg.m_params = NULL; progressDlg.m_operation = ProgressDialog::OP_DEFRAG; progressDlg.m_totalFileSize = explorer.countNodeFileSize(explorer.rootNode()); progressDlg.DoModal(); }
void CzpEditorView::startOperation(ProgressDialog::Operation op, zp::u64 totalFileSize, const std::vector<std::pair<zp::String, zp::String>>* params) { ProgressDialog progressDlg; progressDlg.m_explorer = &(GetDocument()->GetZpExplorer()); progressDlg.m_running = true; progressDlg.m_params = params; progressDlg.m_operation = op; progressDlg.m_totalFileSize = totalFileSize; progressDlg.DoModal(); }