void CaIeaDataForLoadSave::SaveData (CaIEAInfo* pIEAData, CString& strFile) { try { CaIeaDataPage1& dataPage1 = pIEAData->m_dataPage1; CaIeaDataPage2& dataPage2 = pIEAData->m_dataPage2; // // Page 1: m_dataPage1 = dataPage1; m_dataPage2 = dataPage2; CFile f((LPCTSTR)strFile, CFile::modeCreate|CFile::modeWrite); CArchive ar(&f, CArchive::store); Serialize (ar); ar.Flush(); ar.Close(); f.Close(); } catch (CFileException* e) { MSGBOX_FileExceptionMessage (e); e->Delete(); } catch (CArchiveException* e) { MSGBOX_ArchiveExceptionMessage (e); e->Delete(); } catch(...) { AfxMessageBox (_T("Serialization error. \nCause: Unknown."), MB_OK|MB_ICONEXCLAMATION); } }
void CuSdaCtrl::StoreSchema(LPCTSTR lpszNode, LPCTSTR lpszDatabase, LPCTSTR lpszUser, LPCTSTR lpszFile) { CaVsdStoreSchema* pStoreSchema = new CaVsdStoreSchema(&(theApp.m_sessionManager), lpszFile, lpszNode, lpszDatabase, lpszUser); pStoreSchema->SetFetchObjects(CaLLQueryInfo::FETCH_USER); CaExecParamInstallation* p = new CaExecParamInstallation(pStoreSchema); CString strDirException; strDirException.Empty(); CString strDir = lpszFile; strDir = strDir.Left(strDir.ReverseFind('\\')); if(_access(strDir.GetBuffer(strDir.GetLength()),0) == -1) { //Invalid directory CFileException e; e.m_cause = CFileException::badPath; MSGBOX_FileExceptionMessage (&e, strDirException); } CString strMsgAnimateTitle = _T("Saving..."); if (pStoreSchema->GetDatabase().IsEmpty()) strMsgAnimateTitle.LoadString(IDS_TITLE_STORE_INSTALLATION); else strMsgAnimateTitle.LoadString(IDS_TITLE_STORE_DATABASE_SCHEMA); #if defined (_ANIMATION_) CxDlgWait dlg (strMsgAnimateTitle); dlg.SetUseAnimateAvi(AVI_FETCHF); dlg.SetExecParam (p); dlg.SetDeleteParam(FALSE); dlg.SetShowProgressBar(FALSE); dlg.SetUseExtraInfo(); dlg.SetHideCancelBottonAlways(TRUE); dlg.DoModal(); #else p->Run(); #endif CString strError = p->GetFailMessage(); if(!strDirException.IsEmpty()) { strError += consttchszReturn; strError += strDirException; } delete p; if (!strError.IsEmpty()) { AfxMessageBox (strError); } }