void SGameplayTagWidget::CreateNewGameplayTag()
{
	// Only support adding tags via ini file
	if (UGameplayTagsManager::ShouldImportTagsFromINI() == false)
	{
		return;
	}

	FString str = NewTagTextBox->GetText().ToString();
	if (str.IsEmpty())
	{
		return;
	}

	// set bIsAddingNewTag, this guards against the window closing when it loses focus due to source control checking out a file
	TGuardValue<bool>	Guard(bIsAddingNewTag, true);

	UGameplayTagsManager::AddNewGameplayTagToINI(str);

	NewTagTextBox->SetText(FText::GetEmpty());

	IGameplayTagsModule::Get().GetGameplayTagsManager().GetFilteredGameplayRootTags(RootFilterString, TagItems);
	TagTreeWidget->RequestTreeRefresh();

	auto node = IGameplayTagsModule::Get().GetGameplayTagsManager().FindTagNode(FName(*str));
	if (node.IsValid())
	{
		OnTagChecked(node);
	}

	// Filter on the new tag
	SearchTagBox->SetText(FText::FromString(str));
}
Esempio n. 2
0
void CMainGui::ChangeWinSize (long width, long height) 
{
	CGuard Guard(m_CS);
	WINDOWPLACEMENT wndpl;
    RECT rc1, swrect;

	wndpl.length = sizeof(wndpl);
	GetWindowPlacement( m_hMainWindow, &wndpl);

	if ( (HWND)m_hStatusWnd != NULL ) 
    {
		GetClientRect( (HWND)m_hStatusWnd, &swrect );
	    SetRect( &rc1, 0, 0, width, height + swrect.bottom );
	} 
    else 
    {
	    SetRect( &rc1, 0, 0, width, height );
	}


    AdjustWindowRectEx( &rc1,GetWindowLong( m_hMainWindow, GWL_STYLE ),
		GetMenu( m_hMainWindow ) != NULL, GetWindowLong( m_hMainWindow, GWL_EXSTYLE ) ); 

    MoveWindow( m_hMainWindow, wndpl.rcNormalPosition.left, wndpl.rcNormalPosition.top, 
		rc1.right - rc1.left, rc1.bottom - rc1.top, TRUE );
}
Esempio n. 3
0
UnicodeString TConfiguration::GetFileFileInfoString(const UnicodeString & AKey,
  const UnicodeString & AFileName, bool AllowEmpty) const
{
  TGuard Guard(FCriticalSection);

  UnicodeString Result;
  void * Info = GetFileApplicationInfo(AFileName);
  SCOPE_EXIT
  {
    if (!AFileName.IsEmpty() && Info)
    {
      FreeFileInfo(Info);
    }
  };
  if ((Info != nullptr) && (GetTranslationCount(Info) > 0))
  {
    TTranslation Translation = GetTranslation(Info, 0);
    try
    {
      Result = ::GetFileInfoString(Info, Translation, AKey, AllowEmpty);
    }
    catch (const std::exception & e)
    {
      (void)e;
      DEBUG_PRINTF("Error: %s", ::MB2W(e.what()).c_str());
      Result.Clear();
    }
  }
  else
  {
    assert(!AFileName.IsEmpty());
  }
  return Result;
}
ULONG  CIniFileBase::GetString  ( LPCTSTR lpSectionName, LPCTSTR lpKeyName, LPCTSTR lpDefault, LPTSTR lpReturnedString, ULONG nSize )
{
	CGuard Guard(m_CS);

	std::string strSection;

	if (lpSectionName == NULL || _tcslen(lpSectionName) == 0)
	{
		strSection = "default";
	}
	else
	{
		strSection = lpSectionName;
	}

	if (m_File.IsOpen() && MoveToSectionNameData(strSection.c_str(),true)) 
	{
		KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName);
		if (iter != m_CurrentSectionData.end())
		{
			_tcsncpy(lpReturnedString,iter->second.c_str(),nSize - 1);
			lpReturnedString[nSize - 1] = 0;
			return (ULONG)_tcslen(lpReturnedString);
		}
	}
	_tcsncpy(lpReturnedString,lpDefault,nSize - 1);
	lpReturnedString[nSize - 1] = 0;
	return (ULONG)_tcslen(lpReturnedString);
}
Esempio n. 5
0
IDF_ERRORCODE iDFPluginMgr::run_all_plugins()
{
    idf::LockGuard<idf::MutexLock> Guard(this->lock);
    
    std::vector<iDFPluginWrapper*>::iterator begin=this->plugins.begin();
    std::vector<iDFPluginWrapper*>::iterator end = this->plugins.end();
    
    for(; begin!=end; begin++)
    {
        iDFPluginWrapper * plugin = *begin;
        if(!plugin->is_valid() || plugin->is_run())
        {
            printf("skip the plugin, %d", plugin->get_plugin_id());
            continue;
        }
        
        IDF_ERRORCODE error_code = plugin->init() || plugin->start();
        if(IDF_IS_ERROR(error_code))
        {
            printf("plugin failed to start it~, skip it~, error code is %lld", error_code);
            continue;
        }
    }
    
    return IDF_SUCCESS;
}
Esempio n. 6
0
IDF_ERRORCODE iDFPluginMgr::stop_plugin(PluginTypeID id)
{
    idf::LockGuard<idf::MutexLock> Guard(this->lock);
    
    std::vector<iDFPluginWrapper*>::iterator begin=this->plugins.begin();
    std::vector<iDFPluginWrapper*>::iterator end = this->plugins.end();
    
    for(;begin!=end;begin++)
    {
        iDFPluginWrapper * plugin = *begin;
        
        if(plugin->get_plugin_id()==id)
        {
            if(plugin->is_run())
            {
//                plugin->stop();
                for (int i=0; i<30; i++)
                {
                    IDF_ERRORCODE error_code = plugin->stop();
                    if(IDF_IS_ERROR(error_code)) continue;
                    else
                        return IDF_SUCCESS;
                }
                return IDF_PLUGIN_CANNOT_STOP;
            }
            printf("plugin dose not run");
            return IDF_SUCCESS;
        }
    }
    return IDF_PLUGIN_NO_PLUGIN;
}
Esempio n. 7
0
//---------------------------------------------------------------------------
UnicodeString TConfiguration::GetFileInfoString(const UnicodeString & Key,
  const UnicodeString & FileName) const
{
  TGuard Guard(FCriticalSection);

  UnicodeString Result;
  void * Info = GetFileApplicationInfo(FileName);
  SCOPE_EXIT
  {
    if (!FileName.IsEmpty() && Info)
    {
      FreeFileInfo(Info);
    }
  };
  {
    if ((Info != nullptr) && (GetTranslationCount(Info) > 0))
    {
      TTranslation Translation = GetTranslation(Info, 0);
      try
      {
        Result = ::GetFileInfoString(Info, Translation, Key);
      }
      catch (const std::exception & e)
      {
        (void)e;
        DEBUG_PRINTF(L"Error: %s", MB2W(e.what()).c_str());
        Result = L"";
      }
    }
  }
  return Result;
}
Esempio n. 8
0
RafLinkedList* AccountMgr::GetRAFAccounts(uint32 accid, bool referred)
{

    RafLinkedMap::iterator itr = mRAFLinkedMap.find(std::pair<uint32,bool>(accid, referred));
    if (itr == mRAFLinkedMap.end())
    {
        QueryResult* result;

        if (referred)
            result = LoginDatabase.PQuery("SELECT `friend_id` FROM `account_friends` WHERE `id` = %u AND `expire_date` > NOW() LIMIT %u", accid, sWorld.getConfig(CONFIG_UINT32_RAF_MAXREFERERS));
        else
            result = LoginDatabase.PQuery("SELECT `id` FROM `account_friends` WHERE `friend_id` = %u AND `expire_date` > NOW() LIMIT %u", accid, sWorld.getConfig(CONFIG_UINT32_RAF_MAXREFERALS));

        RafLinkedList acclist;

        if (result)
        {
            do
            {
                Field* fields = result->Fetch();
                uint32 refaccid = fields[0].GetUInt32();
                acclist.push_back(refaccid);
            }
            while (result->NextRow());
            delete result;
        }
        ReadGuard Guard(GetLock());
        mRAFLinkedMap.insert(RafLinkedMap::value_type(std::pair<uint32,bool>(accid, referred), acclist));
        itr = mRAFLinkedMap.find(std::pair<uint32,bool>(accid, referred));
    }

    return &itr->second;
}
Esempio n. 9
0
//---------------------------------------------------------------------------
void TActionLog::ReflectSettings()
{
  TGuard Guard(FCriticalSection);

  bool ALogging =
    !FClosed && FConfiguration->GetLogActions() && GetEnabled();

  if (ALogging && !FLogging)
  {
    FLogging = true;
    Add(L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    Add(FORMAT(L"<session xmlns=\"http://winscp.net/schema/session/1.0\" name=\"%s\" start=\"%s\">",
      XmlAttributeEscape(FSessionData->GetSessionName()).c_str(), StandardTimestamp().c_str()));
  }
  else if (!ALogging && FLogging)
  {
    if (FInGroup)
    {
      EndGroup();
    }
    // do not try to close the file, if it has not been opened, to avoid recursion
    if (FFile != nullptr)
    {
      Add(L"</session>");
    }
    CloseLogFile();
    FLogging = false;
  }

}
Esempio n. 10
0
void AccountMgr::ClearPlayerDataCache(ObjectGuid guid)
{
    if (!guid || !guid.IsPlayer())
        return;

    PlayerDataCache const* cache = GetPlayerDataCache(guid, false);

    if (cache)
    {
        uint32 accId = cache->account;

        WriteGuard Guard(GetLock());
        PlayerDataCacheMap::iterator itr = mPlayerDataCacheMap.find(guid);
        if (itr != mPlayerDataCacheMap.end())
            mPlayerDataCacheMap.erase(itr);

        RafLinkedMap::iterator itr1 = mRAFLinkedMap.find(std::pair<uint32,bool>(accId, true));
        if (itr1 != mRAFLinkedMap.end())
            mRAFLinkedMap.erase(itr1);
        itr1 = mRAFLinkedMap.find(std::pair<uint32,bool>(accId, false));
        if (itr1 != mRAFLinkedMap.end())
            mRAFLinkedMap.erase(itr1);
    }

}
Esempio n. 11
0
//---------------------------------------------------------------------------
void TConfiguration::Load()
{
  TGuard Guard(FCriticalSection);
  std::unique_ptr<THierarchicalStorage> Storage(CreateStorage(false));
  Storage->SetAccessMode(smRead);
  LoadFrom(Storage.get());
}
Esempio n. 12
0
void CTraceLog::WriteTrace ( TraceType Type, LPCTSTR Message)
{
	CGuard Guard(m_CS);

	if (Type != TraceNone)
	{
		bool WriteToLog = false;
		for (int i = 0; i < (int)m_Modules.size(); i++ )
		{
			if ((m_Modules[i]->GetTraceLevel() & Type) != 0) 
			{
				WriteToLog = true;
				break;
			}
		}
		if (!WriteToLog) { return; }
	}

	if ((Type & TraceNoHeader) == 0)
	{
		TCHAR pBuffer[300];
		int nPos = 0;

		SYSTEMTIME sysTime;
		::GetLocalTime(&sysTime);

		nPos = _stprintf( pBuffer, _T("%04d/%02d/%02d %02d:%02d:%02d.%03d %05d: "), sysTime.wYear,
			sysTime.wMonth,sysTime.wDay,sysTime.wHour,sysTime.wMinute,sysTime.wSecond,sysTime.wMilliseconds,
			::GetCurrentThreadId()
		);

		// show the debug level
		if (Type == TraceNone) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("None   : ")); }
		else if ((Type & TraceError)     != 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Error  : ")); }
		else if ((Type & TraceSettings)  != 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Setting: ")); }
		else if ((Type & TraceGfxPlugin) != 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Gfx    : ")); }
		else if ((Type & TraceDebug)     != 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Debug  : ")); }
		else if ((Type & TraceRecompiler)!= 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Recomp : ")); }
		else if ((Type & TraceRSP       )!= 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("RSP    : ")); }
		else if ((Type & TraceTLB       )!= 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("TLB    : ")); }
		else if ((Type & TraceValidate  )!= 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Valid  : ")); }
		else if ((Type & TraceAudio     )!= 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Audio  : ")); }
		else { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Unknown: ")); }

		for (int i = 0; i < (int)m_Modules.size(); i++ )
		{
			if ((m_Modules[i]->GetTraceLevel() & Type) != 0) 
			{
				m_Modules[i]->Write(pBuffer, false);
			}
		}
	}
	for (int i = 0; i < (int)m_Modules.size(); i++ )
	{
		if ((m_Modules[i]->GetTraceLevel() & Type) != 0) 
		{
			m_Modules[i]->Write(Message, true);
		}
	}
}
Esempio n. 13
0
bool WorldSocket::SendPacket(const WorldPacket& pct)
{
    if (IsClosed())
        return false;

    // Dump outgoing packet.
    sLog.outWorldPacketDump(native_handle(), pct.GetOpcode(), pct.GetOpcodeName(), &pct, false);

    ServerPktHeader header(pct.size() + 2, pct.GetOpcode());
    crypt_.EncryptSend((uint8*) header.header, header.getHeaderLength());

    GuardType Guard(out_buffer_lock_);

    if (out_buffer_->space() >= pct.size() + header.getHeaderLength())
    {
        // Put the packet on the buffer.
        if (!out_buffer_->Write(header.header, header.getHeaderLength()))
            MANGOS_ASSERT(false);

        if (!pct.empty() && !out_buffer_->Write(pct.contents(), pct.size()))
            MANGOS_ASSERT(false);
    }
    else
    {
        // Enqueue the packet.
        throw std::exception("network write buffer is too small to accommodate packet");
    }

    StartAsyncSend();

    return true;
}
Esempio n. 14
0
//---------------------------------------------------------------------------
UnicodeString __fastcall TConfiguration::GetFileFileInfoString(const UnicodeString Key,
  const UnicodeString FileName)
{
  TGuard Guard(FCriticalSection);

  UnicodeString Result;
  void * Info = GetFileApplicationInfo(FileName);
  try
  {
    if ((Info != NULL) && (GetTranslationCount(Info) > 0))
    {
      TTranslation Translation;
      Translation = GetTranslation(Info, 0);
      Result = ::GetFileInfoString(Info, Translation, Key);
    }
    else
    {
      assert(!FileName.IsEmpty());
    }
  }
  __finally
  {
    if (!FileName.IsEmpty())
    {
      FreeFileInfo(Info);
    }
  }
  return Result;
}
Esempio n. 15
0
//---------------------------------------------------------------------------
bool __fastcall AppendExceptionStackTraceAndForget(TStrings *& MoreMessages)
{
  bool Result = false;

  TGuard Guard(StackTraceCriticalSection.get());

  TStackTraceMap::iterator Iterator = StackTraceMap.find(GetCurrentThreadId());
  if (Iterator != StackTraceMap.end())
  {
    std::unique_ptr<TStrings> OwnedMoreMessages;
    if (MoreMessages == NULL)
    {
      OwnedMoreMessages.reset(new TStringList());
      MoreMessages = OwnedMoreMessages.get();
      Result = true;
    }
    if (!MoreMessages->Text.IsEmpty())
    {
      MoreMessages->Text = MoreMessages->Text + "\n";
    }
    MoreMessages->Text = MoreMessages->Text + LoadStr(STACK_TRACE) + "\n";
    MoreMessages->AddStrings(Iterator->second);

    delete Iterator->second;
    StackTraceMap.erase(Iterator);

    OwnedMoreMessages.release();
  }
  return Result;
}
Esempio n. 16
0
// call this method only
void TerrainInfo::CleanUpGrids(uint32 const diff)
{
    for (int y = 0; y < MAX_NUMBER_OF_GRIDS; ++y)
    {
        for (int x = 0; x < MAX_NUMBER_OF_GRIDS; ++x)
        {
            // delete those GridMap objects which have refcount == 0
            if (m_GridMaps[x][y] && m_GridMaps[x][y].count() == 0)
            {
                DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING,"TerrainInfo::CleanUpGrids unload grid map:%u x:%d y:%d", GetMapId(), x, y);
                WriteGuard Guard(GetLock(), true);

                GridMapPtr tmpPtr = m_GridMaps[x][y];
                m_GridMaps[x][y] = GridMapPtr();

                // unload VMAPS...
                VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(m_mapId, x, y);

                // unload mmap...
                MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(m_mapId, x, y);

                // tmpPtr be auto-erased after cycle end
            }
        }
    }
}
Esempio n. 17
0
bool PathFinder::calculate(float destX, float destY, float destZ, bool forceDest)
{
    Vector3 oldDest = getEndPosition();
    Vector3 dest(destX, destY, destZ);
    setEndPosition(dest);

    float x, y, z;
    m_sourceUnit->GetPosition(x, y, z);
    Vector3 start(x, y, z);
    setStartPosition(start);

    m_forceDestination = forceDest;

    DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathFinder::calculate() for %u \n", m_sourceUnit->GetGUIDLow());

    // make sure navMesh works - we can run on map w/o mmap
    // check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?)
    if (!m_navMesh || !m_navMeshQuery || m_sourceUnit->hasUnitState(UNIT_STAT_IGNORE_PATHFINDING) ||
        !HaveTile(start) || !HaveTile(dest) || (m_sourceUnit->GetTypeId() == TYPEID_UNIT && ((Creature*)m_sourceUnit)->IsLevitating()))
    {
        BuildShortcut();
        m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
        return true;
    }

    updateFilter();

    {
        ReadGuard Guard(MMAP::MMapFactory::createOrGetMMapManager()->GetLock(m_sourceUnit->GetMapId()));
        BuildPolyPath(start, dest);
    }
    return true;
}
Esempio n. 18
0
IDF_ERRORCODE iDFPluginMgr::remove_plugin(PluginTypeID id)
{
    idf::LockGuard<idf::MutexLock> Guard(this->lock);
    
    std::vector<iDFPluginWrapper*>::iterator begin=this->plugins.begin();
    std::vector<iDFPluginWrapper*>::iterator end = this->plugins.end();
    
    for(;begin!=end;begin++)
    {
        iDFPluginWrapper * plugin = *begin;
        
        if(plugin->get_plugin_id()==id)
        {
            if(IDF_IS_ERROR(this->stop_plugin(id)))
            {
                return IDF_PLUGIN_CANNOT_STOP;
            }
            
            this->plugins.erase(begin);
            delete *begin;
            
            return IDF_SUCCESS;
        }
    }
    
    return IDF_PLUGIN_NO_PLUGIN;
}
Esempio n. 19
0
//---------------------------------------------------------------------------
void TActionLog::Add(const UnicodeString & Line)
{
  assert(FConfiguration);
  if (FLogging)
  {
    try
    {
      TGuard Guard(FCriticalSection);
      if (FFile == nullptr)
      {
        OpenLogFile();
      }

      if (FFile != nullptr)
      {
        UTF8String UtfLine = UTF8String(Line);
        fwrite(UtfLine.c_str(), 1, UtfLine.Length(), (FILE *)FFile);
        fwrite("\n", 1, 1, (FILE *)FFile);
      }
    }
    catch (Exception &E)
    {
      // We failed logging, turn it off and notify user.
      FConfiguration->SetLogActions(false);
      try
      {
        throw ExtException(&E, LoadStr(LOG_GEN_ERROR));
      }
      catch (Exception &E)
      {
        FUI->HandleExtendedException(&E);
      }
    }
  }
}
Esempio n. 20
0
void TSessionLog::Add(TLogLineType Type, UnicodeString ALine)
{
  DebugAssert(FConfiguration);
  if (GetLogging())
  {
    try
    {
      if (FParent != nullptr)
      {
        DoAdd(Type, ALine, nb::bind(&TSessionLog::DoAddToParent, this));
      }
      else
      {
        TGuard Guard(FCriticalSection);

        DoAdd(Type, ALine, nb::bind(&TSessionLog::DoAddToSelf, this));
      }
    }
    catch (Exception &E)
    {
      // We failed logging, turn it off and notify user.
      FConfiguration->SetLogging(false);
      try
      {
        throw ExtException(&E, LoadStr(LOG_GEN_ERROR));
      }
      catch (Exception &E2)
      {
        AddException(&E2);
        FUI->HandleExtendedException(&E2);
      }
    }
  }
}
Esempio n. 21
0
bool CIniFileBase::GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault, stdstr & Value )
{
	CGuard Guard(m_CS);

	std::string strSection;

	if (lpSectionName == NULL || wcslen(lpSectionName) == 0)
	{
		strSection = "default";
	}
	else
	{
		stdstr::fromTString(lpSectionName,strSection);
	}

	if (m_File.IsOpen() && MoveToSectionNameData(strSection.c_str(),true)) 
	{
		KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName);
		if (iter != m_CurrentSectionData.end())
		{
			stdstr::toTString(iter->second.c_str(),Value);
			return true;
		}
	}
	Value = lpDefault;
	return false;
}
Esempio n. 22
0
//---------------------------------------------------------------------------
void TSessionLog::Clear()
{
  TGuard Guard(FCriticalSection);

  FTopIndex += GetCount();
  TStringList::Clear();
}
void FAggregator::BroadcastOnDirty()
{
	// If we are batching on Dirty calls (and we actually have dependents registered with us) then early out.
	if (FScopedAggregatorOnDirtyBatch::GlobalBatchCount > 0 && (Dependents.Num() > 0 || OnDirty.IsBound()))
	{
		FScopedAggregatorOnDirtyBatch::DirtyAggregators.Add(this);
		return;
	}

	if (IsBroadcastingDirty)
	{
		// Apologies for the vague warning but its very hard from this spot to call out what data has caused this. If this frequently happens we should improve this.
		ABILITY_LOG(Warning, TEXT("FAggregator detected cyclic attribute dependencies. We are skipping a recursive dirty call. Its possible the resulting attribute values are not what you expect!"));
		return;
	}

	TGuardValue<bool>	Guard(IsBroadcastingDirty, true);
	
	OnDirty.Broadcast(this);


	TArray<FActiveGameplayEffectHandle>	ValidDependents;
	for (FActiveGameplayEffectHandle Handle : Dependents)
	{
		UAbilitySystemComponent* ASC = Handle.GetOwningAbilitySystemComponent();
		if (ASC)
		{
			ASC->OnMagnitudeDependencyChange(Handle, this);
			ValidDependents.Add(Handle);
		}
	}
	Dependents = ValidDependents;

}
Esempio n. 24
0
bool AuthSocket::send(const char* buf, size_t len)
{
    if (buf == NULL || len == 0)
        return true;
    
    GuardType Guard(m_OutBufferLock);
    
    if (m_OutBuffer->space() >= len)
    {
        // Put the packet on the buffer.
        if (m_OutBuffer->copy((char*)buf, len) == -1)
        {
            MANGOS_ASSERT(false);
            return false;
        }
    }
    else
    {
        // Enqueue the packet.
        sLog.outError("network write buffer is too small to accommodate packet. Disconnecting client");
        
        MANGOS_ASSERT(false);
        return false;
    }
    
    start_async_send();
    
    return true;
}
Esempio n. 25
0
void TConfiguration::Default()
{
  TGuard Guard(FCriticalSection);

  FDisablePasswordStoring = false;
  FForceBanners = false;
  FDisableAcceptingHostKeys = false;

  std::unique_ptr<TRegistryStorage> AdminStorage(new TRegistryStorage(GetRegistryStorageKey(), HKEY_LOCAL_MACHINE));
  try__finally
  {
    if (AdminStorage->OpenRootKey(false))
    {
      LoadAdmin(AdminStorage.get());
      AdminStorage->CloseSubKey();
    }
  }
  __finally
  {
//    delete AdminStorage;
  };

  SetRandomSeedFile(FDefaultRandomSeedFile);
  SetPuttyRegistryStorageKey(OriginalPuttyRegistryStorageKey);
  FConfirmOverwriting = true;
  FConfirmResume = true;
  FAutoReadDirectoryAfterOp = true;
  FSessionReopenAuto = 5000;
  FSessionReopenBackground = 2000;
  FSessionReopenTimeout = 0;
  FSessionReopenAutoStall = 60000;
  FTunnelLocalPortNumberLow = 50000;
  FTunnelLocalPortNumberHigh = 50099;
  FCacheDirectoryChangesMaxSize = 100;
  FShowFtpWelcomeMessage = false;
  FExternalIpAddress.Clear();
  FTryFtpWhenSshFails = true;
  SetCollectUsage(FDefaultCollectUsage);
  FSessionReopenAutoMaximumNumberOfRetries = CONST_DEFAULT_NUMBER_OF_RETRIES;
  FDefaultCollectUsage = false;

  FLogging = false;
  FPermanentLogging = false;
  FLogFileName = GetDefaultLogFileName();
  FPermanentLogFileName = FLogFileName;
  FLogFileAppend = true;
  FLogSensitive = false;
  FPermanentLogSensitive = FLogSensitive;
  FLogWindowLines = 100;
  FLogProtocol = 0;
  FPermanentLogProtocol = FLogProtocol;
  UpdateActualLogProtocol();
  FLogActions = false;
  FPermanentLogActions = false;
  FActionsLogFileName = "%TEMP%" WGOOD_SLASH "&S.xml";
  FPermanentActionsLogFileName = FActionsLogFileName;
  FProgramIniPathWrittable = -1;

  Changed();
}
Esempio n. 26
0
void DoTrace(const wchar_t * SourceFile, const wchar_t * Func,
             uintptr_t Line, const wchar_t * Message)
{
    if (TracingCriticalSection != nullptr)
    {
        TTraceInMemory TraceInMemory;
        TraceInMemory.Ticks = ::GetTickCount();
        TraceInMemory.Thread = ::GetCurrentThreadId();
        TraceInMemory.SourceFile = SourceFile;
        TraceInMemory.Func = Func;
        TraceInMemory.Line = Line;
        TraceInMemory.Message = Message;

        TGuard Guard(TracingCriticalSection);

        if (TracesInMemory.capacity() == 0)
        {
            TracesInMemory.reserve(100000);
            TThreadID ThreadID;
            StartThread(nullptr, 0, TraceThreadProc, nullptr, 0, ThreadID);
        }

        TracesInMemory.push_back(TraceInMemory);
    }
}
Esempio n. 27
0
GridMapPtr TerrainInfo::GetGridMap(uint32 const& x, uint32 const& y)
{
    if (x >= MAX_NUMBER_OF_GRIDS || y >= MAX_NUMBER_OF_GRIDS)
        return GridMapPtr();

    ReadGuard Guard(GetLock(), true);
    return m_GridMaps[x][y];
}
Esempio n. 28
0
void WorldObjectEventProcessor::Update(uint32 p_time, bool force)
{
    if (force)
        RenewEvents();

    ReadGuard Guard(GetLock());
    EventProcessor::Update(p_time);
}
Esempio n. 29
0
void CMainGui::BringToTop(void)
{
    CGuard Guard(m_CS);
    SetForegroundWindow(m_hMainWindow);
    SetFocus(GetDesktopWindow());
    Sleep(100);
    SetFocus(m_hMainWindow);
}
Esempio n. 30
0
void CTraceLog::TraceMessage(uint32_t module, uint8_t severity, const char * file, int line, const char * function, const char * Message)
{
    CGuard Guard(m_CS);

    for (uint32_t i = 0, n = m_Modules.size(); i < n; i++)
    {
        m_Modules[i]->Write(module, severity, file, line, function, Message);
    }
}