void __fastcall TDesignFrm::btStartNewClick(TObject *Sender) { if(SourceGenDesignFrm->StartDesign() == false) return; String fileName, head, subHead; m_WorkSpaceManager->BeginUpdate(); for(int i=0; i<SourceGenDesignFrm->GetHeadCount(); i++) { for(int j=0; j<SourceGenDesignFrm->GetSubHeadCount(); j++) { head = IntToHex(i+1, 2); subHead = IntToHex(j+1, 2); fileName = FormatStr("Pack_%s_%s.eggxp", head, subHead); WorkSpace * selWorkSpace = m_WorkSpaceManager->CreateNewWorkSpace(); selWorkSpace->InitWorkSpace(m_WorkSpaceManager->GetFilePath(), fileName, head + " " + subHead); selWorkSpace->GetFileManager()->CreateNew(); selWorkSpace->SaveToFile(); } } m_WorkSpaceManager->ReloadWorkSpacePack(); WorkspaceToGUI(); m_WorkSpaceManager->EndUpdate(); }
void __fastcall TDesignFrm::btClearHeadDefClick(TObject *Sender) { int result = Application->MessageBox(L"这个清空动作会清空所有文件! 是否继续?",L"删除询问",MB_OKCANCEL); if(result == IDCANCEL) { return; } m_WorkSpaceManager->BeginUpdate(); for(int i=m_WorkSpaceManager->GetWorkSpaceCount()-1; i>=0; i--) { m_WorkSpaceManager->DeleteWorkSpace(i); } //添加一条新数据 String head = IntToHex(0, 2); String subHead = IntToHex(0, 2); String fileName = FormatStr("Pack_%s_%s.eggxp", head, subHead); WorkSpace * selWorkSpace = m_WorkSpaceManager->CreateNewWorkSpace(); selWorkSpace->InitWorkSpace(m_WorkSpaceManager->GetFilePath(), fileName, head); selWorkSpace->GetFileManager()->CreateNew(); selWorkSpace->SaveToFile(); m_WorkSpaceManager->ReloadWorkSpacePack(); WorkspaceToGUI(); m_WorkSpaceManager->EndUpdate(); }