当前位置: 首页>>代码示例>>C++>>正文


C++ FitIniFile::open方法代码示例

本文整理汇总了C++中FitIniFile::open方法的典型用法代码示例。如果您正苦于以下问题:C++ FitIniFile::open方法的具体用法?C++ FitIniFile::open怎么用?C++ FitIniFile::open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FitIniFile的用法示例。


在下文中一共展示了FitIniFile::open方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnMiPurchaseFileBrowseButton

void CMissionDialog::OnMiPurchaseFileBrowseButton() {
	UpdateData(TRUE);
	while (true) {
		CFileDialog selectFileDialog(TRUE,_T("FIT"),_T("*.FIT"),
						 OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_NOCHANGEDIR,
						 _T("FIT File (*.FIT)|*.FIT|"));
		selectFileDialog.m_ofn.lpstrInitialDir = missionPath;
		if( selectFileDialog.DoModal()==IDOK ) {
			CString purchasePath = selectFileDialog.GetPathName();
			FitIniFile file;
			long result = 0;
			result = file.open( (char*)(const char*)purchasePath );
			if (NO_ERR != result) {
				AfxMessageBox(IDS_COULDNT_OPEN_PURCHASE_FILE);
			} else {
				long result = 0;
				result = file.seekBlock("Mechs");
				if (NO_ERR != result)
				{
					AfxMessageBox(IDS_NOT_A_VALID_PURCHASE_FILE);
				}
				file.close();
			}
			m_PurchaseFileEdit = selectFileDialog.GetFileTitle();
			break;
		} else {
			break;
		}
	}
	UpdateData(FALSE);
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:31,代码来源:missiondialog.cpp

示例2: readCampaignNameFromFile

void LogisticsSaveDialog::readCampaignNameFromFile( char* fileName, char* resultName, long len )
{
	FullPathFileName path;
	path.init( campaignPath, fileName, ".fit" );

	FitIniFile file;

	if ( NO_ERR != file.open( (char*)(const char*)path ) )
	{
		char errorStr[256];
		sprintf( errorStr, "couldn't open file %s", path );
		Assert( 0, 0, errorStr );
	}

	
	long result = file.seekBlock( "Campaign" );
	Assert( result == NO_ERR, 0, "Coudln't find the mission settings block in the mission file" );

	resultName[0] = 0;
	long lName = 0;

	result = file.readIdLong( "NameID", lName );
	if ( result == NO_ERR )
	{
		cLoadString( lName, resultName, len );
	}
	else
	{
		result = file.readIdString( "CampaignName", resultName, len );
		Assert( result == NO_ERR, 0, "couldn't find the missionName" );
	}
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:32,代码来源:LogisticsDialog.cpp

示例3: updateCampaignMissionInfo

void LogisticsSaveDialog::updateCampaignMissionInfo()
{

	FitIniFile file;
	FullPathFileName path;
	path.init( campaignPath, selectedName, ".fit" );
	if ( NO_ERR != file.open( path ) )
	{
		Assert( 0, 0, "coudln't find the campaign file\n" );
	}

	char fileName[256];

	if ( NO_ERR == file.seekBlock( "Group0Mission0" ) )
	{
		if ( NO_ERR != file.readIdString( "FileName", fileName, 1023 ) )
		{				
			setMission( "" );
		}		
		else
		{
			setMission( fileName );
		}
	}	
	else
		setMission( "" );

}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:28,代码来源:LogisticsDialog.cpp

示例4: Read

bool CCampaignData::Read(CString pathName) {
	FitIniFile fitFile;
	int result = fitFile.open(pathName.GetBuffer(0));
	if (NO_ERR != result) { assert(false); return false; }

	result = fitFile.seekBlock("Campaign");
	if (NO_ERR != result) { assert(false); }
	result = sReadIdString(fitFile, "CampaignName", m_Name);
	if (NO_ERR == result) { m_NameUseResourceString = false; }
	result = sReadIdInteger(fitFile, "NameID", m_NameResourceStringID);
	if (NO_ERR == result) { m_NameUseResourceString = true; }
	result = sReadIdBoolean(fitFile, "NameUseResourceString", m_NameUseResourceString);
	result = sReadIdInteger(fitFile, "CBills", m_CBills);
	result = sReadIdString(fitFile, "FinalVideo", m_FinalVideo);
	int groupCount = 0;
	result = sReadIdInteger(fitFile, "GroupCount", groupCount);
	if (NO_ERR != result) { return false; }

	int index;
	for (index = 0; groupCount > index; index+=1) {
		ECharString blockName;
		blockName.Format("Group%d", index);
		result = fitFile.seekBlock(blockName.Data());
		if (NO_ERR != result) { assert(false); continue; }
		CGroupData groupData;
		bool bresult = groupData.Read(fitFile, blockName.Data());
		if (true != bresult) { assert(false); continue; }
		m_GroupList.Append(groupData);
	}

	fitFile.close();
	return true;
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例5: isCorrectVersionSaveGame

bool LogisticsSaveDialog::isCorrectVersionSaveGame( char* fileName )
{
	FullPathFileName path;
	path.init( savePath, fileName, ".fit" );

	FitIniFile file;

	if ( NO_ERR != file.open( (char*)(const char*)path ) )
	{
		char errorStr[256];
		sprintf( errorStr, "couldn't open file %s", path );
		STOP((errorStr));
	}

	
	long result = file.seekBlock( "Version" );
	if (result != NO_ERR)
		return false;

	long testVersionNum = 0;
	result = file.readIdLong( "VersionNumber", testVersionNum );
	if ( (result == NO_ERR) && (testVersionNum == SaveGameVersionNumber))
		return true;

	return false;
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:26,代码来源:LogisticsDialog.cpp

示例6: init

long LightType::init (FilePtr objFile, unsigned long fileSize) {

	long result = 0;
	
	FitIniFile explFile;
	result = explFile.open(objFile,fileSize);
	if (result != NO_ERR)
		return(result);

	result = explFile.seekBlock("LightData");
	if (result != NO_ERR)
		return result;

	result = explFile.readIdBoolean("OneShotFlag",oneShotFlag);
	if (result != NO_ERR)
		return result;

	result = explFile.readIdFloat("AltitudeOffset",altitudeOffset);
	if (result != NO_ERR)
		return result;

	//------------------------------------------------------------------
	// Initialize the base object Type from the current file.
	result = ObjectType::init(&explFile);
	return(result);
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:26,代码来源:light.cpp

示例7:

int	LogisticsMechDisplay::init( )
{
	FitIniFile file;
	FullPathFileName path;
	path.init( artPath, "mcl_mechinfo", ".fit" );
	if ( NO_ERR !=  file.open( path ) )
	{
		Assert( 0, 0, "Couldn't open mcl_mechinfo.fit" );
		return 0;
	}

	LogisticsScreen::init( file, "Static", "Text", "Rect", "Button" );
	
	mechCamera.init( rects[1].left(), rects[2].top(),
			rects[2].left(), rects[2].bottom() );

	char blockName[64];
	for ( int i = 0; i < 3; i++ )
	{
		sprintf( blockName, "AttributeMeter%ld", i );
		attributeMeters[i].init( &file, blockName );
	}

	
	componentListBox.init( rects[0].left(), rects[0].top(),
		rects[0].width(), rects[0].height() );


	return 1;


}
开发者ID:wolfman-x,项目名称:mechcommander2,代码行数:32,代码来源:logisticsmechdisplay.cpp

示例8: init

void HotKeyListItem::init()
{
	if ( s_item )
		return;

	s_item = new HotKeyListItem();
	FitIniFile file;
	FullPathFileName path;
	path.init( artPath, "mcl_options_combobox1", ".fit" );
	if ( NO_ERR != file.open( path ) )
	{
		char error[256];
		sprintf( error, "couldn't open file %s", path );
		Assert( 0, 0, error );
		return;	
	}

	s_item->description.init( &file, "Text0" );
	s_item->text.init( &file, "Text1" );

	s_item->animations[0].init( &file, "Animation0" );
	s_item->animations[1].init( &file, "Animation1" );
	s_item->animations[2].init( &file, "Animation2" );

	s_item->rects[0].init( &file, "Rect0" );
	s_item->rects[1].init( &file, "Rect1" );
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例9: init

void MPGameBrowser::init(FitIniFile* file)
{
	LogisticsScreen::init( *file, "Static", "Text", "Rect", "Button" );

	if ( buttonCount )
	{
		for ( int i = 0; i < buttonCount; i++ )
		{
			buttons[i].setMessageOnRelease();
			if (buttons[i].getID() == 0)
			{
				buttons[i].setID(FIRST_BUTTON_ID + i);
				buttons[i].setPressFX( LOG_VIDEOBUTTONS );
				buttons[i].setHighlightFX( LOG_DIGITALHIGHLIGHT );
				buttons[i].setDisabledFX( LOG_WRONGBUTTON );
			}
		}
	}


	{
		char path[256];
		strcpy( path, artPath );
		strcat( path, "mcl_mp_lanbrowsercombobox0.fit" );
		
		FitIniFile PNfile;
		if ( NO_ERR != PNfile.open( path ) )
		{
			char error[256];
			sprintf( error, "couldn't open file %s", path );
			Assert( 0, 0, error );
			return;
		}
		
		PNfile.seekBlock("GameList"); /*for some reason aListBox::init(...) doesn't do the seekBlock itself*/
		gameList.init(&PNfile, "GameList");

		gameList.SelectItem(0);
		gameList.init( rects[0].left(), rects[0].top(), rects[0].width(), rects[0].height() );
		gameList.setOrange( true );

		templateItem.init(&PNfile, "GameListItem");

		for ( int i = 0; i < 256; i++ )
		{
			items[i] = templateItem;
		}

	}


	hostDlg.init();
}
开发者ID:Jacic,项目名称:MechCommander2,代码行数:53,代码来源:MPGameBrowser.cpp

示例10: setMission

void LogisticsSaveDialog::setMission( const char* fileName)
{
	if ( strlen( fileName ) )
	{

		long textureHandle = MissionBriefingScreen::getMissionTGA( fileName );

		statics[MAP_STATIC].setTexture( textureHandle );
		statics[MAP_STATIC].setUVs( 0, 127, 127, 0);
		statics[MAP_STATIC].setColor( 0xffffffff );

		FullPathFileName path;
		FitIniFile file;

		path.init( missionPath, fileName, ".fit" );

		if ( NO_ERR == file.open( path ) )
		{
			char missionName[256];
			missionName[0] = 0;
			bool bRes = 0;

			file.seekBlock( "MissionSettings" );
			file.readIdBoolean( "MissionNameUseResourceString", bRes );
			if ( bRes )
			{
				unsigned long lRes;
				file.readIdULong( "MissionNameResourceStringID", lRes );
				cLoadString(lRes, missionName, 255);
			}
			else
			{
				file.readIdString("MissionName", missionName, 255);
			}

			textObjects[2].setText(missionName);

		}
		else
		{
			textObjects[2].setText( "" );
		}

	}
	else
	{
		statics[MAP_STATIC].setColor( 0 );
		textObjects[2].setText( "" );

	}

}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:52,代码来源:LogisticsDialog.cpp

示例11: if

int	LogisticsMechDisplay::init( )
{
	FitIniFile file;
	FullPathFileName path;
	//path.init( artPath, "mcl_mechinfo", ".fit" );
	/*//magic 16092011 begin
	if ( Environment.screenWidth == 800 ) 
		path.init( artPath, "mcl_mechinfo", ".fit" );
	if ( Environment.screenWidth == 1280 )
		path.init( artPath, "mcl_mechinfo_1280x1024", ".fit" );
	if ( Environment.screenWidth == 1440 )
		path.init( artPath, "mcl_mechinfo_1440x900", ".fit" );
	//magic 16092011 end*/
	//magic 26092011 begin
	if ( Environment.screenWidth == 1280 )
		path.init( artPath, "mcl_mechinfo_1280x1024", ".fit" );
	else if ( Environment.screenWidth == 1440 )
		path.init( artPath, "mcl_mechinfo_1440x900", ".fit" );
	else
		path.init( artPath, "mcl_mechinfo", ".fit" );

	//magic 26092011 end
	if ( NO_ERR !=  file.open( path ) )
	{
		Assert( 0, 0, "Couldn't open mcl_mechinfo.fit" );
		return 0;
	}

	LogisticsScreen::init( file, "Static", "Text", "Rect", "Button" );
	
	mechCamera.init( rects[1].left(), rects[2].top(),
			rects[2].left(), rects[2].bottom() );

	char blockName[64];
	for ( int i = 0; i < 3; i++ )
	{
		sprintf( blockName, "AttributeMeter%ld", i );
		attributeMeters[i].init( &file, blockName );
	}

	
	componentListBox.init( rects[0].left(), rects[0].top(),
		rects[0].width(), rects[0].height() );


	return 1;


}
开发者ID:Echelon9,项目名称:mechcommander2-open,代码行数:49,代码来源:LogisticsMechDisplay.cpp

示例12: init

void SplashIntro::init()
{
	FullPathFileName path;
	path.init( artPath, "mcl_splashscreenintro", ".fit" );

	FitIniFile file;
	if ( NO_ERR != file.open( path ) )
	{
		char errorStr[256];
		sprintf( errorStr, "couldn't open file %s", (char*)path );
		Assert(0,0,errorStr );
	}

	LogisticsScreen::init( file, "Static", "Text", "Rect", "Button" );
}
开发者ID:wolfman-x,项目名称:mechcommander2,代码行数:15,代码来源:mainmenu.cpp

示例13: initColorTables

//----------------------------------------------------------------------------------
void initColorTables (void)
{
	FullPathFileName colorPath;
	colorPath.init(cameraPath,"colors",".fit");

	FitIniFile colorFile;
	long result = colorFile.open(colorPath);
	gosASSERT(result == NO_ERR);

	result = colorFile.seekBlock("Main");
	gosASSERT(result == NO_ERR);

	result = colorFile.readIdLong("NumTables",numColorRGBTables);
	gosASSERT(result == NO_ERR);

	colorRGBLookup = (DWORD **)systemHeap->Malloc(sizeof(DWORD *) * numColorRGBTables);
	gosASSERT(colorRGBLookup != NULL);

	memset(colorRGBLookup,0,sizeof(DWORD *) * numColorRGBTables);

	for (long i=0;i<numColorRGBTables;i++)
	{
		char tableBlock[256];
		sprintf(tableBlock,"Table%d",i);

		result = colorFile.seekBlock(tableBlock);
		gosASSERT(result == NO_ERR);

		colorRGBLookup[i] = (DWORD *)systemHeap->Malloc(sizeof(DWORD) * MAX_COLOR_ENTRIES);
		gosASSERT(colorRGBLookup[i] != NULL);

		DWORD *table = colorRGBLookup[i];

		for (long j=0;j<MAX_COLOR_ENTRIES;j++)
		{
			char colorBlock[256];
			sprintf(colorBlock,"Color%d",j);

			result = colorFile.readIdULong(colorBlock,table[j]);
			gosASSERT(result == NO_ERR);
		}
	}

	colorFile.close();
}	
开发者ID:,项目名称:,代码行数:46,代码来源:

示例14: init

void MPDirectTcpip::init(FitIniFile* file)
{
	LogisticsScreen::init( *file, "Static", "Text", "Rect", "Button" );

	if ( buttonCount )
	{
		for ( int i = 0; i < buttonCount; i++ )
		{
			if (buttons[i].getID() == 0)
			{
				buttons[i].setID(FIRST_BUTTON_ID + i);
			}
		}
	}


	{
		char path[256];
		strcpy( path, artPath );
		strcat( path, "mcl_mp_tcpip_combobox0.fit" );
		
		FitIniFile PNfile;
		if ( NO_ERR != PNfile.open( path ) )
		{
			char error[256];
			sprintf( error, "couldn't open file %s", path );
			Assert( 0, 0, error );
			return;
		}
		ipAddressComboBox.init(&PNfile, "TCIPNumberComboBox");

		aStyle7TextListItem *pTmp2;
		int i;
		for (i = 0; i < 15; i += 1)
		{
			pTmp2 = new aStyle7TextListItem;
			EString tmpStr;
			tmpStr.Format("Text0");
			pTmp2->init(&PNfile, tmpStr.Data());
			ipAddressComboBox.AddItem(pTmp2);
		}
		ipAddressComboBox.SelectItem(0);
	}
}
开发者ID:wolfman-x,项目名称:mechcommander2,代码行数:44,代码来源:mpdirecttcpip.cpp

示例15: init

void MPLoadMap::init(FitIniFile* file)
{
	LogisticsScreen::init( *file, "Static", "Text", "Rect", "Button" );

	if ( buttonCount )
	{
		for ( int i = 0; i < buttonCount; i++ )
		{
			buttons[i].setMessageOnRelease();
			if (buttons[i].getID() == 0)
			{
				buttons[i].setID(FIRST_BUTTON_ID + i);
			}
		}
	}

	file->seekBlock( "EnterAnim" );
	enterAnim.init( file, "" );
	file->seekBlock( "LeaveAnim" );
	exitAnim.init( file, "" );



	{
		char path[256];
		strcpy( path, artPath );
		strcat( path, "mcl_mp_loadmap_list0.fit" );
		
		FitIniFile PNfile;
		if ( NO_ERR != PNfile.open( path ) )
		{
			char error[256];
			sprintf( error, "couldn't open file %s", path );
			Assert( 0, 0, error );
			return;
		}
		PNfile.seekBlock("MapList"); /*for some reason aListBox::init(...) doesn't do the seekBlock itself*/
		mapList.init(&PNfile, "MapList");
		templateItem.init( &PNfile, "Text0" );
	
	}

	mapList.setOrange( true );
}
开发者ID:Echelon9,项目名称:mechcommander2-open,代码行数:44,代码来源:MPLoadMap.cpp


注:本文中的FitIniFile::open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。