Ejemplo n.º 1
0
	// Append/Remove to Autostart
	void TaskBarIcon::OnMenuAutoStart(wxCommandEvent& event)
	{
		// Registry Key
		HKEY hkRegistry;

		// Open Key
		if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run\\", 0, KEY_WRITE, &hkRegistry) == ERROR_SUCCESS)
		{
			// He checked it
			if (event.IsChecked())
			{
				// Get App Path
				wxString appPath = wxStandardPaths::Get().GetExecutablePath();

				// Close to Taskbar on Autostart
				appPath = "\"" + appPath + "\"" + " -taskbar";

				// Write in
				RegSetValueExW(hkRegistry, L"CallAdmin-Client", 0, REG_SZ, (BYTE*)appPath.wc_str(), (wcslen(appPath.wc_str()) + 1) * sizeof(wchar_t));

				LogAction("Added Call Admin to the auto start list");
			}
			else
			{
				// Remove it
				RegDeleteValueA(hkRegistry, "CallAdmin-Client");

				LogAction("Removed Call Admin from the auto start list");
			}

			// Close Key
			RegCloseKey(hkRegistry);
		}
	}
Ejemplo n.º 2
0
 void DoRandomOperation() {
   Object* obj;
   switch (rand() & 0x7) {
   case 0: {
     if (mUniverse.Length() < 50) {
       obj = new Object();
       mUniverse.AppendElement(obj);
       nsExpirationTracker<Object,K>::AddObject(obj);
       LogAction(obj, "Created and added");
     }
     break;
   }
   case 4: {
     if (mUniverse.Length() < 50) {
       obj = new Object();
       mUniverse.AppendElement(obj);
       LogAction(obj, "Created");
     }
     break;
   }
   case 1: {
     obj = mUniverse[uint32_t(rand())%mUniverse.Length()];
     if (obj->mExpiration.IsTracked()) {
       nsExpirationTracker<Object,K>::RemoveObject(obj);
       LogAction(obj, "Removed");
     }
     break;
   }
   case 2: {
     obj = mUniverse[uint32_t(rand())%mUniverse.Length()];
     if (!obj->mExpiration.IsTracked()) {
       obj->Touch();
       nsExpirationTracker<Object,K>::AddObject(obj);
       LogAction(obj, "Added");
     }
     break;
   }
   case 3: {
     obj = mUniverse[uint32_t(rand())%mUniverse.Length()];
     if (obj->mExpiration.IsTracked()) {
       obj->Touch();
       nsExpirationTracker<Object,K>::MarkUsed(obj);
       LogAction(obj, "Marked used");
     }
     break;
   }
   }
 }
Ejemplo n.º 3
0
static cell_t sm_LogAction(IPluginContext *pContext, const cell_t *params)
{
	char buffer[2048];
	g_pSM->SetGlobalTarget(SOURCEMOD_SERVER_LANGUAGE);
	{
		DetectExceptions eh(pContext);
		g_pSM->FormatString(buffer, sizeof(buffer), pContext, params, 3);
		if (eh.HasException())
			return 0;
	}

	IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());

	LogAction(pPlugin->GetMyHandle(), 2, params[1], params[2], buffer);

	return 1;
}
Ejemplo n.º 4
0
 void NotifyExpired(Object* aObj) {
   LogAction(aObj, "Expired");
   PRIntervalTime now = PR_IntervalNow();
   uint32_t timeDiffMS = (now - aObj->mLastUsed)*1000/PR_TicksPerSecond();
   // See the comment for NotifyExpired in nsExpirationTracker.h for these
   // bounds
   uint32_t lowerBoundMS = (K-1)*periodMS - slackMS;
   uint32_t upperBoundMS = K*(periodMS + sleepPeriodMS) + slackMS;
   if (logging) {
     printf("Checking: %d-%d = %d [%d,%d]\n",
            now, aObj->mLastUsed, timeDiffMS, lowerBoundMS, upperBoundMS);
   }
   if (timeDiffMS < lowerBoundMS || timeDiffMS > upperBoundMS) {
     EXPECT_TRUE(timeDiffMS < periodMS && aObj->mExpired);
   }
   aObj->Touch();
   aObj->mExpired = true;
   DoRandomOperation();
   DoRandomOperation();
   DoRandomOperation();
 }
Ejemplo n.º 5
0
 Tracker() : nsExpirationTracker<Object,K>(periodMS) {
   Object* obj = new Object();
   mUniverse.AppendElement(obj);
   LogAction(obj, "Created");
 }