void ConfigLoader::Load( rsk::ConfigData& out ) { if( !OpenFile() ) return; CreateConfig( out ); ReadConfig( out ); m_Config.clear(); CheckLoadErrors( out ); }
rc_t CC KMain(int argc, char* argv[]) { rc_t rc = 0; Params prm; KConfig* cfg = NULL; if (rc == 0) { rc = ParamsConstruct(argc, argv, &prm); } if (rc == 0) { rc = KConfigMake(&cfg, NULL); DISP_RC(rc, "while calling KConfigMake"); } if (rc == 0) { if (prm.modeSetNode) { rc = SetNode(cfg, &prm); } if (prm.modeShowCfg) { rc = ShowConfig(cfg, &prm); } if (prm.modeShowFiles) { rc_t rc3 = ShowFiles(cfg, &prm); if (rc3 != 0 && rc == 0) { rc = rc3; } } if (prm.modeShowModules) { rc_t rc3 = ShowModules(cfg, &prm); if (rc3 != 0 && rc == 0) { rc = rc3; } } if (prm.modeShowLoadPath) { const char* path = NULL; rc_t rc3 = KConfigGetLoadPath(cfg, &path); if (rc3 == 0) { if (path != NULL && path[0]) { OUTMSG(("%s\n", path)); } } else if (rc == 0) { rc = rc3; } } } if (prm.modeShowEnv) { ShowEnv(&prm); } RELEASE(KConfig, cfg); if (rc == 0 && prm.modeCreate) { rc = CreateConfig(argv[0]); } ParamsDestruct(&prm); return rc; }
void MainWindow::createActions() { openAct = new QAction(tr("&Open..."), this); openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAsAct = new QAction(tr("&Save As..."), this); saveAsAct->setShortcuts(QKeySequence::SaveAs); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); addTSAct = new QAction(QString::fromUtf8("Устройство ТС"), this); connect(addTSAct, SIGNAL(triggered()), xbelTree, SLOT(AddTS())); addTSAct->setShortcut(QKeySequence(tr("Ctrl+S"))); addTITAct = new QAction(QString::fromUtf8("Устройство ТИТ"), this); connect(addTITAct, SIGNAL(triggered()), xbelTree, SLOT(AddTIT())); addTITAct->setShortcut(QKeySequence(tr("Ctrl+T"))); addTUAct = new QAction(QString::fromUtf8("Устройство ТУ"), this); connect(addTUAct, SIGNAL(triggered()), xbelTree, SLOT(AddTU())); addTUAct->setShortcut(QKeySequence(tr("Ctrl+U"))); addMQAct = new QAction(QString::fromUtf8("Счетчик Меркурий"), this); connect(addMQAct, SIGNAL(triggered()), xbelTree, SLOT(AddMQ())); addMQAct->setShortcut(QKeySequence(tr("Ctrl+Q"))); createConfig = new QAction(QString::fromUtf8("Создать конфигурацию"), this); connect(createConfig, SIGNAL(triggered()), xbelTree, SLOT(CreateConfig())); createConfig->setShortcut(QKeySequence(tr("Ctrl+M"))); saveConfig = new QAction(QString::fromUtf8("Сохранить конфигурацию"), this); connect(saveConfig, SIGNAL(triggered()), this, SLOT(saveConfigAs())); saveConfig->setShortcut(QKeySequence(tr("Shift+Ctrl+C"))); aboutAct = new QAction(tr("&About"), this); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutQtAct = new QAction(tr("About &Qt"), this); connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(xbelTree, SIGNAL(MessageToStatusBar(QString)), this, SLOT(MessageToStatusBar(QString))); }
void main(int argc, char *argv[]) { int n; memset(startdir,0,sizeof(startdir)); memset(cfgfilename,0,sizeof(cfgfilename)); ArgInit(argc, argv); VideoInit(); ShowCopyright(argc, argv); // CheckIfLocked(); ShowSysInfo(); ShowEnvInfo(); ShowMainMenu(); ShowMemory(); // CheckVersion(); ValidateConfig(); l1: ShowMemory(); SelectMainMenu(); l2: switch(mainmenu_sel) { case 0: ShowKernelMenu(); if(keycode==F2) { ShowMemory(); mainmenu_sel=1; goto l2; } else break; case 1: ShowExtenderMenu(); if(keycode==F1) { ShowMemory(); mainmenu_sel=0; goto l2; } else break; case 2: CreateConfig(); break; case 3: RestoreConfig();break; case 4: id32=id32_old; ClearConfigName(); break; case 5: DiscardExit(); break; case 6: ApplyExit(); break; } goto l1; }
BOOL SaveHighlights(HWND hwndHexView) { TCHAR szBookPath[MAX_PATH]; TCHAR szFilePath[MAX_PATH]; BOOKMARK bm; HBOOKMARK hbm; HCONFIG config, filedata, bookmarks; if (!GetBookmarkFileName(hwndHexView, NULL, szBookPath)) return FALSE; config = CreateConfig(); filedata = CreateConfigSection(config, TEXT("hexFileData")); HexView_GetFileName(hwndHexView, szFilePath, MAX_PATH); // only save if the file exists if(GetFileAttributes(szFilePath) != INVALID_FILE_ATTRIBUTES) { SetConfigStr(filedata, TEXT("filePath"), szFilePath); } bookmarks = CreateConfigSection(filedata, TEXT("bookmarks")); for(hbm = 0; (hbm = HexView_EnumBookmark(hwndHexView, hbm, &bm)) != 0; ) { if((bm.flags & HVBF_NOPERSIST) == 0) { HCONFIG bookmark = CreateConfigSection(bookmarks, TEXT("bookmark")); SetConfigStr(bookmark, TEXT("name"), bm.pszTitle); SetConfigStr(bookmark, TEXT("desc"), bm.pszText); SetConfigI64(bookmark, TEXT("offset"), bm.offset); SetConfigI64(bookmark, TEXT("length"), bm.length); SetConfigH32(bookmark, TEXT("fgcol"), bm.col); SetConfigH32(bookmark, TEXT("bgcol"), bm.backcol); } } SaveConfig(szBookPath, config); return TRUE; }
int main() { std::cout << "Aero will be disabled for performance reason!" << std::endl; DisableAeroTheme(); bool exit = false; //dit is voor later een escape variable int cap_method = D3D_CAP; float gamma = 0.6; GDICap Cap; Direct3DCap D3DCap; //init directx9 JackFFT JACK; std::ifstream myinfile; myinfile.open("./Config.txt"); //Als het bestand is geopend bestaat die al dus sla je het maken over if (!myinfile.is_open()) { myinfile.close(); std::ofstream myfile; myfile.open("./Config.txt"); CreateConfig(myfile, D3DCap); myfile.close(); myinfile.open("./Config.txt"); } std::string STRING; int Config[9] = { -1 }; for (int i = 0; i < 9; i++) { if (myinfile.eof()) break; std::getline(myinfile, STRING); Config[i] = atoi(STRING.c_str()); } myinfile.close(); //Check of config laden goed is gelukt int i = 0; while (Config[i] != -1 && i < 9) { i++; } if (i < 9) { std::cout << "Config Loading went wrong! Please delete Config.txt and run this software again!" << std::endl; return 0; } std::cout << "Using screen: " << Config[0] << " for capturing" << std::endl; D3DCap.init(Config[0]); Cap.init(Config[0]); // UINT32 *pBits; switch (cap_method) { case GDI_CAP: pBits = Cap.pBits; break; case D3D_CAP: pBits = D3DCap.pBits; break; case JAC_CAP: pBits = JACK.pBits; } ScreenCalc Scherm(105, //init de kleur bereken functies pBits, //De PixelData D3DCap.return_hres(), //De Hori Resolutie D3DCap.return_vres(), //De Verti Resolutie Config[1], //Hoeveel procent die moet nemen aan de bovenkant/onderkant Config[2], //Hoeveel procent die aan de zijkant moet nemen Config[3], //Leds Boven Config[5], //Leds Onder Config[4], //Leds Links Config[6], //Leds Rechts Config[7]); Scherm.Bereken_Grid(); //stel de hoeveelheid leds in die worden gebruikt en bereken Grid Grootte Scherm.set_Gamma(gamma); //Het programma moet eerst 0xff binnen krijgen als dat het geval is dan mag die beginnen met het oversturen //van de hoeveelheid leds //Als die hoeveelheden overeenkomen mag die beginnen met het zenden van led data std::string String; String = "\\\\.\\COM"; String += std::to_string(Config[8]); char *temp = new char[String.size() + 1]; std::copy(String.begin(), String.end(), temp); temp[String.size()] = '\0'; Serial* SP = new Serial(temp); delete[] temp; temp = nullptr; if (SP->IsConnected()) std::cout << "Connected with COM5" << std::endl; else { std::cout << "Communication Error. Exiting" << std::endl; return 0; } char Rx_buffer[100] = ""; //Dit is de Rx_buffer deze moet een char zijn //je kan hier op escape drukken om het programma af ste sluiten hier std::cout << "Waiting for Arduino. Press ESC to quit" << std::endl; SP->ReadData(Rx_buffer, 2); while (Rx_buffer[0] != '0') //blijf hier hangen tot de arduino klaar is { Sleep(100); SP->ReadData(Rx_buffer, 2); if (GetAsyncKeyState(VK_ESCAPE)) { exit = true; } if (exit == true) { std::cout << "Something went wrong with communication. Check baudrate settings and COM port" << std::endl; return 0; //beeindig de software } } Rx_buffer[0] = '0'; std::cout << "Got response from arduino sending amount of leds" << std::endl; //Stuur de hoeveelheid leds naar de arduino UINT8 Tx_buffer[600 * 3]; ZeroMemory(Tx_buffer, 600 * 3); Tx_buffer[0] = Scherm.geefLeds() >> 8 & 0x00FF; Tx_buffer[1] = Scherm.geefLeds() & 0x00FF; SP->WriteData((char*)Tx_buffer, 2); Sleep(1000); //Wacht 1 seconde op de arduino std::cout << "Press END to quit capturing" << std::endl; UINT8 *pointer; //Pointer voor de led bitstream clock_t klok1; clock_t klok2 = 50; pointer = Scherm.GeefLedPointer(); //Koppel de led bitstream aan de pointer // maak een thread die nu nog niks doet std::thread uart(send_data,SP,Rx_buffer,Scherm,pointer); while (exit == false) { //std::cout << " " << "\r"; //std::cout << "FPS: " << ((1 * CLOCKS_PER_SEC) / (clock() - klok2)) << "\r"; klok2 = clock(); if (GetAsyncKeyState(VK_END)) //Als escape is ingedrukt zet exit true { exit = true; } else if (GetAsyncKeyState(VK_F8)) { JACK.stop(); pBits = Cap.pBits; Scherm.set_data(pBits); cap_method = GDI_CAP; std::cout << "Changed capture method to GDI " << std::endl; Sleep(100); } else if (GetAsyncKeyState(VK_F9)) { JACK.stop(); pBits = D3DCap.pBits; Scherm.set_data(pBits); cap_method = D3D_CAP; std::cout << "Changed capture method to D3D " << std::endl; Sleep(100); } else if (GetAsyncKeyState(VK_F7)) { cap_method = JAC_CAP; JACK.init(pointer); std::cout << "Changed capture method to Jack Audio " << std::endl; JACK.start(); Sleep(100); } else if (GetAsyncKeyState(VK_F12)) { gamma += 0.01; Scherm.set_Gamma(gamma); } else if (GetAsyncKeyState(VK_F11)) { gamma -= 0.01; Scherm.set_Gamma(gamma); } else if (GetAsyncKeyState(VK_F10)) { std::cout << "Gamma : " << gamma << std::endl; } //start een thread die de data stuurt //Scherm.Calc_Aspect_ratio(); //Maak screenshot en sla die op switch (cap_method) { case GDI_CAP: Cap.capture(); break; case D3D_CAP: D3DCap.capture(); break; case JAC_CAP: Sleep(10); //when audio is selected everything will be handled in a different thread break; } if (cap_method != JAC_CAP) { Scherm.Bereken(); Scherm.Calc_Aspect_ratio(); } //wacht tot alle data verzonden is en we weer antwoord hebben gehad dat alles in orde is voordat we weer verder gaan } Thread_comm = 0; uart.join(); return 0; }