BOOL WriteIni()
{
	TCHAR lpBuffer[ BUF_SIZE ];
	TCHAR lpszPath[ MAX_PATH * 2 ];
	GetIniPath( lpszPath );

	// Delete old keys/values
	WritePrivateProfileString( TEXT( "Slider" ), TEXT( "Slider0" ),	NULL, lpszPath );
	WritePrivateProfileString( TEXT( "Slider" ), TEXT( "Slider1" ),	NULL, lpszPath );
	WritePrivateProfileString( TEXT( "Slider" ), TEXT( "Slider2" ),	NULL, lpszPath );
	WritePrivateProfileString( TEXT( "Options" ), TEXT( "RealTime" ), NULL, lpszPath );

	WritePrivateProfileString(
		TEXT( "Options" ), 
		TEXT( "RealTime" ),
		g_bRealTime ? TEXT( "1" ) : TEXT( "0" ),
		lpszPath
	);

	TCHAR lpszLangId[ 100 ];
	wsprintf( lpszLangId, TEXT( "%d" ), (int) GetLanguage() );
	WritePrivateProfileString(
		TEXT( "Options" ), 
		TEXT( "Language" ),
		lpszLangId,
		lpszPath
	);

	ZeroMemory( lpBuffer, sizeof( TCHAR ) * BUF_SIZE );
	LPTSTR ptr = lpBuffer;

	int i;

	for( i = 0; i < g_iEnemyIndex; i++ )
	{
		wsprintf( ptr, TEXT( "Enemy%d=%s" ), i, g_lpszEnemy[ i ] );
		ptr += ( lstrlen( ptr ) + 1 ); 
	}
	WritePrivateProfileSection( TEXT( "Enemy" ), lpBuffer, lpszPath );

	ZeroMemory( lpBuffer, sizeof( TCHAR ) * BUF_SIZE );
	ptr = lpBuffer;
	for( i = 0; i < g_iFriendIndex; i++ )
	{
		wsprintf( ptr, TEXT( "Friend%d=%s" ), i, g_lpszFriend[ i ] );
		ptr += ( lstrlen( ptr ) + 1 ); 
	}
	WritePrivateProfileSection( TEXT( "Friend" ), lpBuffer, lpszPath );

	return TRUE;
}
Ejemplo n.º 2
0
void CEventModParam::WriteIniFileDefaultSection()
{
//	TRACE("CEventModParam::WriteIniFileDefaultSection()\n");

	char *inifile = m_pParent->m_szIniFile;

	WritePrivateProfileSection(EVENT_DEFAULT,"",inifile);

	WritePrivateProfileString(EVENT_DEFAULT,"SLOW_RESET","900",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"TIME_ERR","60",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"NODE","-1",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"PORT","",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"FLAGCOMM","0",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"FLAGOTHR","0",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"FLAGTIME","0",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"MAXCYCLE","1000",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"MAXPAUSE","600",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"DO_DUMP","0",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,SAVE_LOC,"C:\\DATA\\EVENT01",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"MAXINQUIRE","10",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"MAXSTATUS","0",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"COMMFAIL","5",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"TIMEOUT","5",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"MAXBBM","1000",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,FILE_ID,"01",inifile);
	WritePrivateProfileString(EVENT_DEFAULT,"AUTOTIMESET","0",inifile);
}
Ejemplo n.º 3
0
/*!
	全設定をセーブする
	@param[in]	hWnd	ウインドウハンドル
	@param[in]	bActOn	起動時コピペ保存機能ONにしておくか
*/
HRESULT InitSettingSave( HWND hWnd, UINT bActOn )
{
	HWND	hLvWnd = GetDlgItem( hWnd, IDLV_CLIPSTEAL_FILELISTVW );
	INT		iCount, i;
	TCHAR	atBuff[MAX_PATH];


	iCount = ListView_GetItemCount( hLvWnd );

	//	一旦セクションを空にする
	ZeroMemory( atBuff, sizeof(atBuff) );
	WritePrivateProfileSection( TEXT("Collector"), atBuff, gatIniPath );

	InitParamValue( INIT_SAVE, VL_USE_BALLOON,  gGetMsgOn );
	InitParamValue( INIT_SAVE, VL_UNIRADIX_HEX, gbUniRadixHex );
	InitParamValue( INIT_SAVE, VL_CLIPFILECNT,  iCount );
	InitParamValue( INIT_SAVE, VL_COLLECT_AON,  bActOn );
	InitParamValue( INIT_SAVE, VL_COLHOT_MODY,  gbHotMod );
	InitParamValue( INIT_SAVE, VL_COLHOT_VKEY,  gbHotVkey );

	for( i = 0; iCount > i; i++ )
	{
		FileListViewGet( hWnd, i, atBuff );
		InitClipStealOpen( INIT_SAVE, i, atBuff );
	}

	return S_OK;
}
Ejemplo n.º 4
0
/*!
	プロフ履歴をINIから読んだり書いたり
	@param[in]		dMode	非0ロード 0セーブ
	@param[in]		dNumber	ロードセーブ番号
	@param[in,out]	ptFile	ロード:中身を入れる セーブ:保存する文字列 MAX_PATHであること・NULLなら内容消去
	@return			HRESULT	終了状態コード
*/
HRESULT InitProfHistory( UINT dMode, UINT dNumber, LPTSTR ptFile )
{
	TCHAR	atKeyName[MIN_STRING], atDefault[MAX_PATH];

	if( dMode  )	//	ロード
	{
		ZeroMemory( ptFile, sizeof(TCHAR) * MAX_PATH );

		StringCchPrintf( atKeyName, MIN_STRING, TEXT("Hist%X"), dNumber );
		GetPrivateProfileString( TEXT("ProfHistory"), atKeyName, TEXT(""), atDefault, MAX_PATH, gatIniPath );

		if( NULL == atDefault[0] )	return E_NOTIMPL;	//	記録無し

		StringCchCopy( ptFile, MAX_PATH, atDefault );
	}
	else	//	セーブ
	{
		if( ptFile )
		{
			StringCchPrintf( atKeyName, MIN_STRING, TEXT("Hist%X"), dNumber );
			WritePrivateProfileString( TEXT("ProfHistory"), atKeyName, ptFile, gatIniPath );
		}
		else	//	一旦全削除
		{
			WritePrivateProfileSection( TEXT("ProfHistory"), NULL, gatIniPath );
		}
	}

	return S_OK;
}
Ejemplo n.º 5
0
BOOL OnOK(HWND hWnd) {
	
	char szEMail[256], szSound[256];
	char szKey[256];
	char szBuff[32768];
	HWND hWndLV = GetDlgItem(hWnd, IDC_LIST);

	// マップを全削除
	g_maillist.clear();
	// ini ファイルを初期化
	WritePrivateProfileSection("Settings", "", szIni);

	// リストビューを走査
	int nListCount = ListView_GetItemCount(hWndLV);
	for (int i = 0; i < nListCount; i++) {
		ListView_GetItemText(hWndLV, i, 0, szEMail, sizeof(szEMail));
		ListView_GetItemText(hWndLV, i, 1, szSound, sizeof(szSound));
		// マップに追加
		g_maillist.insert(std::pair<std::string, std::string>(szEMail, szSound));
		// ini ファイルに書き込み
		sprintf(szKey, "%d", i);
		sprintf(szBuff, "%s,%s", szEMail, szSound);
		WritePrivateProfileString("Settings", szKey, szBuff, szIni);
	}

	return TRUE;
}
Ejemplo n.º 6
0
void RenderSetupDlg::OnOK()
{
	// TODO: 在此添加专用代码和/或调用基类
	WritePrivateProfileSection(_T("MoonRenderSetup"),_T(""),_T("./moon.ini"));

	//
	CString str;
	str.Format(_T("%d"),m_nAdapter);
	if(str.GetLength()==0||m_strResolution.GetLength()==0
		||m_strBufferFormat.GetLength()==0 
		||m_strDisplayFormat.GetLength()==0
		||m_strVertexProcessing.GetLength()==0
		||m_strPresentInterval.GetLength()==0)
	{
		MessageBox(_T("有些选项还未设置!"));
		return;
	}
	WritePrivateProfileString(_T("MoonRenderSetup"),_T("Adapter"),str,_T("./moon.ini"));
	WritePrivateProfileString(_T("MoonRenderSetup"),_T("DeviceType"),DevtypeToString(m_DeviceType),_T("./moon.ini"));

	if(m_bFullScreen)
		WritePrivateProfileString(_T("MoonRenderSetup"),_T("FullScreen"),_T("1"),_T("./moon.ini"));
	else
		WritePrivateProfileString(_T("MoonRenderSetup"),_T("FullScreen"),_T("0"),_T("./moon.ini"));

	WritePrivateProfileString(_T("MoonRenderSetup"),_T("DisplayFormat"),m_strDisplayFormat,_T("./moon.ini"));
	WritePrivateProfileString(_T("MoonRenderSetup"),_T("BufferFormat"),m_strBufferFormat,_T("./moon.ini"));
	WritePrivateProfileString(_T("MoonRenderSetup"),_T("Resolution"),m_strResolution,_T("./moon.ini"));
	WritePrivateProfileString(_T("MoonRenderSetup"),_T("VertexProcessing"),m_strVertexProcessing,_T("./moon.ini"));
	WritePrivateProfileString(_T("MoonRenderSetup"),_T("PresentInterval"),m_strPresentInterval,_T("./moon.ini"));

	CDialog::OnOK();
}
Ejemplo n.º 7
0
/*!
	開いてるタブを記録する・ファイルコア函数
	@param[in]	ptIniPath	INIファイルのパス
	@return		HRESULT	終了状態コード
*/
HRESULT DocMultiFileStore( LPTSTR ptIniPath )
{
	TCHAR	atKeyName[MIN_STRING], atBuff[MIN_STRING];
	UINT	i;
	FILES_ITR	itNow;

	assert( ptIniPath );

	//	一旦セクションを空にする
	ZeroMemory( atBuff, sizeof(atBuff) );
	WritePrivateProfileSection( TEXT("MultiOpen"), atBuff, ptIniPath );

	//	ファイルを順次記録
	i = 0;
	for( itNow = gltMultiFiles.begin( ); itNow != gltMultiFiles.end(); itNow++ )
	{
		if( NULL != itNow->atFileName[0] )
		{
			StringCchPrintf( atKeyName, MIN_STRING, TEXT("Item%u"), i );
			WritePrivateProfileString( TEXT("MultiOpen"), atKeyName, itNow->atFileName, ptIniPath );
			i++;
		}
	}

	//	個数を記録
	StringCchPrintf( atBuff, MIN_STRING, TEXT("%u"), i );
	WritePrivateProfileString( TEXT("MultiOpen"), TEXT("Count"), atBuff, ptIniPath );

	return S_OK;
}
Ejemplo n.º 8
0
BOOL CleanIRWProfileSection(const char *ProfileName, const char *Section)
{
	char ProfilePath[MAX_PATH];

	if(!PathSet)
		return FALSE;

	/* if its a drive letter, full path was given */
	if(ProfileName != NULL && ProfileName[1] == ':' && ProfileName[2] == '\\')
		strcpy(ProfilePath, ProfileName);
	else if(ProfileName != NULL) /* build the full path */
	{
		strcpy(ProfilePath, ProfilesFolder);
		strcat(ProfilePath, "\\");
		strcat(ProfilePath, ProfileName);

		/* check if the profile name ends with .ini, if not, append it */
		if(strcmp(ProfilePath + strlen(ProfilePath) - 1 - 3, ".ini"))
			strcat(ProfilePath, ".ini");
	}

	if(ProfileName == NULL)
	{
		strcpy(ProfilePath, ProfilesFolder);
		strcat(ProfilePath, "\\");
		strcat(ProfilePath, CurProfile);

		if(strcmp(ProfilePath + strlen(ProfilePath) - 1 - 3, ".ini"))
			strcat(ProfilePath, ".ini");
	}

	WritePrivateProfileSection(Section, NULL, ProfilePath);
    
	return TRUE;
}
Ejemplo n.º 9
0
bool IniFile::IsWritable()
{
    bool writable = WriteInt("Permissions", "isWritable",1);
    if (writable)
        WritePrivateProfileSection("Permissions", "", myInifile);

    return writable;
}
Ejemplo n.º 10
0
/*
 * AliasSave:  Save aliases to INI file.
 */
