void DisplaySettings::fromSettings(const QString &category, const QSettings *s) { QString group = QLatin1String(groupPostfix); if (!category.isEmpty()) group.insert(0, category); group += QLatin1Char('/'); *this = DisplaySettings(); // Assign defaults m_displayLineNumbers = s->value(group + QLatin1String(displayLineNumbersKey), m_displayLineNumbers).toBool(); m_textWrapping = s->value(group + QLatin1String(textWrappingKey), m_textWrapping).toBool(); m_visualizeWhitespace = s->value(group + QLatin1String(visualizeWhitespaceKey), m_visualizeWhitespace).toBool(); m_displayFoldingMarkers = s->value(group + QLatin1String(displayFoldingMarkersKey), m_displayFoldingMarkers).toBool(); m_highlightCurrentLine = s->value(group + QLatin1String(highlightCurrentLineKey), m_highlightCurrentLine).toBool(); m_highlightBlocks = s->value(group + QLatin1String(highlightBlocksKey), m_highlightBlocks).toBool(); m_animateMatchingParentheses = s->value(group + QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses).toBool(); m_highlightMatchingParentheses = s->value(group + QLatin1String(highlightMatchingParenthesesKey), m_highlightMatchingParentheses).toBool(); m_markTextChanges = s->value(group + QLatin1String(markTextChangesKey), m_markTextChanges).toBool(); m_autoFoldFirstComment = s->value(group + QLatin1String(autoFoldFirstCommentKey), m_autoFoldFirstComment).toBool(); m_centerCursorOnScroll = s->value(group + QLatin1String(centerCursorOnScrollKey), m_centerCursorOnScroll).toBool(); m_openLinksInNextSplit = s->value(group + QLatin1String(openLinksInNextSplitKey), m_openLinksInNextSplit).toBool(); m_displayFileEncoding = s->value(group + QLatin1String(displayFileEncodingKey), m_displayFileEncoding).toBool(); m_scrollBarHighlights = s->value(group + QLatin1String(scrollBarHighlightsKey), m_scrollBarHighlights).toBool(); m_animateNavigationWithinFile = s->value(group + QLatin1String(animateNavigationWithinFileKey), m_animateNavigationWithinFile).toBool(); m_animateWithinFileTimeMax = s->value(group + QLatin1String(animateWithinFileTimeMaxKey), m_animateWithinFileTimeMax).toInt(); m_displayAnnotations = s->value(group + QLatin1String(displayAnnotationsKey), m_displayAnnotations).toBool(); m_annotationAlignment = static_cast<TextEditor::AnnotationAlignment>( s->value(group + QLatin1String(annotationAlignmentKey), static_cast<int>(m_annotationAlignment)).toInt()); m_minimalAnnotationContent = s->value(group + QLatin1String(minimalAnnotationContentKey), m_minimalAnnotationContent).toInt(); }
void DisplaySettings::fromSettings(const QString &category, const QSettings *s) { QString group = QLatin1String(groupPostfix); if (!category.isEmpty()) group.insert(0, category); group += QLatin1Char('/'); *this = DisplaySettings(); // Assign defaults m_displayLineNumbers = s->value(group + QLatin1String(displayLineNumbersKey), m_displayLineNumbers).toBool(); m_textWrapping = s->value(group + QLatin1String(textWrappingKey), m_textWrapping).toBool(); m_showWrapColumn = s->value(group + QLatin1String(showWrapColumnKey), m_showWrapColumn).toBool(); m_wrapColumn = s->value(group + QLatin1String(wrapColumnKey), m_wrapColumn).toInt(); m_visualizeWhitespace = s->value(group + QLatin1String(visualizeWhitespaceKey), m_visualizeWhitespace).toBool(); m_displayFoldingMarkers = s->value(group + QLatin1String(displayFoldingMarkersKey), m_displayFoldingMarkers).toBool(); m_highlightCurrentLine = s->value(group + QLatin1String(highlightCurrentLineKey), m_highlightCurrentLine).toBool(); m_highlightBlocks = s->value(group + QLatin1String(highlightBlocksKey), m_highlightBlocks).toBool(); m_animateMatchingParentheses = s->value(group + QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses).toBool(); m_highlightMatchingParentheses = s->value(group + QLatin1String(highlightMatchingParenthesesKey), m_highlightMatchingParentheses).toBool(); m_markTextChanges = s->value(group + QLatin1String(markTextChangesKey), m_markTextChanges).toBool(); m_autoFoldFirstComment = s->value(group + QLatin1String(autoFoldFirstCommentKey), m_autoFoldFirstComment).toBool(); m_centerCursorOnScroll = s->value(group + QLatin1String(centerCursorOnScrollKey), m_centerCursorOnScroll).toBool(); m_openLinksInNextSplit = s->value(group + QLatin1String(openLinksInNextSplitKey), m_openLinksInNextSplit).toBool(); m_displayFileEncoding = s->value(group + QLatin1String(displayFileEncodingKey), m_displayFileEncoding).toBool(); }
int main(void) { char *currenttime; /* current time/date string */ int old_sec = 0; // int cur_hour = 0; /* current hour */ // int cur_day = 0; /* current current day */ int result = 0; int key = 0; Initialise(); // turn outputs on and off for 1 second InitDisplay(); int keepgoing = 1; /* tells program to keep running until ESC pressed */ while ( keepgoing == 1 ) { currenttime = thetime(); /* get the current time */ cur_sec = extract_num(currenttime, 18, 2); /* extract minute */ cur_min = extract_num(currenttime, 15, 2); /* extract minute */ cur_hour = extract_num(currenttime, 12,2); /* extract hour */ //cur_day = extract_num(currenttime, 9, 2); /* extract day */ if(old_sec != cur_sec) { /* only update screen once per second */ ReadAnalogInputs(3); DisplayAnalogValues(3); ReadDigitalInputs(3); DisplayDigitalInputs(3); locate( 25, 56); color(CF_SETTINGS,CB_SETTINGS); cprintf(currenttime); /* update current time on screen */ //locate(20,1);cprintf("cur_min=%d",cur_min); old_sec = cur_sec; // EVENTS (new function) //OutputBit(0,valueInput[0]); //OutputBit(1,valueInput[1]); //OutputBit(2,valueInput[2]); //OutputBit(3,valueInput[3]); if (valueInput[1] == 1) { WritePort(1); DisplayPort(1,XOUTPUT,YOUTPUT); } if (valueAnalog[0] < 50) { WritePort(16); DisplayPort(16,XOUTPUT,YOUTPUT); } Log("e:\\user\\c\\a_pcio\\logfile.log", currenttime); } if( kbhit() ) { result = getkeypressed(); /* get a single keypress */ switch (result) { /* perform task user pressed */ case 27: { /* ESC */ Message( "Do you really want to quit? (Y/n) " , 0); key = getch(); if( ( key == 'Y') || (key =='y') || (key == 13) ) keepgoing = 0; /* stop program execution */ Message("", 0); } break; case 59: { /* F1 */ Message("Initialising",0); Message("Fast Pulse", 0); Pulse(255, gPulse_fast); } break; case 60: { /* F2 */ Message("Storage CRO - enter settings", 0); //getch(); gotoHiResMode(); DrawOscilliscopeScreen(50,0,550,255,50,51); StorageOscilliscope("waiting for trigger", 1, 0, 220, 40, 0, 499); InitDisplay(); } break; case 61: { /* F3 */ gotoHiResMode(); DrawOscilliscopeScreen(100,100,355,355,20,32); Oscilliscope(); InitDisplay(); Message("Oscilliscope", 0); Pulse(255, gPulse_slow); } break; case 62: { /* F4 */ Message("BinaryCount", 0); BinaryCount(gCounter); } break; case 63: { /* F5 */ Message("Chase Multiple", 0); ChaseMultiple(gIterations, gSpeed); } break; case 64: { /* F6 */ Message("Chase Up", 0); Chase(gSpeed, 0, 7); } break; case 65: { /* F7 */ Message("Chase Down", 0); Chase(gSpeed, 7,0); } break; case 66: { /* F8 */ Message("Reading Analog inputs", 0); ReadAnalogInputs(3); DisplayAnalogValues(3); ReadDigitalInputs(3); DisplayDigitalInputs(3); } break; case 67: { /* F9 */ Message("Logging - PRESS A KEY TO STOP", 0); FastAcquisition("e:\\user\\c\\a_pcio\\fastlog.log", currenttime); Message("Done Logging to e:\user\c\a_pcio\fastlog.log", 0); } break; case 68: { /* F10 */ Message("Setup", 0); //locate(12,65); scanf("%d", &gPORT); // port change locate(11, 62); color(CF_SETTINGS,CB_SETTINGS); // color(YELLOW,BLACK); cprintf("Enter new settings"); locate(13,75); scanf("%d", &gCounter); // port change if(gCounter<0||gCounter>999) gCounter=10; else fflush(stdin); locate(14,75); scanf("%d", &gSpeed); // port change if(gSpeed<0||gSpeed>999) gSpeed=10; else fflush(stdin); locate(15,75); scanf("%d", &gPulse_fast); // port change if(gPulse_fast<0||gPulse_fast>999) gPulse_fast=10; else fflush(stdin); locate(16,75); scanf("%d", &gPulse_slow); // port change if(gPulse_slow<0||gPulse_slow>999) gPulse_slow=10; else fflush(stdin); locate(17,75); scanf("%d", &gIterations); // port change if(gIterations<0||gIterations>999) gIterations=10; else fflush(stdin); DisplaySettings(XSETTINGS,YSETTINGS); } break; case 48: { OutputBit(0,2); DisplayPort(1,XOUTPUT,YOUTPUT); } break; case 49: { OutputBit(1,2); DisplayPort(2,XOUTPUT,YOUTPUT); } break; case 50: { OutputBit(2,2); DisplayPort(4,XOUTPUT,YOUTPUT); } break; case 51: { OutputBit(3,2); DisplayPort(16,XOUTPUT,YOUTPUT); } break; case 52: { OutputBit(4,2); DisplayPort(32,XOUTPUT,YOUTPUT); } break; case 53: { OutputBit(5,2); DisplayPort(64,XOUTPUT,YOUTPUT); } break; case 54: { OutputBit(6,2); DisplayPort(128,XOUTPUT,YOUTPUT); } break; case 55: { OutputBit(7,2); DisplayPort(255,XOUTPUT,YOUTPUT); } break; case 43: { WritePort(++valueOutput[0]); } break; case 45: { WritePort(--valueOutput[0]); } break; } } } return 0; }
/** Function for 'sermode' command. @param[in] ImageHandle Handle to the Image (NULL if Internal). @param[in] SystemTable Pointer to the System Table (NULL if Internal). **/ SHELL_STATUS EFIAPI ShellCommandRunSerMode ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; SHELL_STATUS ShellStatus; UINTN Index; UINTN NoHandles; EFI_HANDLE *Handles; EFI_PARITY_TYPE Parity; EFI_STOP_BITS_TYPE StopBits; UINTN HandleIdx; UINTN BaudRate; UINTN DataBits; UINTN Value; EFI_SERIAL_IO_PROTOCOL *SerialIo; LIST_ENTRY *Package; CHAR16 *ProblemParam; CONST CHAR16 *Temp; UINT64 Intermediate; ShellStatus = SHELL_SUCCESS; HandleIdx = 0; Parity = DefaultParity; Handles = NULL; NoHandles = 0; Index = 0; Package = NULL; Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); if (EFI_ERROR(Status)) { if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"sermode", ProblemParam); FreePool(ProblemParam); ShellStatus = SHELL_INVALID_PARAMETER; } else { ASSERT(FALSE); } } else { if (ShellCommandLineGetCount(Package) < 6 && ShellCommandLineGetCount(Package) > 2) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"sermode"); ShellStatus = SHELL_INVALID_PARAMETER; } else if (ShellCommandLineGetCount(Package) > 6) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"sermode"); ShellStatus = SHELL_INVALID_PARAMETER; } else { Temp = ShellCommandLineGetRawValue(Package, 1); if (Temp != NULL) { Status = ShellConvertStringToUint64(Temp, &Intermediate, TRUE, FALSE); HandleIdx = (UINTN)Intermediate; Temp = ShellCommandLineGetRawValue(Package, 2); if (Temp == NULL) { ShellStatus = DisplaySettings (HandleIdx, TRUE); goto Done; } } else { ShellStatus = DisplaySettings (0, FALSE); goto Done; } Temp = ShellCommandLineGetRawValue(Package, 2); if (Temp != NULL) { BaudRate = ShellStrToUintn(Temp); } else { ASSERT(FALSE); BaudRate = 0; } Temp = ShellCommandLineGetRawValue(Package, 3); if (Temp == NULL || StrLen(Temp)>1) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp); ShellStatus = SHELL_INVALID_PARAMETER; } else { switch(Temp[0]){ case 'd': case 'D': Parity = DefaultParity; break; case 'n': case 'N': Parity = NoParity; break; case 'e': case 'E': Parity = EvenParity; break; case 'o': case 'O': Parity = OddParity; break; case 'm': case 'M': Parity = MarkParity; break; case 's': case 'S': Parity = SpaceParity; break; default: ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp); ShellStatus = SHELL_INVALID_PARAMETER; goto Done; } } Temp = ShellCommandLineGetRawValue(Package, 4); if (Temp != NULL) { DataBits = ShellStrToUintn(Temp); } else { // // make sure this is some number not in the list below. // DataBits = 0; } switch (DataBits) { case 4: case 7: case 8: break; default: ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp); ShellStatus = SHELL_INVALID_PARAMETER; goto Done; } Temp = ShellCommandLineGetRawValue(Package, 5); Value = ShellStrToUintn(Temp); switch (Value) { case 0: StopBits = DefaultStopBits; break; case 1: StopBits = OneStopBit; break; case 2: StopBits = TwoStopBits; break; case 15: StopBits = OneFiveStopBits; break; default: ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp); ShellStatus = SHELL_INVALID_PARAMETER; goto Done; } Status = gBS->LocateHandleBuffer(ByProtocol, &gEfiSerialIoProtocolGuid, NULL, &NoHandles, &Handles); if (EFI_ERROR (Status)) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NO_FOUND), gShellDebug1HiiHandle, L"sermode"); ShellStatus = SHELL_INVALID_PARAMETER; goto Done; } for (Index = 0; Index < NoHandles; Index++) { if (ConvertHandleIndexToHandle (HandleIdx) != Handles[Index]) { continue; } Status = gBS->HandleProtocol (Handles[Index], &gEfiSerialIoProtocolGuid, (VOID**)&SerialIo); if (!EFI_ERROR (Status)) { Status = SerialIo->SetAttributes ( SerialIo, (UINT64) BaudRate, SerialIo->Mode->ReceiveFifoDepth, SerialIo->Mode->Timeout, Parity, (UINT8) DataBits, StopBits ); if (EFI_ERROR (Status)) { if (Status == EFI_INVALID_PARAMETER) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_UNSUPPORTED), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex(Handles[Index])); ShellStatus = SHELL_UNSUPPORTED; } else if (Status == EFI_DEVICE_ERROR) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_DEV_ERROR), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex(Handles[Index])); ShellStatus = SHELL_ACCESS_DENIED; } else { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_FAIL), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex(Handles[Index])); ShellStatus = SHELL_ACCESS_DENIED; } } else { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_HANDLE), gShellDebug1HiiHandle, ConvertHandleToHandleIndex(Handles[Index])); } break; } } } } if (ShellStatus == SHELL_SUCCESS && Index == NoHandles) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_BAD_HANDLE), gShellDebug1HiiHandle, L"sermode", HandleIdx); ShellStatus = SHELL_INVALID_PARAMETER; } Done: if (Package != NULL) { ShellCommandLineFreeVarList (Package); } if (Handles != NULL) { FreePool (Handles); } return ShellStatus; }
void Address::HandleMessage(Message* pcMessage) { switch (pcMessage->GetCode()) { case M_SELECTION: { String cUrl; String cCurrent = pcAddressDrop->GetCurrentString(); if (cCurrent.size() > 0) { if (cCurrent == "help") { DisplayHelp(); return; } else if (cCurrent == "about") { DisplayAbout(); return; } else if (cCurrent == "settings") { DisplaySettings(); return; } else if (cCurrent == "clear") { ClearBuffer(); } else if (cCurrent.substr(0,11) == "http://www." || cCurrent.substr(0,7) == "http://" || cCurrent.substr(0,1) == "/") { cUrl = cCurrent; ExecuteBrowser(cUrl); AddToBuffer(cUrl); } else if (cCurrent.substr(0,4) == "www.") { cUrl = String("http://") + cCurrent; ExecuteBrowser(cUrl); AddToBuffer(cUrl); } else { for (int i=0; i<cSites.size(); i++) { if (cCurrent.substr(0,cSites[i].first.size()) == cSites[i].first) { cUrl = cSites[i].second + String(cCurrent.substr(cSites[i].first.size(),cCurrent.size())); ExecuteBrowser(cUrl); AddToBuffer(cCurrent); return; } } cUrl = cSites[nDefault].second + cCurrent; ExecuteBrowser(cUrl); AddToBuffer(cUrl); } } break; } case M_HELP: DisplayHelp(); break; case M_SETTINGS: DisplaySettings(); break; case M_ADDRESS_ABOUT: DisplayAbout(); break; case M_SETTINGS_PASSED: pcMessage->FindInt32("default",&nDefault); ReloadAddresses(); pcSettingsWindow->PostMessage(M_TERMINATE,pcSettingsWindow); pcSettingsWindow = NULL; break; case M_SETTINGS_CANCEL: pcSettingsWindow->PostMessage(M_TERMINATE,pcSettingsWindow); pcSettingsWindow = NULL; break; } }
void CConsole::Process( int c ) { char outputline[128], temp[1024]; bool kill = false; int indexcount = 0; int j; int keyresp; CSocket *tSock = NULL; if( c == '*' ) { if( cwmWorldState->GetSecure() ) messageLoop << "Secure mode disabled. Press ? for a commands list"; else messageLoop << "Secure mode re-enabled"; cwmWorldState->SetSecure( !cwmWorldState->GetSecure() ); return; } else { if( cwmWorldState->GetSecure() ) { messageLoop << "Secure mode prevents keyboard commands! Press '*' to disable"; return; } JSCONSOLEKEYMAP_ITERATOR toFind = JSKeyHandler.find( c ); if( toFind != JSKeyHandler.end() ) { if( toFind->second.isEnabled ) { cScript *toExecute = JSMapping->GetScript( toFind->second.scriptID ); if( toExecute != NULL ) { // All commands that execute are of the form: command_commandname (to avoid possible clashes) #if defined( UOX_DEBUG_MODE ) Print( "Executing JS keystroke %c %s\n", c, toFind->second.cmdName.c_str() ); #endif toExecute->CallParticularEvent( toFind->second.cmdName.c_str(), NULL, 0 ); } return; } } switch( c ) { case '!': // Force server to save accounts file messageLoop << "CMD: Saving Accounts... "; Accounts->Save(); messageLoop << MSG_PRINTDONE; break; case '@': // Force server to save all files.(Manual save) messageLoop << MSG_WORLDSAVE; break; case 'Y': std::cout << "System: "; while( !kill ) { keyresp = cl_getch(); switch( keyresp ) { case -1: // no key pressed case 0: break; case 0x1B: memset( outputline, 0x00, sizeof( outputline ) ); indexcount = 0; kill = true; std::cout << std::endl; messageLoop << "CMD: System broadcast canceled."; break; case 0x08: --indexcount; if( indexcount < 0 ) indexcount = 0; else std::cout << "\b \b"; break; case 0x0A: case 0x0D: outputline[indexcount] = 0; messageLoop.NewMessage( MSG_CONSOLEBCAST, outputline ); indexcount = 0; kill = true; std::cout << std::endl; sprintf( temp, "CMD: System broadcast sent message \"%s\"", outputline ); memset( outputline, 0x00, sizeof( outputline ) ); messageLoop << temp; break; default: if( static_cast<size_t>(indexcount) < sizeof( outputline ) ) { outputline[indexcount++] = (UI08)(keyresp); std::cout << (char)keyresp; } break; } keyresp = 0x00; } break; case '[': { // We want to group all the contents of the multimap container numerically by group. We rely on the self ordering in the multimap implementation to do this. messageLoop << " "; messageLoop << "Auto-AddMenu Statistics"; messageLoop << " "; char szBuffer[128]; // We need to get an iteration into the map first of all the top level ULONGs then we can get an equal range. std::map< UI32, UI08 > localMap; localMap.clear(); for( ADDMENUMAP_CITERATOR CJ = g_mmapAddMenuMap.begin(); CJ != g_mmapAddMenuMap.end(); CJ++ ) { // check to see if the group id has been checked already if( localMap.find( CJ->first ) == localMap.end() ) { localMap.insert( std::make_pair( CJ->first, 0 ) ); memset( szBuffer, 0x00, sizeof( szBuffer ) ); sprintf( szBuffer, "AddMenuGroup %lu:", CJ->first ); messageLoop << szBuffer; std::pair< ADDMENUMAP_CITERATOR, ADDMENUMAP_CITERATOR > pairRange = g_mmapAddMenuMap.equal_range( CJ->first ); int count = 0; for( ADDMENUMAP_CITERATOR CI=pairRange.first;CI != pairRange.second; CI++ ) { count++; } memset( szBuffer, 0x00, sizeof( szBuffer ) ); sprintf( szBuffer, " Found %i Auto-AddMenu Item(s).", count ); messageLoop << szBuffer; } } messageLoop << MSG_SECTIONBEGIN; break; } case '<': messageLoop << "Function not implemented."; break; case '>': messageLoop << "Function not implemented."; break; case 0x1B: case 'Q': messageLoop << MSG_SECTIONBEGIN; messageLoop << "CMD: Immediate Shutdown initialized!"; messageLoop << MSG_SHUTDOWN; break; case '0': if( !cwmWorldState->GetReloadingScripts() ) { cwmWorldState->SetReloadingScripts( true ); // Reload all the files. If there are issues with these files change the order reloaded from here first. cwmWorldState->ServerData()->Load(); messageLoop << "CMD: Loading All"; messageLoop << " Server INI... "; // Reload accounts, and update Access.adm if new accounts available. messageLoop << " Loading Accounts... "; Accounts->Load(); messageLoop << MSG_PRINTDONE; // Reload Region Files messageLoop << " Loading Regions... "; UnloadRegions(); LoadRegions(); messageLoop << MSG_PRINTDONE; // Reload the serve spawn regions messageLoop << " Loading Spawn Regions... "; UnloadSpawnRegions(); LoadSpawnRegions(); messageLoop << MSG_PRINTDONE; // Reload the server command list messageLoop << " Loading commands... "; Commands->Load(); messageLoop << MSG_PRINTDONE; // Reload DFN's messageLoop << " Loading Server DFN... "; FileLookup->Reload(); LoadTeleportLocations(); messageLoop << MSG_PRINTDONE; // messageLoop access is REQUIRED, as this function is executing in a different thread, so we need thread safety messageLoop << " Loading JSE Scripts... "; // Reload the current Spells messageLoop << " Loading spells... "; Magic->LoadScript(); messageLoop << MSG_PRINTDONE; // Reload the HTML output templates messageLoop << " Loading HTML Templates... "; HTMLTemplates->Unload(); HTMLTemplates->Load(); cwmWorldState->SetReloadingScripts( false ); messageLoop << MSG_PRINTDONE; } else messageLoop << "Server can only load one script at a time"; break; case 'T': // Timed shut down(10 minutes) messageLoop << "CMD: 10 Minute Server Shutdown Announced(Timed)"; cwmWorldState->SetEndTime( BuildTimeValue( 600 ) ); endmessage(0); break; case 'D': // Disconnect account 0 (useful when client crashes) for( tSock = Network->LastSocket(); tSock != NULL; tSock = Network->PrevSocket() ) { if( tSock->AcctNo() == 0 ) Network->Disconnect( tSock ); } messageLoop << "CMD: Socket Disconnected(Account 0)."; break; case 'K': { for( tSock = Network->FirstSocket(); !Network->FinishedSockets(); tSock = Network->NextSocket() ) { Network->Disconnect( tSock ); } messageLoop << "CMD: All Connections Closed."; } break; case 'P': { UI32 networkTimeCount = cwmWorldState->ServerProfile()->NetworkTimeCount(); UI32 timerTimeCount = cwmWorldState->ServerProfile()->TimerTimeCount(); UI32 autoTimeCount = cwmWorldState->ServerProfile()->AutoTimeCount(); UI32 loopTimeCount = cwmWorldState->ServerProfile()->LoopTimeCount(); // 1/13/2003 - Dreoth - Log Performance Information enhancements LogEcho( true ); Log( "--- Starting Performance Dump ---", "performance.log"); Log( "\tPerformace Dump:", "performance.log"); Log( "\tNetwork code: %.2fmsec [%i samples]", "performance.log", (R32)((R32)cwmWorldState->ServerProfile()->NetworkTime()/(R32)networkTimeCount), networkTimeCount); Log( "\tTimer code: %.2fmsec [%i samples]", "performance.log", (R32)((R32)cwmWorldState->ServerProfile()->TimerTime()/(R32)timerTimeCount), timerTimeCount); Log( "\tAuto code: %.2fmsec [%i samples]", "performance.log", (R32)((R32)cwmWorldState->ServerProfile()->AutoTime()/(R32)autoTimeCount), autoTimeCount); Log( "\tLoop Time: %.2fmsec [%i samples]", "performance.log", (R32)((R32)cwmWorldState->ServerProfile()->LoopTime()/(R32)loopTimeCount), loopTimeCount); ObjectFactory *ourFac = ObjectFactory::getSingletonPtr(); Log( "\tCharacters: %i/%i - Items: %i/%i (Dynamic)", "performance.log", ourFac->CountOfObjects( OT_CHAR ), ourFac->SizeOfObjects( OT_CHAR ), ourFac->CountOfObjects( OT_ITEM ), ourFac->SizeOfObjects( OT_ITEM ) ); Log( "\tSimulation Cycles: %f per sec", "performance.log", (1000.0*(1.0/(R32)((R32)cwmWorldState->ServerProfile()->LoopTime()/(R32)loopTimeCount)))); Log( "\tBytes sent: %i", "performance.log", cwmWorldState->ServerProfile()->GlobalSent()); Log( "\tBytes Received: %i", "performance.log", cwmWorldState->ServerProfile()->GlobalReceived()); Log( "--- Performance Dump Complete ---", "performance.log"); LogEcho( false ); break; } case 'W': // Display logged in chars messageLoop << "CMD: Current Users in the World:"; j = 0; CSocket *iSock; Network->PushConn(); for( iSock = Network->FirstSocket(); !Network->FinishedSockets(); iSock = Network->NextSocket() ) { ++j; CChar *mChar = iSock->CurrcharObj(); sprintf( temp, " %i) %s [%x %x %x %x]", j - 1, mChar->GetName().c_str(), mChar->GetSerial( 1 ), mChar->GetSerial( 2 ), mChar->GetSerial( 3 ), mChar->GetSerial( 4 ) ); messageLoop << temp; } Network->PopConn(); sprintf( temp, " Total users online: %i", j ); messageLoop << temp; break; case 'M': size_t tmp, total; total = 0; tmp = 0; messageLoop << "CMD: UOX Memory Information:"; messageLoop << " Cache:"; sprintf( temp, " Tiles: %u bytes", Map->GetTileMem() ); messageLoop << temp; sprintf( temp, " Multis: %u bytes", Map->GetMultisMem() ); messageLoop << temp; size_t m, n; m = ObjectFactory::getSingleton().SizeOfObjects( OT_CHAR ); total += tmp = m + m*sizeof( CTEffect ) + m*sizeof(char) + m*sizeof(int)*5; sprintf( temp, " Characters: %u bytes [%u chars ( %u allocated )]", tmp, ObjectFactory::getSingleton().CountOfObjects( OT_CHAR ), m ); messageLoop << temp; n = ObjectFactory::getSingleton().SizeOfObjects( OT_ITEM ); total += tmp = n + n * sizeof( int ) * 4; sprintf( temp, " Items: %u bytes [%u items ( %u allocated )]", tmp, ObjectFactory::getSingleton().CountOfObjects( OT_ITEM ), n ); messageLoop << temp; sprintf( temp, " You save I: %i & C: %i bytes!", m * sizeof(CItem) - ObjectFactory::getSingleton().CountOfObjects( OT_ITEM ), m * sizeof( CChar ) - ObjectFactory::getSingleton().CountOfObjects( OT_CHAR ) ); total += tmp = 69 * sizeof( SpellInfo ); sprintf( temp, " Spells: %i bytes", tmp ); messageLoop << " Sizes:"; sprintf( temp, " CItem : %i bytes", sizeof( CItem ) ); messageLoop << temp; sprintf( temp, " CChar : %i bytes", sizeof( CChar ) ); messageLoop << temp; sprintf( temp, " TEffect: %i bytes (%i total)", sizeof( CTEffect ), sizeof( CTEffect ) * cwmWorldState->tempEffects.Num() ); messageLoop << temp; total += tmp = Map->GetTileMem() + Map->GetMultisMem(); sprintf( temp, " Approximate Total: %i bytes", total ); messageLoop << temp; break; case '?': messageLoop << MSG_SECTIONBEGIN; messageLoop << "Console commands:"; messageLoop << MSG_SECTIONBEGIN; messageLoop << " ShardOP:"; messageLoop << " * - Lock/Unlock Console ? - Commands list(this)"; messageLoop << " C - Configuration H - Unused"; messageLoop << " Y - Console Broadcast Q - Quit/Exit "; messageLoop << " Load Commands:"; messageLoop << " 1 - Ini 2 - Accounts"; messageLoop << " 3 - Regions 4 - Spawn Regions"; messageLoop << " 5 - Spells 6 - Commands"; messageLoop << " 7 - Dfn's 8 - JavaScript"; messageLoop << " 9 - HTML Templates 0 - ALL(1-9)"; messageLoop << " Save Commands:"; messageLoop << " ! - Accounts @ - World(w/AccountImport)"; messageLoop << " # - Unused $ - Unused"; messageLoop << " % - Unused ^ - Unused"; messageLoop << " & - Unused ( - Unused"; messageLoop << " ) - Unused"; messageLoop << " Server Maintenence:"; messageLoop << " P - Performance W - Characters Online"; messageLoop << " M - Memory Information T - 10 Minute Shutdown"; messageLoop << " V - Dump Lookups(Devs) F - Display Priority Maps"; messageLoop << " Network Maintenence:"; messageLoop << " D - Disconnect Acct0 K - Disconnect All"; messageLoop << " Z - Socket Logging "; messageLoop << MSG_SECTIONBEGIN; break; case 'v': case 'V': // Dump look up data to files so developers working with extending the ini will have a table to use messageLoop << "| CMD: Creating Server.scp and Uox3.ini Tag Lookup files(For Developers)...."; cwmWorldState->ServerData()->dumpLookup( 0 ); cwmWorldState->ServerData()->save( "./uox.tst.ini" ); messageLoop << MSG_PRINTDONE; break; case 'z': case 'Z': { // Log socket activity Network->PushConn(); bool loggingEnabled = false; CSocket *snSock = Network->FirstSocket(); if( snSock != NULL ) loggingEnabled = !snSock->Logging(); for( ; !Network->FinishedSockets(); snSock = Network->NextSocket() ) { if( snSock != NULL ) snSock->Logging( !snSock->Logging() ); } Network->PopConn(); if( loggingEnabled ) messageLoop << "CMD: Network Logging Enabled."; else messageLoop << "CMD: Network Logging Disabled."; break; } case 'c': case 'C': // Shows a configuration header DisplaySettings(); break; case 'f': case 'F': FileLookup->DisplayPriorityMap(); break; default: sprintf( temp, "Key \'%c\' [%i] does not perform a function", (char)c, c ); messageLoop << temp; break; } } }