Пример #1
0
void	CLODConvertApp::FileOpen(CString FileName)
{

		EditList[ModelSelected].Name="";
		// Ok... Load the model
		CFile File;
		File.Open(FileName, CFile::modeRead, &CFileException(CFileException::generic, NULL));
		DWORD	FileSize=(DWORD)File.GetLength();
		void *FileBuffer=malloc(FileSize);
		File.Read(FileBuffer, FileSize);
		FileTitle=File.GetFileTitle();
		File.Close();
		TheModelPath=FileName;
		
		while(RenderPhase) Delay(5);
		// Eventually clear the model
		ClearModel(&EditList[ModelSelected]);
		// Linearize the model and assign to selected item
		DeIndexModel(FileBuffer, &EditList[ModelSelected]);
		E_FixModelFeatures(&EditList[ModelSelected]);
		EditList[ModelSelected].Name=FileTitle;
	
		SetupModel();
		AddToRecentFileList(FileName);

}
Пример #2
0
BOOL CDocument::OnSaveDocument( LPCTSTR lpszPathName )
/****************************************************/
{
    CFileException ex;
    CFile *pFile = GetFile( lpszPathName, CFile::modeCreate | CFile::modeWrite, &ex );
    if( pFile == NULL ) {
        ReportSaveLoadException( lpszPathName, &ex, TRUE, AFX_IDP_FAILED_TO_SAVE_DOC );
        return( FALSE );
    }
    try {
        CArchive ar( pFile, CArchive::store );
        Serialize( ar );
        ar.Close();
        SetPathName( lpszPathName );
        SetTitle( pFile->GetFileTitle() );
        ReleaseFile( pFile, FALSE );
    } catch( CException *pEx ) {
        ReportSaveLoadException( lpszPathName, pEx, TRUE, AFX_IDP_FAILED_TO_SAVE_DOC );
        ReleaseFile( pFile, TRUE );
        return( FALSE );
    }
    SetModifiedFlag( FALSE );
    return( TRUE );
}