/** @brief Loads the settings from file. */ void SettingsSerializer::load() { if (isSerializedFormat(path)) readSerialized(); else readIni(); }
void Converter_GetFlacPath(wchar_t *buf, int bufsz) { wchar_t ini[MAX_PATH]; exeDir(ini, ARRAYSIZE(ini)); lstrcat(ini, L"FlacLameGui.ini"); readIni(ini, L"Tools", L"flac", buf, bufsz); }
/*==================================================================*/ void ModifyStation::initModifyStation(int no) { setModal(true); setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint); //setAttribute(Qt::WA_DeleteOnClose); this->setAutoFillBackground(true); QPalette palette; palette.setColor(QPalette::Background, QColor(35,202,255)); this->setPalette(palette); QPainterPath path; QRectF rect = QRectF(this->rect()); path.addRoundRect(rect,10,10); QPolygon polygon= path.toFillPolygon().toPolygon(); QRegion region(polygon); setMask(region); //当点击确定时,执行的槽函数为ok connect(ui.okButton, SIGNAL(clicked()), this, SLOT(ok())); //记录当前焦点所在采集站的编号 index = no; //读取已有的配置或增加新配置 readIni(no); }
UINT32 ParamManager::GetParam(INI_DEVICE_VALUE eValue) { static std::map< std::string, UINT32 > paramTable; if(paramTable.empty() == true) { memset(m_nDeviceVal, 0xFFFFFFFF, sizeof(m_nDeviceVal)); assert(_inipath[INI_DEVICE].empty() == false); readIni(_inipath[INI_DEVICE], paramTable); std::map< std::string, UINT32 >::iterator it = paramTable.begin(); for(; it != paramTable.end(); it++) { for(int i = 0; gParamTypes[i].szTypeIniName[0] != '\0'; i++) { if(gParamTypes[i].bIsEnv == FALSE && !it->first.compare(gParamTypes[i].szTypeIniName)) { m_nDeviceVal[gParamTypes[i].eDeviceValue] = it->second; gParamTypes[i].bValueExist = TRUE; break; } } } if(m_nDeviceVal[ISV_CLOCK_PERIODS] == 0) m_nDeviceVal[ISV_CLOCK_PERIODS] = 1; if(m_nDeviceVal[ISV_NUMS_PLANE] == 0) m_nDeviceVal[ISV_NUMS_PLANE] = 2; if(m_nDeviceVal[ISV_NUMS_DIE] == 0) m_nDeviceVal[ISV_NUMS_DIE] = 2; } return m_nDeviceVal[eValue]; }
UINT32 ParamManager::GetEnv(INI_ENV_VALUE eValue) { static std::map< std::string, UINT32 > paramTable; if(paramTable.empty() == true) { memset(m_nEnvVal, 0xFFFFFFFF, sizeof(m_nEnvVal)); assert(_inipath[INI_ENVIRONMENT].empty() == false); readIni(_inipath[INI_ENVIRONMENT], paramTable); std::map< std::string, UINT32 >::iterator it = paramTable.begin(); for(; it != paramTable.end(); it++) { for(int i = 0; gParamTypes[i].szTypeIniName[0] != '\0'; i++) { if(gParamTypes[i].bIsEnv == TRUE && !it->first.compare(gParamTypes[i].szTypeIniName)) { m_nEnvVal[gParamTypes[i].eEnvValue] = it->second; gParamTypes[i].bValueExist = TRUE; break; } } } } return m_nEnvVal[eValue]; }
MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent), m_ui(new Ui::MainWindow){ readIni(); m_bTCPErr=true; m_userCntr=new UserDBController(this,m_strDBPath,m_strDBHost); prepareView(); prepareSiSlo(); prepareUsersData(); startListenTcp(); prepareTbl(); }
/** * waitcmd.c * * moniters files and invokescertain commands when accessed or modified. * If no command line argumants are given then commands are read from the * waitcmd.ini file and monitoring starts for all files mentioned. * If command line argumants are given then they are added to the ini file. * If an instance of waitcmd is already running then it will be refreshed * to include the new commands. * Monitoring is not started when new commands are given. */ int main (int argc, char *argv[]) { if(argc > 1) { if(argv[1] == "-h") printHelp(); else addToIni(argc, argv); } else readIni() runMonitor(); printf("Monitoring files (for help type \"waitcmd -h\")\n"); return 0; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf-8")); _storagePath=readIni(); _xmlwriter=new XmlIO(_storagePath+"data.xml"); _projects=new QVector<Project>(); Reader::readXmlContents(*_projects,_storagePath+"data.xml"); connect(ui->pushButton_4,SIGNAL(clicked()),this,SLOT(deleteConfirm())); connect(ui->pushButton_3,SIGNAL(clicked()),this,SLOT(showRenamingForm())); connect(ui->pushButton_2,SIGNAL(clicked()),this,SLOT(showVersionList())); connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(showProjectCreatingForm())); connect(ui->action,SIGNAL(triggered(bool)),this,SLOT(showProjectCreatingForm())); connect(ui->action_2,SIGNAL(triggered(bool)),this,SLOT(showVersionList())); connect(ui->action_3,SIGNAL(triggered(bool)),this,SLOT(showRenamingForm())); connect(ui->action_4,SIGNAL(triggered(bool)),this,SLOT(deleteConfirm())); updateProjectsList(); }
int main (int argc, char *argv[]) { /* HWND hwndGrab; */ HAB hab; HMQ hmq; QMSG qmsg; SWCNTRL swctl={0}; PID pid; HWND hwndFrame; short a; FILE *file; char logText[CCHMAXPATH]; char text[CCHMAXPATH+10]; char title[CCHMAXPATH]; /* Create a copy of the args */ /* argv[0]: progname * argv[1]: installdir of Audio-CD-Creator * argv[2]: foldername * argv[3]: filelist file * argv[4]: Parameter file */ numArgs=argc; for(a=0;a<argc;a++) { params[a]=argv[a]; } removeLog(); hab=WinInitialize(0); if(hab) { hmq=WinCreateMsgQueue(hab,0); if(hmq) { writeLog("\""); writeLog(argv[0]); writeLog("\" started with the following parameters:\n\n"); for(a=0;a<argc;a++) { snprintf(logText,sizeof(logText),"%d: %s\n",a,argv[a]); writeLog(logText); } writeLog("\n\n"); /* Check if user started prog by hand */ if(argc<5) pmUsage(); else { /* Get our ressource dll */ RESSOURCEHANDLE=queryResModuleHandle(); /* Graphics are bound to the class DLL */ CLASSDLLHANDLE=queryClassDLLModuleHandle(argv[1]); /* Load options from cdrecord.ini */ readIni(); /* load background bitmap */ _loadBmps(CLASSDLLHANDLE); if(readWindowPosFromIni(chrInstallDir, "pmthefly")) bHaveWindowPos=TRUE; if(checkSettings()) { if((ptrLocalMem=malloc(SHAREDMEM_SIZE))!=NULLHANDLE) { if((file=fopen(argv[4],"rb"))!=NULL){ /* Copy command line to local memory */ fread(ptrLocalMem, sizeof(char), SHAREDMEM_SIZE, file); fclose(file); /* Register the percent bar window class */ percentRegisterBarClass(); if( WinDlgBox( HWND_DESKTOP, NULLHANDLE, onTheFlyStatusDialogProc, RESSOURCEHANDLE, IDDLG_CHECKSTATUS, 0 ) == DID_ERROR ) { if(ptrLocalMem) free(ptrLocalMem); DosBeep(100,600); errorResource2("Problem with Audio/Data-CD-Creator installation"); WinDestroyMsgQueue( hmq ); WinTerminate( hab ); return( 1 ); } writeWindowPosToIni(chrInstallDir, "pmthefly"); } } else { /* Text: "Can't alloc shared memory! Aborting..." Title: "On the fly writing" */ messageBox( text, IDSTRPM_ALLOCSHAREDMEMERROR , sizeof(text), title, IDSTRD_ONTHEFLYTITLE, sizeof(title), RESSOURCEHANDLE, HWND_DESKTOP, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE); } }/* if(checkSettings) */ freeClassDLLHandle(); freeResHandle(); } WinDestroyMsgQueue(hmq); } WinTerminate(hab); } if(ptrLocalMem) free(ptrLocalMem); if(argc>=5) { remove(params[3]); remove(params[4]); } return 0; }
int main (int argc, char *argv[]) { HAB hab; HMQ hmq; QMSG qmsg; SWCNTRL swctl={0}; PID pid; HWND hwndFrame; short a; char logText[CCHMAXPATH]; /* Create a copy of the args */ /* argv[0]: progname * argv[1]: installdir of Audio-CD-Creator * argv[2]: foldername * argv[3]: imagename * argv[4]: if 1, a generic mount is requested. Change the title of the dialog and the text. */ numArgs=argc; for(a=0;a<argc;a++) { params[a]=argv[a]; } hab=WinInitialize(0); if(hab) { hmq=WinCreateMsgQueue(hab,0); if(hmq) { /* Check if user started prog by hand */ if(argc<4) pmUsage(); else { /* Save installation directory */ strcpy(chrInstallDir,params[1]); /* Delete logfile */ removeLog(); writeLog("\""); writeLog(argv[0]); writeLog("\" started with the following parameters:\n"); for(a=0;a<argc;a++) { snprintf(logText,sizeof(logText),"%d: %s\n",a,argv[a]); writeLog(logText); } writeLog("\n"); /* Get our ressource dll */ RESSOURCEHANDLE=queryResModuleHandle(); /* Load options from cdrecord.ini */ readIni(); if(readWindowPosFromIni(chrInstallDir, "pmunmnt")) bHaveWindowPos=TRUE; /* if(readIni()) {*/ if( WinDlgBox( HWND_DESKTOP, NULLHANDLE, unmountIsoDialogProc, RESSOURCEHANDLE, IDDLG_UNMOUNT, 0 ) == DID_ERROR ) { DosBeep(100,600); errorResource2("Problem with Audio/Data-CD-Creator installation"); WinDestroyMsgQueue( hmq ); WinTerminate( hab ); return( 1 ); } writeWindowPosToIni(chrInstallDir, "pmunmnt"); freeResHandle(); } WinDestroyMsgQueue(hmq); } WinTerminate(hab); } return 0; }
int main(int argc, char **argv) { char http[HTTPRESULT] = { 0 }; char **list = NULL, **coolProxies = NULL, **sourceProxies = NULL; char ownIp[IPSIZE]; size_t sizeSources = 0,sizeCoolProxies = 0, sizeList = 0; int i = 0; CURL *curl; if(argc != 1) usage(argv); fprintf(stdout, "\nDcLabs 2010 - CoolProxy %s", VERSION); fprintf(stdout, "\n Retrieving and testing proxies...\n"); /* * READING CONFIGURATION FILE */ if(sourceProxies == NULL) { sourceProxies = malloc(sizeof(int)); sourceProxies[0] = strdup(DEFAULTSITE); sizeSources++; } readIni(&sizeSources, sourceProxies); /* * GETTING OWN IP */ getOwnIp(ownIp); /* * LOOP THAT GET AND TEST PROXIES */ curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)http); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, readCurl); for(i = 0; i < sizeSources; i++) { /* * GETTING PROXIES */ curl_easy_setopt(curl, CURLOPT_URL, sourceProxies[i]); curl_easy_perform(curl); if(http == NULL) continue; /* * FILTERING THE IP's FROM HTTP RESPONSE */ list = regexFilter(http, &sizeList, IPPORT_REGEXP); /* * TESTING PROXIES */ coolProxies = testProxies(list, sizeList, &sizeCoolProxies, ownIp); /* * RESET TO NEXT ROUND */ if(list != NULL) freeReallocd(list, sizeList); if(coolProxies != NULL) freeReallocd(coolProxies, sizeCoolProxies); sizeCoolProxies = 0; sizeList = 0; } /* * FREEING MEMORY ALLOC'ED BY regexFilter() */ freeReallocd(sourceProxies, sizeSources); curl_easy_cleanup(curl); return 0; }