Example #1
0
CString Util::GetRootPath()
{
//	return ::FuncGetInstallRootPath();
      //  return "/home/siteview/chenxing/monitor";

	string path=::GetSiteViewRootPath();
	return path.c_str();
	
         char buf[100]={0};
	
	 strcpy(buf,"siteview.ini");
        INIFile inf=LoadIni(buf);
	std::string name=GetIniSetting(inf,"InstallPath","RootPath","");
	if(name.empty())
		return "D:\\v70";
	else
	   return name.c_str();
	
	

	return "/usr/local";

	return "/usr/local";

}
Example #2
0
// ---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent *Owner) : TForm(Owner) {
	IniFile = TPath::Combine(ExtractFilePath(Application->ExeName), "ttlogin++.ini");
	LangFile = TPath::Combine(ExtractFilePath(Application->ExeName), "lang.ini");

	SHFILEINFO fi;
	ImageListSmall->Handle = SHGetFileInfo(L"", 0, &fi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON);

	LoadIni();
	LangIni();
}
Example #3
0
int main(int argc, char **argv)
{
		// read an INI.  If file doesn't exist, that's OK.
		INIFile ini = LoadIni("test.ini");
		if(ini.size())
		{
			// Note that existing INIs will be added to, though if any of the keys
			// listed below already exist, this program will modify them.
			cout << "About to modify test.ini, which presently contains:\n";
			DumpIni(ini);
		}
	   
		cout << "\nLoading INI with the following information, plus comments\n\n";
		cout <<"[Favorites]\ncolor=blue\nfood=pizza\nbeer=homebrew\n\n";
		cout << "[Computing]\nOperating System=Linux\nToolkit=FLTK\nComment=Now isn't this fun?\n\n";

		PutIniSetting(ini, "", "; This is a comment about the whole INI file");
		PutIniSetting(ini, "Favorites", "; This is a list of favorites");
		PutIniSetting(ini, "Favorites", "color", "blue");
		PutIniSetting(ini, "Favorites", "food", "pizza");
		PutIniSetting(ini, "Favorites", "beer", "homebrew");
		PutIniSetting(ini, "Computing", "; Information about computing preferences");
		PutIniSetting(ini, "Computing", "Operating System", "Linux");
		PutIniSetting(ini, "Computing", "Toolkit", "FLTK");
		PutIniSetting(ini, "Computing", "Comment", "This will be replaced in next line.");
		PutIniSetting(ini, "Computing", "Comment", "Now isn't this fun?");

		cout << "\nINI Ready, saving to disk\n\n";
		SaveIni(ini, "test.ini");

		cout << "Loading from disk to verify.\n\n";
		INIFile ini2 = LoadIni("test.ini");
		
		cout << "Contents of ini just read\n\n";
		DumpIni(ini2);
		
		cout << "\nChecking single value for section Computing, key Comment:\n";
		cout << "Value is: " << GetIniSetting(ini2, "Computing", "Comment") << std::endl;
		
		cout << "\nChecking unset value for section Computing, \nkey Distribution, with default of \"RedHat\"\n";
		cout << "Value is: " << GetIniSetting(ini2, "Computing", "Distribution",  "RedHat") << "\n\nDone\n\n";
		return (0);
}
Example #4
0
MainWindow::MainWindow(QWindow *parent)
    : QQuickView(parent)
{
    setSource(QUrl::fromLocalFile("H:/VK/main.qml").toString());

    photoSize = "130";


    // !!! SET QNAM AND CACHE
    manager = new QNetworkAccessManager(this);
    cache = new QNetworkDiskCache(this);
    // 500 Mb
    cache->setMaximumCacheSize(500*1024*1024);
    cache->setCacheDirectory("cacheDir");
    manager->setCache(cache);

    // SET CACHED NAM TO QMLENGINE TO
    MyNetworkAccessManagerFactory* namFactory = new MyNetworkAccessManagerFactory();
    QQmlEngine* eng =  engine();
    eng->setNetworkAccessManagerFactory(namFactory);


    QQmlProperty((QObject*)rootObject(), "color").write("#F5F5F5");
    QQmlProperty((QObject*)rootObject(), "height").write(height());


    wallObj = rootObject();
    //wallObj->setProperty("color", "#F5F5F5");
    //wallObj->setProperty("height",height());

    connect((QObject*)wallObj, SIGNAL(login()),this,SLOT(login()));
    connect((QObject*)wallObj, SIGNAL(getGroups()),this, SLOT(getGroups()));
    connect((QObject*)wallObj, SIGNAL(getWall(QString)),this, SLOT(getWall(QString)));
    connect((QObject*)wallObj, SIGNAL(morePosts()), this, SLOT(morePosts()));
    connect((QObject*)wallObj, SIGNAL(setPhotoSize(QString)), this, SLOT(setPhotoSize(QString)));


    LoadIni("H:/VK/config.ini");
    // do we have token
    if( settings->contains("token")){
        // its a unlimit token
        qDebug() << " HAVE TOKEN ";
        if(ReadConfig("expires").toInt()==0){
            Token = ReadConfig("token").toString();
        }
        // if no doesnt it token expire
        else if(ReadConfig("expDate").toDate()<=QDate::currentDate()){
            Token = ReadConfig("token").toString();
        }
    // if havent token login
    }else{
        login();
        qDebug() << " NEED LOGIN ";
    }
}
Example #5
0
CString Util::GetSVMQAddress()
{
         char buf[1024]={0};
	
	// strcpy(buf,"siteview.ini");
	 sprintf(buf,"%s/MonitorManager/siteview.ini",GetRootPath().getText());
        INIFile inf=LoadIni(buf);
	std::string name=GetIniSetting(inf,"InstallPath","SVMQAddress","");
	if(name.empty())
	   return "127.0.0.1";
	else
	   return name.c_str();
  
}
Example #6
0
void COption::Init(CSearchToolBar& toolbar, CMainListView& listview)
{
	m_pToolBar = &toolbar;
	m_pListView = &listview;

	LoadIni();

	// Read Susie Plugin
	if (m_option.bSusieUse)
	{
		CSusie susie;
		susie.LoadSpi(m_option.SusieDir);
	}
}
Example #7
0
void TextureReplacer::NotifyConfigChanged() {
	gameID_ = g_paramSFO.GetValueString("DISC_ID");

	enabled_ = !gameID_.empty() && (g_Config.bReplaceTextures || g_Config.bSaveNewTextures);
	if (enabled_) {
		basePath_ = GetSysDirectory(DIRECTORY_TEXTURES) + gameID_ + "/";

		// If we're saving, auto-create the directory.
		if (g_Config.bSaveNewTextures && !File::Exists(basePath_ + NEW_TEXTURE_DIR)) {
			File::CreateFullPath(basePath_ + NEW_TEXTURE_DIR);
		}

		enabled_ = File::Exists(basePath_) && File::IsDirectory(basePath_);
	}

	if (enabled_) {
		enabled_ = LoadIni();
	}
}
Example #8
0
bool Util::SendMsgToWsServer(string szId, string szText)
{
	bool bRet = true;
	string errorMsg = "";
	if(sendmsg == NULL)
	{
		//Init();
		char buf[1024]={0};
		sprintf(buf,"%s/fcgi-bin/MonitorScheduleWeb.dll",GetRootPath().getText());
		//strPath = ".\\MonitorScheduleWeb.dll";
		//puts(strPath);
		HMODULE m_hWebDll=::LoadLibrary(buf);
		if(m_hWebDll==NULL)
			throw MSException("Load MonitorScheduleWeb.dll failed");
		sendmsg = (SendMsg)::GetProcAddress(m_hWebDll, "SendMsg");
		if(sendmsg == NULL)
		{
			puts("  获取dll函数失败, Failed to GetProcAddress: MonitorScheduleWeb.dll 's SendMsg;  ");
		}

		sprintf(buf,"%s/fcgi-bin/WebECC.ini",GetRootPath().getText());
		INIFile inf=LoadIni(buf);
		szServer=GetIniSetting(inf,"WebECC","WebService","");
		szPort=GetIniSetting(inf,"WebECC","WebPort","");
		//puts(szServer.c_str());
		//puts(szPort.c_str());
	}
	

	bRet = sendmsg(szId, szText, szServer, szPort, errorMsg);
	if(bRet)
	{
		puts("sendmsg sucess\n");
	}
	else
	{
		puts("sendmsg failed\n");
		puts(errorMsg.c_str());
	}
		
	return bRet;
}
Example #9
0
void CGuide::Notify(TNotifyUI& msg)
{	
	if (_tcsicmp(msg.sType, DUI_MSGTYPE_WINDOWINIT) == 0)
	{
		m_btnNext = static_cast<CButtonUI*>(m_PaintManager.FindControl(_T("btnright")));
		m_btnPrev = static_cast<CButtonUI*>(m_PaintManager.FindControl(_T("btnleft")));
		m_labelHtml = static_cast<CLabelUI*>(m_PaintManager.FindControl(_T("current")));
		m_pFrame = static_cast<CVerticalLayoutUI*>(m_PaintManager.FindControl(_T("bg")));
		ASSERT(m_btnPrev != NULL && m_btnNext != NULL && m_labelHtml != NULL && m_pFrame != NULL);

		LoadIni();
		SetGuideIndex(0);
	}
	else if (_tcsicmp(msg.sType, DUI_MSGTYPE_CLICK) == 0)
	{
		if (_tcsicmp(msg.pSender->GetName(), MY_DUILIB_BTN_CLOSE) == 0)
		{
			Close();
		}
		else if (_tcsicmp(msg.pSender->GetName(), MY_DUILIB_BTN_SURE) == 0)
		{
			Close();
		}
		else if (msg.pSender == m_btnNext)
		{
			m_nCurrent++;
			m_nCurrent %= m_nCount;

			SetGuideIndex(m_nCurrent);
		}
		else if (msg.pSender == m_btnPrev)
		{
			m_nCurrent += m_nCount;		// 用于保证当前索引为非负数
			m_nCurrent--;		
			m_nCurrent %= m_nCount;

			SetGuideIndex(m_nCurrent);
		}
	}
}
Example #10
0
bool Option::LoadOption()
{
	if(g_strRootPath.IsEmpty())
		return false;
	printf("\n");

	char filepath[1024]={0};
	sprintf(filepath,"%s/fcgi-bin/mc.config",g_strRootPath.getText());

	string svalue;
	INIFile inif=LoadIni(filepath);
	svalue=GetIniSetting(inif,"MonitorSchedule","DemoMode","");
	if(!svalue.empty())
		m_isDemo= (svalue=="true") ? true :false;
	printf("DemoMode:%d\n",m_isDemo);

	svalue.clear();
	svalue=GetIniSetting(inif,"MonitorSchedule","PreLoadLibrary","");
	if(!svalue.empty())
		m_PreLoadLibrary+=svalue+",";

	svalue.clear();
	svalue=GetIniSetting(inif,"MonitorSchedule","DemoLibrary","");
	if(!svalue.empty())
		m_DemoDLL=svalue;

	svalue.clear();
	svalue=GetIniSetting(inif,"MonitorSchedule","DemoFunction","");
	if(!svalue.empty())
		m_DemoFunction=svalue;

	svalue.clear();
	svalue=GetIniSetting(inif,"MonitorSchedule","SEID","");
	if(!svalue.empty())
	{
		m_seid=atoi(svalue.c_str());
		Univ::seid= m_seid;
	}
	printf("SEID:%d\n",m_seid);

	svalue.clear();
	svalue=GetIniSetting(inif,"MonitorSchedule","EnableAppendMassRecord","");
	if(!svalue.empty())
		Univ::enablemass=(atoi(svalue.c_str())!=0);
	printf("Enable AppendMass:%d\n",Univ::enablemass);

	svalue.clear();
	svalue=GetIniSetting(inif,"MonitorSchedule","MilliSecondBetweenAppend","");
	if(!svalue.empty())
		Univ::msappend=atoi(svalue.c_str());
	printf("MilliSecond Between AppendMass:%d\n",Univ::msappend);

	svalue.clear();
	svalue=GetIniSetting(inif,"MonitorSchedule","MonitorTreadPlusCount","");
	if(!svalue.empty())
		Univ::pluscount=atoi(svalue.c_str());
	printf("Monitor Tread Plus Count:%d\n",Univ::pluscount);

 	svalue.clear();
	svalue=GetIniSetting(inif,"information","CheckTime","");
	if(!svalue.empty())
		m_checktime=atoi(svalue.c_str());
	printf("CheckTime:%d\n",m_checktime);
   
 	svalue.clear();
	svalue=GetIniSetting(inif,"MonitorSchedule","UseLocalBuffer","");
	//char aaa[2000]={0};
	//sprintf(aaa,"file is %s,  UseLocalBuffer is  %s\n", filepath,svalue.c_str());
	//OutputDebugString(aaa);

	if(!svalue.empty())
		m_UseLocalBuffer=(svalue=="true")? true : false;
	printf("UseLocalBuffer:%d\n",m_UseLocalBuffer);



	svalue.clear();
	svalue=GetIniSetting(inif,"MonitorSchedule","ServerHost","");
	if(!svalue.empty())
		m_ServerAddress=svalue;
	printf("ServerHost:%s\n",m_ServerAddress.c_str());

 	svalue.clear();
	string svdbHostAddr=GetSvdbAddr();
	printf("SvdbHostAddr:%s\n",svdbHostAddr.c_str());
	printf("PreLoadLibrary: %s\n",m_PreLoadLibrary.c_str());
	printf("\n");
	return true;
}
Example #11
0
// ---------------------------------------------------------------------------
void __fastcall TForm1::btnApplyClick(TObject *Sender) {
	SaveIni();
	LoadIni();
	InitMenu();
}
Example #12
0
/// Constructor
CLastDir::CLastDir()
{
	LoadIni();
}
Example #13
0
//初始化
bool CServerGameDesk::InitDeskGameStation()
{
	LoadIni();		//加载配置文件
	LoadExtIni(m_pDataManage->m_InitData.uRoomID);	//重新加载配置文件里面的
	return true;
}
Example #14
0
/*  main - top-level driver
 *
 */