void AliasSave(void)
{
   int i, len;
   char temp[10], text[MAX_ALIASLEN + 1];
   char	fullSection[255];
   char	destName[128];
   char	*srcName;
   player_info	*playerInfo;

   destName[0] = '\0';

   playerInfo = GetPlayerInfo();
   srcName = LookupNameRsc(cinfo->player->name_res);
   len = strlen(srcName);

   for (i = 0; i < len; i++)
   {
	   itoa(srcName[i], temp, 10);
	   strcat(destName, temp);
   }

   strcpy(fullSection, alias_section);
   strcat(fullSection, destName);

   // Save the hotkey aliases.
   for (i=0; i < NUM_ALIASES; i++)
   {
      // Save function key aliases
      sprintf(temp, "F%d", i + 1);

      if (aliases[i].cr)
	 strcpy(text, aliases[i].text);
      else
	 sprintf(text, "%s~", aliases[i].text);

      WritePrivateProfileString(fullSection, temp, text, cinfo->ini_file);
   }

   strcpy(fullSection, command_section);
   strcat(fullSection, destName);

   // Save the command aliases.
   if (_nVerbAliases)
   {
      WritePrivateProfileSection(command_section, "\0\0\0", cinfo->ini_file);
      for (i = 0; i < _nVerbAliases; i++)
      {
	 if (_apVerbAliases[i].verb[0])
	 {
	    WritePrivateProfileString(command_section,
	       _apVerbAliases[i].verb,
	       _apVerbAliases[i].text,
	       cinfo->ini_file);
	 }
      }
   }
}
Ejemplo n.º 11
0
HRESULT CFileSave::MakeSection( const LPTSTR pszSection )
{	
	if ((strlen(m_strFilePath) == 0) || (pszSection == NULL) )
		return E_FAIL;

	BOOL bRet = WritePrivateProfileSection( pszSection, TEXT(""), m_strFilePath );

	if( bRet != TRUE )
		return E_FAIL;

	return S_OK;
}
Ejemplo n.º 12
0
BOOL WINAPI
WriteProfileSection(LPCTSTR lpszSection, LPCTSTR lpszKeysValues)
{
	BOOL rc;
	APISTR((LF_APICALL,
		"WriteProfileSection(LPCTSTR=%s,LPCTSTR=%s)\n",
		lpszSection?lpszSection:"NULL",
		lpszKeysValues?lpszKeysValues:"NULL"));

	rc = WritePrivateProfileSection(lpszSection, lpszKeysValues,
		"wini.ini");
     	APISTR((LF_APIRET,"WriteProfileSection: returning BOOL %x\n"));
	return rc;
}
Ejemplo n.º 13
0
void CMCAModParam::WriteIniFileDefaultSection()
{
	char *inifile = m_pParent->m_szIniFile;

	WritePrivateProfileSection(MCA_DEFAULT,"",inifile);

	WritePrivateProfileString(MCA_DEFAULT,"BATVOLTH","30.0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"BATVOLTL","10.0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"SUP_P15H","20.0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"SUP_P15L","10.0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"SUP_M15H","-10.0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"SUP_M15L","-20.0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"SUP_P05H","6.0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"SUP_P05L","4.0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"TIME_ERR","60",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"SLOW_RESET","900",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"NODE","-1",inifile);
	WritePrivateProfileString(MCA_DEFAULT,PORT,"",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"FLAGCOMM","0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"FLAGOTHR","0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"FLAGTIME","0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"MAXCYCLE","1000",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"MAXPAUSE","600",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"DO_DUMP","0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"LOG_FILTER","0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"CHAN1","U235",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"CHAN2","Cs137",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"CHAN3","U238",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"CHAN4","Gross Counts",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"CHAN5","Scaler",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"CHAN6","U235 / U238 Ratio",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"CHAN7","Cs137 / U238 Ratio",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"ALARM1","U235",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"ALARM2","Cs137",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"ALARM3","U238",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"ALARM4","Grs Cnts",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"ALARM5","Scaler",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"ALARM6","Ratio 1",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"ALARM7","Ratio 2",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"LOG_MII","0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,SAVE_LOC,"C:\\DATA\\MCA01",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"MAXINQUIRE","10",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"MAXSTATUS","0",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"COMMFAIL","5",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"TIMEOUT","5",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"MAXBBM","1000",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"AUTOTIMESET","1",inifile);
	WritePrivateProfileString(MCA_DEFAULT,FILE_ID,"01",inifile);
	WritePrivateProfileString(MCA_DEFAULT,"SPECTRAFILETYPE","0",inifile);
}
Ejemplo n.º 14
0
/*
** Writes statistics.
**
*/
void CMeasureNet::WriteStats(const WCHAR* iniFile, const std::wstring& statsDate)
{
	WCHAR buffer[64];
	WCHAR buffer2[32];
	size_t len, len2;

	size_t statsSize = c_StatValues.size() / 2;

	// Reserve sufficient buffer for statistics
	std::wstring data;
	data.reserve((64 * 2) + 128 * statsSize);

	// Add date
	AppendStatsValue(data, L"Since", 5, statsDate.c_str(), statsDate.size());

	// Add stats count
	len = _snwprintf_s(buffer, _TRUNCATE, L"%i", (int)statsSize);
	AppendStatsValue(data, L"NetStatsCount", 13, buffer, len);

	// Add stats
	for (size_t i = 0; i < statsSize; ++i)
	{
		ULARGE_INTEGER value;

		value.QuadPart = c_StatValues[i * 2];

		len  = _snwprintf_s(buffer, _TRUNCATE, L"NetStatsInHigh%i", (int)i + 1);
		len2 = _snwprintf_s(buffer2, _TRUNCATE, L"%u", value.HighPart);
		AppendStatsValue(data, buffer, len, buffer2, len2);

		len  = _snwprintf_s(buffer, _TRUNCATE, L"NetStatsInLow%i", (int)i + 1);
		len2 = _snwprintf_s(buffer2, _TRUNCATE, L"%u", value.LowPart);
		AppendStatsValue(data, buffer, len, buffer2, len2);

		value.QuadPart = c_StatValues[i * 2 + 1];

		len  = _snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutHigh%i", (int)i + 1);
		len2 = _snwprintf_s(buffer2, _TRUNCATE, L"%u", value.HighPart);
		AppendStatsValue(data, buffer, len, buffer2, len2);

		len  = _snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutLow%i", (int)i + 1);
		len2 = _snwprintf_s(buffer2, _TRUNCATE, L"%u", value.LowPart);
		AppendStatsValue(data, buffer, len, buffer2, len2);
	}

	// Write statistics
	WritePrivateProfileSection(L"Statistics", data.c_str(), iniFile);
}
Ejemplo n.º 15
0
void MeasureNet::WriteStats(const WCHAR* iniFile, const std::wstring& statsDate)
{
	WCHAR buffer[48];
	int len;

	uint32_t count = (uint32_t)c_StatValues.size() / 2;

	// Reserve sufficient buffer for statistics
	std::wstring data;
	data.reserve(48 * (2 + count));

	// Add date
	data = L"Since=";
	data += statsDate;
	data += L'\0';

	auto appendStatsValue = [&]()
	{
		data.append(buffer, len);
		data += L'\0';
	};

	// Add stats count
	len = _snwprintf_s(buffer, _TRUNCATE, L"Count=%u", count);
	appendStatsValue();

	// Add stats
	for (uint32_t i = 0; i < count; ++i)
	{
		if (c_StatValues[i * 2] > 0)
		{
			len  = _snwprintf_s(buffer, _TRUNCATE, L"In%u=%llu", i + 1, c_StatValues[i * 2]);
			appendStatsValue();
		}

		if (c_StatValues[i * 2 + 1] > 0)
		{
			len  = _snwprintf_s(buffer, _TRUNCATE, L"Out%u=%llu", i + 1, c_StatValues[i * 2 + 1]);
			appendStatsValue();
		}
	}

	// Write statistics
	WritePrivateProfileSection(L"Statistics", data.c_str(), iniFile);
}
Ejemplo n.º 16
0
void DialogInstall::CleanLayoutFile(const WCHAR* file)
{
	// Clear the [Rainmeter] section.
	WritePrivateProfileSection(L"Rainmeter", L"", file);

	// Remove the UseD2D key from all sections.
	WCHAR buffer[4096];
	if (GetPrivateProfileSectionNames(buffer, _countof(buffer), file) > 0)
	{
		const WCHAR* section = buffer;
		size_t sectionLength = 0;
		while ((sectionLength = wcslen(section)) > 0)
		{
			WritePrivateProfileString(section, L"UseD2D", nullptr, file);
			section += sectionLength + 1;
		}
	}
}
Ejemplo n.º 17
0
void CProxyCategory::SaveProxies()
{
	int i = 1;
	char Keyname1[11]="proxy", Keyname2[11]="speed", Keyname3[11]="alias";
	CProxyItem *pi;
	CProxyList* pl;

	CString filename = theApp.m_strUser+"Proxy.ini";
	remove(filename);//!!

	char num[10];
	char Section[10]="Proxy";
	int l=0;
	for (i=0;i <= m_ProxyCategory.GetUpperBound();i++)
	{
	   pl = m_ProxyCategory.GetAt(i);
	   if(pl!=NULL)
	   {
			if(l>0)
			   itoa(l, Section+5, 10);
			WritePrivateProfileSection(Section, NULL, filename);
			for(int ii=0; ii<=pl->m_Proxies.GetUpperBound(); ii++)
			{
				pi = pl->m_Proxies.ElementAt(ii);
				itoa(ii+1, Keyname1+5, 10);
				//app->WriteProfileString(Section, Keyname1, pi->m_strProxy);
				::WritePrivateProfileString(Section, Keyname1, pi->m_strProxy, filename);
				itoa(ii+1, Keyname2+5, 10);
				itoa(pi->m_nProxySpeed, num, 10);
				::WritePrivateProfileString(Section, Keyname2, num, filename);
				itoa(ii+1, Keyname3+5, 10);
				::WritePrivateProfileString(Section, Keyname3, pi->m_strProxyName, filename);
			}
			::WritePrivateProfileString(Section, "CategoryName", pl->m_strCategoryName, filename);
			::WritePrivateProfileString(Section, "ProxyByPass", pl->m_strProxyByPass, filename);
			itoa(pl->m_bIsWebProxy, num, 10);
			::WritePrivateProfileString(Section, "ProxyType",  num, filename);
			itoa(pl->m_bIsTransProxy, num, 10);
			::WritePrivateProfileString(Section, "Translation",  num, filename);
			l++;
		}
	}
}
BOOL vmsMoveFileAtWinBoot (LPCSTR pszSrc, LPCSTR pszDst)
{
	if ((GetVersion () & 0x80000000) == 0) 
		return MoveFileEx (pszSrc, pszDst, MOVEFILE_DELAY_UNTIL_REBOOT);

	char szWinInit [MAX_PATH] = "";
	GetWindowsDirectory (szWinInit, MAX_PATH);
	if (szWinInit [3] != 0)
		lstrcat (szWinInit, "\\");
	lstrcat (szWinInit, "wininit.ini");

	char sz [32000] = "";
	DWORD dwLen = GetPrivateProfileSection ("rename", sz, sizeof (sz), szWinInit);
	LPSTR psz = sz + dwLen;
	lstrcpy (psz, pszDst ? pszDst : "NUL");
	lstrcat (psz, "=");
	lstrcat (psz, pszSrc);
	psz [lstrlen (psz) + 1] = 0;
	return WritePrivateProfileSection ("rename", sz, szWinInit);
}
Ejemplo n.º 19
0
ResultType Line::IniWrite(LPTSTR aValue, LPTSTR aFilespec, LPTSTR aSection, LPTSTR aKey)
{
	TCHAR	szFileTemp[_MAX_PATH+1];
	TCHAR	*szFilePart;
	BOOL	result;
	// Get the fullpathname (INI functions need a full path) 
	GetFullPathName(aFilespec, _MAX_PATH, szFileTemp, &szFilePart);
#ifdef UNICODE
	// WritePrivateProfileStringW() always creates INIs using the system codepage.
	// IniEncodingFix() checks if the file exists and if it doesn't then it creates
	// an empty file with a UTF-16LE BOM.
	result = IniEncodingFix(szFileTemp, aSection);
	if(result){
#endif
		if (*aKey)
		{
			result = WritePrivateProfileString(aSection, aKey, aValue, szFileTemp);  // Returns zero on failure.
		}
		else
		{
			size_t value_len = ArgLength(1);
			TCHAR c, *cp, *szBuffer = talloca(value_len + 2); // +2 for double null-terminator.
			// Convert newline-delimited list to null-terminated array of null-terminated strings.
			for (cp = szBuffer; *aValue; ++cp, ++aValue)
			{
				c = *aValue;
				*cp = (c == '\n') ? '\0' : c;
			}
			*cp = '\0', cp[1] = '\0'; // Double null-terminator.
			result = WritePrivateProfileSection(aSection, szBuffer, szFileTemp);
		}
		WritePrivateProfileString(NULL, NULL, NULL, szFileTemp);	// Flush
#ifdef UNICODE
	}
#endif
	return g_script.mIsAutoIt2 ? OK : SetErrorLevelOrThrowBool(!result);
}
Ejemplo n.º 20
0
void CMcCurveData::WriteCurveData()
{
	TCurve tempcurve;
	CString strnewsection;
	CString strsiglecurve;
	strnewsection=strMcename;
	if (strnewsection.IsEmpty())
	{
		return;
	}
	if (strnewsection!=stroldsection&&(!stroldsection.IsEmpty()))
	{
		WritePrivateProfileSection(stroldsection,"",strfilepath);
	}
	else
	{
		WritePrivateProfileSection(strnewsection,"",strfilepath);
	}
	
	CString strkey;
	strkey.Format("%d",nIprecision);
	WritePrivateProfileString(strnewsection,"Iprecision",strkey,strfilepath);
	strkey.Format("%d",nVprecision);
	WritePrivateProfileString(strnewsection,"Vprecision",strkey,strfilepath);
	strkey.Format("%f",fImin);
	WritePrivateProfileString(strnewsection,"Imin",strkey,strfilepath);
	strkey.Format("%f",fImax);
	WritePrivateProfileString(strnewsection,"Imax",strkey,strfilepath);
	strkey.Format("%f",fVmin);
	WritePrivateProfileString(strnewsection,"Vmin",strkey,strfilepath);
	strkey.Format("%f",fVmax);
	WritePrivateProfileString(strnewsection,"Vmax",strkey,strfilepath);
	strkey.Format("%d",bgtmode);
	WritePrivateProfileString(strnewsection,"gtmode",strkey,strfilepath);
	strkey.Format("%d",bonlyrealline);
	WritePrivateProfileString(strnewsection,"onlyrealline",strkey,strfilepath);
	strkey.Format("%d",m_realtime_style);
	WritePrivateProfileString(strnewsection,"realtime_style",strkey,strfilepath);
	strkey.Format("%d",nNode);
	WritePrivateProfileString(strnewsection,"node",strkey,strfilepath);
	strkey.Format("%d",nLine);
	WritePrivateProfileString(strnewsection,"line",strkey,strfilepath);
	strkey.Format("%d",nRtu);
	WritePrivateProfileString(strnewsection,"rtu",strkey,strfilepath);
	WritePrivateProfileString(strnewsection,"UpName",UpName,strfilepath);
	WritePrivateProfileString(strnewsection,"DownName",DownName,strfilepath);
	CString strgtIcount;
	strgtIcount.Format("%d",gtIcurvearray.GetSize());
	WritePrivateProfileString(strnewsection,"gtIlinecount",strgtIcount,strfilepath);
	for (int i=0; i<gtIcurvearray.GetSize(); i++)
	{
		tempcurve=gtIcurvearray.GetAt(i);
		tempcurve.unit[7]=0x0;
		strsiglecurve.Format("%d,%d,%d,%d,%d,%d,%0.3f,%d,%s",tempcurve.ncurvecolor,tempcurve.BcurvechannelNO,tempcurve.nlinenode,tempcurve.nlineline,tempcurve.nlinertu,tempcurve.Bdot,tempcurve.fcurveratio,tempcurve.Bprecision,tempcurve.unit);
		CString strgtIkey;
		strgtIkey.Format("gtIline%d",i);
		WritePrivateProfileString(strnewsection,strgtIkey,strsiglecurve,strfilepath);
	}

	CString strgtVcount;
	strgtVcount.Format("%d",gtVcurvearray.GetSize());
	WritePrivateProfileString(strnewsection,"gtVlinecount",strgtVcount,strfilepath);
	for (int i=0; i<gtVcurvearray.GetSize(); i++)
	{
		tempcurve=gtVcurvearray.GetAt(i);
		tempcurve.unit[7]=0x0;
		strsiglecurve.Format("%d,%d,%d,%d,%d,%d,%0.3f,%d,%s",tempcurve.ncurvecolor,tempcurve.BcurvechannelNO,tempcurve.nlinenode,tempcurve.nlineline,tempcurve.nlinertu,tempcurve.Bdot,tempcurve.fcurveratio,tempcurve.Bprecision,tempcurve.unit);
		CString strgtVkey;
		strgtVkey.Format("gtVline%d",i);
		WritePrivateProfileString(strnewsection,strgtVkey,strsiglecurve,strfilepath);
	}
	if (bgtmode)
	{
		CString strzbIcount;
		strzbIcount.Format("%d",zbIcurvearray.GetSize());
		WritePrivateProfileString(strnewsection,"zbIlinecount",strzbIcount,strfilepath);
		for (int i=0; i<zbIcurvearray.GetSize(); i++)
		{
			tempcurve=zbIcurvearray.GetAt(i);
			tempcurve.unit[7]=0x0;
			strsiglecurve.Format("%d,%d,%d,%d,%d,%d,%0.3f,%d,%s",tempcurve.ncurvecolor,tempcurve.BcurvechannelNO,tempcurve.nlinenode,tempcurve.nlineline,tempcurve.nlinertu,tempcurve.Bdot,tempcurve.fcurveratio,tempcurve.Bprecision,tempcurve.unit);
			CString strzbIkey;
			strzbIkey.Format("zbIline%d",i);
			WritePrivateProfileString(strnewsection,strzbIkey,strsiglecurve,strfilepath);
		}

		CString strzbVcount;
		strzbVcount.Format("%d",zbVcurvearray.GetSize());
		WritePrivateProfileString(strnewsection,"zbVlinecount",strzbVcount,strfilepath);
		for (int i=0; i<zbVcurvearray.GetSize(); i++)
		{
			tempcurve=zbVcurvearray.GetAt(i);
			tempcurve.unit[7]=0x0;
			strsiglecurve.Format("%d,%d,%d,%d,%d,%d,%0.3f,%d,%s",tempcurve.ncurvecolor,tempcurve.BcurvechannelNO,tempcurve.nlinenode,tempcurve.nlineline,tempcurve.nlinertu,tempcurve.Bdot,tempcurve.fcurveratio,tempcurve.Bprecision,tempcurve.unit);
			CString strzbVkey;
			strzbVkey.Format("zbVline%d",i);
			WritePrivateProfileString(strnewsection,strzbVkey,strsiglecurve,strfilepath);
		}
	}
}
Ejemplo n.º 21
0
//
// ClearSection
//
Bool ConfigFile::ClearSection(const char *section)
{
  return (WritePrivateProfileSection(section, NULL, filename) ? TRUE : FALSE);
}
Ejemplo n.º 22
0
bool CAppSettingsModel::WriteSettings(void)
{
 CString IniFileName = GetINIFileFullName();
 bool status = true;
 CString write_str;

 //пересоздание секции (или создание заново)
 WritePrivateProfileSection(m_Name_Options_Section,_T(""),IniFileName);

 //-----------------------------------------
 write_str = m_optPortName.c_str();
 WritePrivateProfileString(m_Name_Options_Section,m_Name_PortName,write_str,IniFileName);

 //-----------------------------------------
 write_str.Format(_T("%d"),m_optBaudRateApplication);
 WritePrivateProfileString(m_Name_Options_Section,m_Name_BaudRateApplication,write_str,IniFileName);

 //-----------------------------------------
 write_str.Format(_T("%d"),m_optBaudRateBootloader);
 WritePrivateProfileString(m_Name_Options_Section,m_Name_BaudRateBootloader,write_str,IniFileName);

 //-----------------------------------------
 write_str = m_optLogFilesFolder;
 WritePrivateProfileString(m_Name_Options_Section,m_Name_LogFilesFolder,write_str,IniFileName);

 //-----------------------------------------
 write_str.Format(_T("%d"),(int)m_optUseAppFolder);
 WritePrivateProfileString(m_Name_Options_Section,m_Name_UseAppFolder,write_str,IniFileName);

 //-----------------------------------------
 write_str.Format(_T("%d"),(int)m_optCSVSepSymbol);
 WritePrivateProfileString(m_Name_Options_Section,m_Name_CSVSepSymbol,write_str,IniFileName);

 //-----------------------------------------
 write_str.Format(_T("%d"),(int)m_optMIDeskUpdatePeriod);
 WritePrivateProfileString(m_Name_Options_Section,m_Name_MIDeskUpdatePeriod,write_str,IniFileName);

 //-----------------------------------------
 size_t i;
 for(i = 0; i < m_AllowableLanguages.size(); ++i)
  if (m_optInterLang == m_AllowableLanguages[i].second)
   write_str = m_AllowableLanguages[i].first.second.c_str();
 WritePrivateProfileString(m_Name_Options_Section,m_Name_InterfaceLang,write_str,IniFileName);

 //-----------------------------------------
 for(i = 0; i < m_AllowablePlatforms.size(); ++i)
  if (m_optECUPlatformType == m_AllowablePlatforms[i].second)
   write_str = m_AllowablePlatforms[i].first.second.c_str();
 WritePrivateProfileString(m_Name_Options_Section,m_Name_ECUPlatformType,write_str,IniFileName);

 //-----------------------------------------
 write_str.Format(_T("%d"),(int)m_optUseDVFeatures);
 WritePrivateProfileString(m_Name_Options_Section,m_Name_UseDVFeatures,write_str,IniFileName);

 //-----------------------------------------
 write_str.Format(_T("%d"),(int)m_optDVDeskUpdatePeriod);
 WritePrivateProfileString(m_Name_Options_Section,m_Name_DVDeskUpdatePeriod,write_str,IniFileName);

 //Positions of windows
 WritePrivateProfileSection(m_Name_WndSettings_Section,_T(""),IniFileName);

 write_str.Format(_T("%d"),m_optStrtMapWnd_X);
 WritePrivateProfileString(m_Name_WndSettings_Section,m_Name_StrtMapWnd_X,write_str,IniFileName);

 write_str.Format(_T("%d"),m_optStrtMapWnd_Y);
 WritePrivateProfileString(m_Name_WndSettings_Section,m_Name_StrtMapWnd_Y,write_str,IniFileName);

 write_str.Format(_T("%d"),m_optIdleMapWnd_X);
 WritePrivateProfileString(m_Name_WndSettings_Section,m_Name_IdleMapWnd_X,write_str,IniFileName);

 write_str.Format(_T("%d"),m_optIdleMapWnd_Y);
 WritePrivateProfileString(m_Name_WndSettings_Section,m_Name_IdleMapWnd_Y,write_str,IniFileName);

 write_str.Format(_T("%d"),m_optWorkMapWnd_X);
 WritePrivateProfileString(m_Name_WndSettings_Section,m_Name_WorkMapWnd_X,write_str,IniFileName);

 write_str.Format(_T("%d"),m_optWorkMapWnd_Y);
 WritePrivateProfileString(m_Name_WndSettings_Section,m_Name_WorkMapWnd_Y,write_str,IniFileName);

 write_str.Format(_T("%d"),m_optTempMapWnd_X);
 WritePrivateProfileString(m_Name_WndSettings_Section,m_Name_TempMapWnd_X,write_str,IniFileName);

 write_str.Format(_T("%d"),m_optTempMapWnd_Y);
 WritePrivateProfileString(m_Name_WndSettings_Section,m_Name_TempMapWnd_Y,write_str,IniFileName);

 write_str.Format(_T("%d"),m_optAttenMapWnd_X);
 WritePrivateProfileString(m_Name_WndSettings_Section,m_Name_AttenMapWnd_X,write_str,IniFileName);

 write_str.Format(_T("%d"),m_optAttenMapWnd_Y);
 WritePrivateProfileString(m_Name_WndSettings_Section,m_Name_AttenMapWnd_Y,write_str,IniFileName);

 write_str.Format(_T("%d"),m_optMainFrmWnd_X);
 WritePrivateProfileString(m_Name_WndSettings_Section,m_Name_MainFrmWnd_X,write_str,IniFileName);

 write_str.Format(_T("%d"),m_optMainFrmWnd_Y);
 WritePrivateProfileString(m_Name_WndSettings_Section,m_Name_MainFrmWnd_Y,write_str,IniFileName);

 write_str.Format(_T("%d"),m_optDwellCntrlMapWnd_X);
 WritePrivateProfileString(m_Name_WndSettings_Section,m_Name_DwellCntrlMapWnd_X,write_str,IniFileName);

 write_str.Format(_T("%d"),m_optDwellCntrlMapWnd_Y);
 WritePrivateProfileString(m_Name_WndSettings_Section,m_Name_DwellCntrlMapWnd_Y,write_str,IniFileName);

 //-----------------------------------------
 write_str.Format(_T("%d"),(int)m_optTachometerMax);
 WritePrivateProfileString(m_Name_Fixtures_Section,m_Name_Tachometer_Max,write_str,IniFileName);

 write_str.Format(_T("%d"),(int)m_optPressureMax);
 WritePrivateProfileString(m_Name_Fixtures_Section,m_Name_Pressure_Max,write_str,IniFileName);

 return status;
}
Ejemplo n.º 23
0
void CGroupSelectDlg::OnOK() 
{
	// TODO: Add extra validation here
	int oldCount=0;
	BOOL r = TRUE;
	CString filename;
	m_name.GetWindowText(filename);
	int pos = filename.FindOneOf(STR_ERR_PATH_CHAR);
	if (pos>=0)
	{
		MSGBOX(IDS_GROUPNAME_ERROR);
		return;
	}
	//
	char state[10]="state",name[9]="name",url[8]="url",download[13]="download"; // x+5
	char num[15];
	filename = theApp.m_strGroupPath + filename+".cgp";
	//get old count 
	char tmp[INTERNET_MAX_PATH_LENGTH];
	while(r)
	{
		itoa(oldCount, name+4, 10);
		itoa(oldCount, url+3, 10);
		r = ::GetPrivateProfileString("Group", name, NULL, tmp, INTERNET_MAX_PATH_LENGTH, filename);
		if (!r)
			break;
		oldCount++;
	}
	//
	if (oldCount<1)
	{
		r = WritePrivateProfileSection("Group", NULL, filename);
		if (!r)
		{
			if (!_FileIsExist(theApp.m_strGroupPath))
				MSGBOX(IDS_GROUP_NOT_EXIST);
			else
				MSGBOX(IDS_GROUPNAME_ERROR);
			return;
		}
	}
	//write new item
	int i,count = m_list.GetItemCount();
	int index=0;
	for (i=0;i<count;i++)
	{
		if (m_list.GetCheck(i))
		{
			itoa(index+oldCount, state+5, 10);
			itoa(index+oldCount, name+4, 10);
			itoa(index+oldCount, url+3, 10);
			itoa(index+oldCount, download+8, 10);
			//::WritePrivateProfileString("Group", state, "1", filename);
			::WritePrivateProfileString("Group", name, m_list.GetItemText(i,0), filename);
			::WritePrivateProfileString("Group", url, m_list.GetItemText(i,1), filename);
			if (m_list.GetItemData(i) != DEFAULT_PROPERTY)
			{
				ultoa( m_list.GetItemData(i), num, 10);
				::WritePrivateProfileString("Group", download, num, filename);
			}
			//
			index++;
		}
	}

	CDialog::OnOK();
}
Ejemplo n.º 24
0
//一键清理方案
BOOL CSpecialApp::CleanUltraEdit(int iType,LPCTSTR lpcszAppPath)
{	
    BOOL retval = FALSE;
	CString strPath = lpcszAppPath;
	g_regClean.ConvetPath(strPath);
	
	WritePrivateProfileSection(_T("Replace History"),NULL,strPath);
	WritePrivateProfileSection(_T("Recent File List"),NULL,strPath);
	WritePrivateProfileSection(_T("Find Hex History"),NULL,strPath);
	WritePrivateProfileSection(_T("Find History"),NULL,strPath);
	

	TCHAR* szBuffer = NULL;
	TCHAR szKey[1024] = {0};
	CString strKey = _T("");
	CString strKeyName = _T("");
	CString strKeyValue = _T("");
    int nBufferSize;

    szBuffer = new TCHAR[65536];
    if (!szBuffer)
        goto clean0;

	nBufferSize = GetPrivateProfileSection(
		_T("Open Files"), 
		szBuffer, 
		65536,
		strPath
		);
	


	for (int n = 0, i = 0; n < nBufferSize; n++)
	{
		if (szBuffer[n] == 0)
		{
			szKey[i] = 0;
			strKey = szKey;

			strKeyName = strKey.Left(strKey.Find('='));
			strKeyValue = strKey.Mid(strKey.Find('=') + 1);
			
			int iLen = (int)wcslen(_T("Open File"));
			if ((-1!=strKeyName.Find(_T("Open File"))&&(strKeyName.GetLength()>iLen)))
			{	

				if ((strKeyName.GetAt(iLen)>='0'&&strKeyName.GetAt(iLen)<='9'))
				{
					WritePrivateProfileStruct(_T("Open Files"),strKeyName, NULL, 0,lpcszAppPath);
				}
			
			}

			i = 0;

		}
		else
		{
			szKey[i] = szBuffer[n];

			i++;
		}

	}

	ZeroMemory(szBuffer, 65536);
	nBufferSize = GetPrivateProfileSection(
		_T("Recent Projects"), 
		szBuffer, 
		65536,
		strPath
		);



	for (int n = 0, i = 0; n < nBufferSize; n++)
	{
		if (szBuffer[n] == 0)
		{
			szKey[i] = 0;
			strKey = szKey;

			strKeyName = strKey.Left(strKey.Find('='));
			strKeyValue = strKey.Mid(strKey.Find('=') + 1);

			int iLen = (int)wcslen(_T("Recent Project "));
			if ((-1!=strKeyName.Find(_T("Recent Project "))&&(strKeyName.GetLength()>iLen)))
			{	

// 				if ((strKeyName.GetAt(iLen)>='0'&&strKeyName.GetAt(iLen)<='9'))
// 				{
					WritePrivateProfileStruct(_T("Open Files"),strKeyName, NULL, 0,lpcszAppPath);
//				}

			}

			i = 0;

		}
		else
		{
			szKey[i] = szBuffer[n];

			i++;
		}

	}
	
    retval = TRUE;

clean0:
    if (szBuffer)
    {
        delete[] szBuffer;
        szBuffer = NULL;
    }

	return retval;
}