int main (int c, char *v[])
{
    char szname[MAX_PATH];
    BOOL fFilesOnly = FALSE;

    LoadIni ();

    SHIFT (c, v);

    if (c == 0) {
	printf ("Symref: Server = %s\n", szServer);
	printf ("        Scope = '%s'\n", szScope);
	}
    else
	while (c) {
	    if (!strcmp (*v, "-d") && c >= 2) {
		SHIFT (c, v);
		SRSendNewDatabase (*v);
		}
	    else
	    if (!strcmp (*v, "-f"))
		fFilesOnly = TRUE;
	    else
	    if (!strcmp (*v, "-i")) {
		SHIFT (c, v);
		while (c != 0 && (*v[0] != '-' || !strcmp (*v, "-"))) {
		    if (!strcmp (*v, "-")) {
			while (fgetl (szname, MAX_PATH, stdin))
			    if (strlen (szname) != 0)
				SRSendAddDirectory (szname);
			}
		    else
			SRSendAddDirectory (*v);
		    SHIFT (c, v);
		    }
		continue;
		}
	    else
	    if (!strcmp (*v, "-ig")) {
		SHIFT (c, v);
		while (c != 0 && (*v[0] != '-' || !strcmp (*v, "-"))) {
		    if (!strcmp (*v, "-")) {
			while (fgetl (szname, MAX_PATH, stdin))
			    if (strlen (szname) != 0)
				SRSendNoiseWord (szname);
			}
		    else
			SRSendNoiseWord (*v);
		    SHIFT (c, v);
		    }
		continue;
		}
	    else
	    if (!strcmp (*v, "-ie")) {
		SHIFT (c, v);
		while (c != 0 && (*v[0] != '-' || !strcmp (*v, "-"))) {
		    if (!strcmp (*v, "-")) {
			while (fgetl (szname, MAX_PATH, stdin))
			    if (strlen (szname) != 0)
				SRSendAddExtention (szname);
			}
		    else
			SRSendAddExtention (*v);
		    SHIFT (c, v);
		    }
		continue;
		}
	    else
	    if (!strcmp (*v, "-s") && c >= 2) {
		SHIFT (c, v);

		WriteProfileString (PSZAPPNAME, PSZSCOPE, *v);
		LoadIni ();
		}
	    else
	    if (!strcmp (*v, "-S") && c >= 2) {
		SHIFT (c, v);

		WriteProfileString (PSZAPPNAME, PSZSERVER, *v);
		LoadIni ();
		}
	    else
	    if (!strcmp (*v, "-shutdown"))
		SRSendShutdown ();
	    else
	    if (!strcmp (*v, "-sync"))
		SRSendSync ();
	    else
	    if (*v[0] == '-')
		Usage ();
	    else
		SRSendSymLocate (*v, fFilesOnly, szScope);

	    SHIFT (c, v);
	    }
    return 0;
}