void CConnectionManager::AsyncConnectThread() { DWORD size = 1024; TCHAR host[1024] = _T("localhost"); if (GetStringValueFromRegistry(REGISTRY_ROOT_KEY, REGISTRY_SETTINGS_KEY, REGISTRY_SETTINGS_HOST, host, &size)!=0) { m_Parent->Log(_T("Unable to read host record from registry."), ICON_WARNING); } DWORD port = 41258; if (GetDWORDValueFromRegistry(REGISTRY_ROOT_KEY, REGISTRY_SETTINGS_KEY, REGISTRY_SETTINGS_PORT, &port)!=0) { m_Parent->Log(_T("Unable to read port from registry."), ICON_WARNING); } CString sport; sport.Format(_T("%d"), port); if (!m_Connection.ConnectTo(host, sport, AF_INET, SOCK_STREAM)) { BrowserManagerLock browserManager; CBrowserMessageWindow* window = browserManager->FindBrowserMessageWindow(m_Parent->GetBrowserId()); if (!window) return; window->PostMessage(BMM_REQUEST_LOG, ICON_WARNING, (LPARAM)FS(_T("Unable to see XRefresh Monitor."))); window->PostMessage(BMM_REQUEST_LOG, ICON_BULB, (LPARAM)FS(_T("Please check if you have running XRefresh Monitor. On Windows, it is program running in system tray. Look for Programs -> XRefresh -> XRefresh.exe"))); window->PostMessage(BMM_REQUEST_LOG, ICON_BULB, (LPARAM)FS(_T("You may also want to check your firewall settings. XRefresh IE Addon expects Monitor to talk from %s on port %d"), host, port)); TRACE_I(_T("server not available")); return; } m_Connection.WatchComm(); SendHello(); }
STDMETHODIMP CUpgradrToolbar::SetSite(IUnknown *pUnknownSite) { DT(TRACE_I(FS(_T("Toolbar[%08X]: SetSite(%08X)"), this, pUnknownSite))); try { if (!!pUnknownSite) { // attach the window HWND hMyWindow; CComPtr<IUnknown> site(pUnknownSite); CComQIPtr<IOleWindow> window(site); window->GetWindow(&hMyWindow); if (!hMyWindow) { TRACE_E(FS(_T("Toolbar[%08X]: Cannot retrieve toolbar base window"), this)); return E_FAIL; } SubclassWindow(hMyWindow); // get a WebBrowser reference CComQIPtr<IServiceProvider> serviceProvider(site); serviceProvider->QueryService(IID_IWebBrowserApp, IID_IWebBrowser2, (void**)&m_spWebBrowser); site->QueryInterface(IID_IInputObjectSite, (void**)&m_spSite); // create main window CreateMainWindow(); } } catch (CUpgradrRuntimeError &ex) { HandleError(ex.ErrorMessage()); return E_FAIL; } return S_OK; }
void AGameObject::Attack( AGameObject* go ) { if( go == this ) { error( "Attacking self" ); return; } Stop(); // DropTargets & Clear Old Waypoint queue if( AttackTarget ) { info( FS( "%s unfollowed %s", *GetName(), *AttackTarget->GetName() ) ); } AttackTarget = go; if( AttackTarget ) { if( AttackTarget->Dead ) { error( FS( "Trying to attack dead target %s", *go->GetName() ) ); AttackTarget = 0; return; } AttackTarget->Attackers += this; Game->flycam->MarkAsAttack( AttackTarget ); } AttackReady = 0; // Do not stop to engage other units }
bool CUpgradrRootImpl::CheckThreadOwnership(ESharedResourceId rid) { #ifdef _DEBUG DWORD tid = GetCurrentThreadId(); m_MainCS.Enter(); TOwnership::iterator i = m_Ownership.find(rid); if (i==m_Ownership.end()) { TRACE_E(FS(_T("Resource %s owned by no thread used by thread %08X !!!"), g_acResourceNames[rid], tid)); DebugBreak(); m_MainCS.Leave(); return false; } if (i->second.first!=tid) { TRACE_E(FS(_T("Resource %s owned by thread %08X used by thread %08X !!!"), g_acResourceNames[rid], i->second.first, tid)); DebugBreak(); m_MainCS.Leave(); return false; } m_MainCS.Leave(); #endif return true; }
void AGameObject::OnHitContactBegin_Implementation( AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult ) { //info( FS( "OnHitContactBegin %s with %s", *Name, *OtherActor->GetName() ) ); if( OtherActor == this ) { // Don't do anything with reports of collision with self. return; } AGameObject* THAT = Cast<AGameObject>( OtherActor ); if( THAT ) { //info( FS( "HitContactBegin: %s : %s/%s", *GetName(), *OtherActor->GetName(), *OtherComp->GetName() ) ); if( in( HitOverlaps, THAT ) ) { warning( FS( "HitContactBegin: %s was already overlapped by %s/%s", *GetName(), *OtherActor->GetName(), *OtherComp->GetName() ) ); } else { // Both were gameobjects Hit( THAT ); HitOverlaps += THAT; // Retain collection of objects i'm overlapping with } } else { error( FS( "%s", *THAT->GetName() ) ); } }
void CMDIClient::OnSize(UINT nType, CSize size) { if (FS()->TabItem()) { FS()->TabItem()->GetChildFrame()->SetWindowPos(NULL, 0, 0, size.cx, size.cy, SWP_NOMOVE | SWP_NOZORDER); FS()->TabItem()->GetChildFrame()->PostMessage(WM_SIZE, 0, MAKELPARAM(size.cx, size.cy)); } }
long fswrite(Chan *c, void *va, long n, vlong offset) { int r; osenter(); r = pwrite(FS(c)->fd, va, n, offset); osleave(); if(r < 0) fserr(FS(c)); return r; }
void AGameObject::Walk( float t ) { CheckWaypoint(); // Alter destination based on locations of other units. FVector ToDest = Dest - Pos; // Clamp travel length so that we can't overshoot destination if( float Len = ToDest.Size() ) { Dir = ToDest / Len; // normalize if( !Stats.SpeedMax ) error( FS("%s had 0 speed", *GetName()) ); // I am maxing out the speed here. Speed = Stats.SpeedMax; // The direction of travel is modified by repulsion forces FVector repulsionForces = GetRepulsionForcesFromOverlappedUnits(); FVector modDir = Dir + repulsionForces; modDir.Normalize(); FVector Vel = modDir*Speed; //Game->flycam->DrawDebug( Pos, Pos + Vel, 5.f, FLinearColor::Red, 0.f ); FVector travel = Vel*t; // If travel exceeds destination, then jump to dest, // so we don't jitter over the final position. if( Len < travel.Size() ) { // snap to position & stop moving. Pos = Dest; // we are @ destination. travel = ToDest; // This is the displacement we actually moved. Speed = 0; } else { Pos += travel; if( Grounds ) { FVector newPos = Pos + UnitZ * 10.f; // Travel in direction plus some amount straight up. // The straight up amount ensures that the unit doesn't sink underground if( Game->flycam->SetOnGround( newPos ) ) Pos = newPos; else error( FS( "%s Object was trying to leave the ground plane.", *GetName() ) ); } SetRot( Dir.Rotation() ); } } else { // We're at the destination, so the velocity becomes 0 Speed = 0.f; } }
int fsstat(Chan *c, uchar *dp, int n) { if(FS(c)->fd >= 0) n = fstat(FS(c)->fd, dp, n); else n = stat(FS(c)->name->s, dp, n); if(n < 0) fserr(FS(c)); /* TO DO: change name to / if rootqid */ return n; }
int fswstat(Chan *c, uchar *dp, int n) { osenter(); if(FS(c)->fd >= 0) n = fwstat(FS(c)->fd, dp, n); else n = wstat(FS(c)->name->s, dp, n); osleave(); if(n < 0) fserr(FS(c)); return n; }
STDMETHODIMP CXRefreshToolbar::SetSite(IUnknown *pUnknownSite) { DT(TRACE_I(FS(_T("Toolbar[%08X]: SetSite(%08X)"), this, pUnknownSite))); try { if (!!pUnknownSite) { // attach the window HWND hWnd; CComPtr<IUnknown> site(pUnknownSite); CComQIPtr<IOleWindow> window(site); window->GetWindow(&hWnd); if (!hWnd) { TRACE_E(FS(_T("Toolbar[%08X]: Cannot retrieve toolbar base window"), this)); return E_FAIL; } SubclassWindow(hWnd); // get a WebBrowser reference CComQIPtr<IServiceProvider> serviceProvider(site); serviceProvider->QueryService(IID_IWebBrowserApp, IID_IWebBrowser2, (void**)&m_Browser); site->QueryInterface(IID_IInputObjectSite, (void**)&m_Site); // retrive browser id { BrowserManagerLock browserManager; m_BrowserId = browserManager->AllocBrowserId(m_Browser, this); ATLASSERT(m_BrowserId!=NULL_BROWSER); } // create main window CreateMainWindow(); } else { BrowserManagerLock browserManager; CBrowserMessageWindow* bw = browserManager->FindBrowserMessageWindow(m_BrowserId); ATLASSERT(bw); bw->SetToolbar(NULL); browserManager->ReleaseBrowserId(m_BrowserId); m_BrowserId = NULL_BROWSER; } } catch (CXRefreshRuntimeError &ex) { HandleError(ex.ErrorMessage()); return E_FAIL; } return S_OK; }
Chan* fsopen(Chan *c, int mode) { osenter(); FS(c)->fd = open(FS(c)->name->s, mode); osleave(); if(FS(c)->fd < 0) fserr(FS(c)); c->mode = openmode(mode); c->offset = 0; FS(c)->offset = 0; c->flag |= COPEN; return c; }
void AGameObject::Stealth() { // Iterate backwards to account for fact that objects removed from array // as we iterate. Because we remove objects from the Attackers array // as we iterate over it, we CANNOT use a range-based (for( AGameObject* go : Attackers)) style loop // (it would cause a runtime error). for( int i = Attackers.size() - 1; i >= 0; i-- ) (*Attackers.begin())->Attack( 0 ); if( Attackers.size() ) error( FS( "%s: There are %d attackers after losing all attackers", *Stats.Name, Attackers.size() ) ); for( int i = Followers.size() - 1; i >= 0; i-- ) (*Followers.begin())->Follow( 0 ); if( Followers.size() ) error( FS( "%s: There are %d followers after losing all followers", *Stats.Name, Followers.size() ) ); }
void AGameObject::OnRepulsionContactBegin_Implementation( AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult ) { //LOG( "OnRepulsionContactBegin" ); if( OtherActor == this ) { // Don't do anything with reports of collision with self. return; } // Make sure other component with defined overlap is AGameObject derivative. if( AGameObject *go = Cast<AGameObject>( OtherActor ) ) { //info( FS( "RepulsionContact: %s overlapped by %s/%s", *GetName(), *OtherActor->GetName(), *OtherComp->GetName() ) ); if( in( RepulsionOverlaps, go ) ) { warning( FS( "RepulsionContact: %s was already overlapped by %s %s", *GetName(), *OtherActor->GetName(), *OtherComp->GetName() ) ); } else { RepulsionOverlaps += go; } } }
void PExprTestLaunch() { char* sourceTest = "sourceTest.txt"; ifstream FS(sourceTest); string FN; while (true) { if (FS.eof()) break; getline(FS, FN); try { Parser P(FN.c_str()); P.ParserExprTEST(); P.PrintExprTree(FN.substr(0, FN.length() - 3) + "out", true); //printf("%lf\n", P.CalcTree()); } catch (exception a) { printf_s("\n%s\n\n", a.what()); continue; } } return; }
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // init_sequences // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void init_sequences() { extern Sequence_Wrapper g_sequences; // Local Variables SystemParameters sysParams; char filename[100]; gdk_threads_enter(); // Get GDK lock int Br = BITRATE(); int Bs = BLOCKSIZE(); char* Fn = SEQFILENAME(); int Fs = FS(); gdk_threads_leave(); // Release GDK lock // Set up system parameters sysParams.setSamplingRate(Fs); sysParams.setBlockSize(Bs); sysParams.setBitRate(Br); // Set up the sequences! g_snprintf(filename,100,"../res/%s",Fn); g_sequences.setSystemParameters(&sysParams); g_sequences.load_sequences_from_file(filename); g_sequences.print_sequences(); }
bool CheckExtraTree(FULogFile& fileOut, FCDExtra* extra, bool hasTypes) { FailIf(extra == NULL); // Find and verify the one technique FailIf(extra->GetDefaultType()->GetTechniqueCount() < 1); // note that FCDLight adds some <extra> elements of its own. FCDETechnique* technique = extra->GetDefaultType()->FindTechnique("FCTEI_TestProfile"); FailIf(technique == NULL); // Find and verify the base parameter tree node FailIf(technique->GetChildNodeCount() != 1); FCDENode* baseNode = technique->GetChildNode(0); PassIf(baseNode != NULL); PassIf(extra->GetDefaultType()->FindRootNode("MainParameterTree") == baseNode); // Verify the base node attributes PassIf(baseNode->GetAttributeCount() == 2); FCDEAttribute* a1 = baseNode->FindAttribute("Vicious"); FCDEAttribute* a2 = baseNode->FindAttribute("Gross"); FailIf(a1 == NULL); FailIf(a2 == NULL); FailIf(a1 == a2); PassIf(IsEquivalent(a1->GetValue(), FC("Squirrel"))); PassIf(IsEquivalent(FUStringConversion::ToUInt32(a2->GetValue()), (uint32)1002)); // Identify the base node leaves PassIf(baseNode->GetChildNodeCount() == 2); FCDENode* leaf0 = NULL,* leaf3 = NULL; for (size_t i = 0; i < 2; ++i) { FCDENode* leaf = baseNode->GetChildNode(i); PassIf(IsEquivalent(leaf->GetName(), "SomeParameter")); FCDEAttribute* guts = leaf->FindAttribute("Guts"); FailIf(guts == NULL || guts->GetValue().empty()); uint32 gutsIndex = FUStringConversion::ToUInt32(guts->GetValue()); if (gutsIndex == 0) { FailIf(leaf0 != NULL); leaf0 = leaf; } else if (gutsIndex == 3) { FailIf(leaf3 != NULL); leaf3 = leaf; } else Fail; } FailIf(leaf0 == NULL || leaf3 == NULL); // Verify the base node leaves PassIf(leaf0->GetChildNodeCount() == 0); PassIf(leaf3->GetChildNodeCount() == 0); PassIf(leaf0->GetAttributeCount() == 1); PassIf(leaf3->GetAttributeCount() == 1); PassIf(IsEquivalent(leaf0->GetContent(), FC("Test_SomeParameter"))); PassIf(IsEquivalent(leaf3->GetContent(), FS("Test_ThatParameter!"))); if (hasTypes) { // Verify the second extra type // Empty named-types should be imported without complaints or merging. FCDEType* secondType = extra->FindType("verificator"); PassIf(secondType != NULL); PassIf(secondType != extra->GetDefaultType()); PassIf(secondType->GetTechniqueCount() == 0); } return true; }
STDMETHODIMP CUpgradrScriptDebugger::OnDebugOutput(LPCOLESTR pstr) { Sleep(0); DT(TRACE_W(FS(_T("CUpgradrScriptDebugger::OnDebugOutput(%S)"), pstr))); return S_OK; }
STDMETHODIMP CUpgradrScriptDebugger::OnSetName(LPCOLESTR pstrName) { Sleep(0); DT(TRACE_W(FS(_T("CUpgradrScriptDebugger::OnSetName(%S)"), pstrName))); return S_OK; }
void ToolPageLayer::setLayerCount(int layer, int selected) { XOJ_CHECK_TYPE(ToolPageLayer); this->inCbUpdate = true; int count = gtk_tree_model_iter_n_children(gtk_combo_box_get_model(GTK_COMBO_BOX(this->layerComboBox)), NULL); for (int i = count - 1; i >= 0; i--) { gtk_combo_box_remove_text(GTK_COMBO_BOX(this->layerComboBox), i); } gtk_combo_box_append_text(GTK_COMBO_BOX(this->layerComboBox), _C("Background")); for (int i = 1; i <= layer; i++) { string text = FS(_F("Layer {1}") % i); gtk_combo_box_prepend_text(GTK_COMBO_BOX(this->layerComboBox), text.c_str()); } setSelectedLayer(selected); this->layerCount = layer; this->inCbUpdate = false; }
void CAddrDropDownList::OnLButtonUp(UINT nFlags, CPoint point) { SCROLLINFO si = { sizeof(SCROLLINFO), SIF_POS }; GetScrollInfo(SB_VERT, &si); int iDelta = s()->Combo()->GetComboDropdownItemBackgroundHeight(m_bBigDropDown); int iSelection = (point.y + si.nPos) / iDelta; RECT rcClient; GetClientRect(&rcClient); RECT rcItem = { 0, iSelection*iDelta, rcClient.right, (iSelection + 1) * iDelta }; CPoint pt = point; pt.y += si.nPos; // µãµ½XÉÏÁË if (Btn_MouseOver == GetDelButtonStatus(rcItem, pt)) { RemoveDropDownSelection(iSelection); } else { FS()->AddrCombo()->StartNavigate(1 + m_LocalData[iSelection].iType, 0, m_LocalData[iSelection].strURL); } }
STDMETHODIMP CXRefreshBHO::OnWindowStateChanged(DWORD dwFlags, DWORD dwValidFlagsMask) { DTI(TRACE_LI(FS(_T("BHO[%08X]: OnWindowStateChanged()"), this))); m_IE7ToolWindow.SetParent(this); return S_OK; }
STDMETHODIMP CXRefreshBHO::OnWindowTitleChanged(BSTR bstrTitleText) { DTI(TRACE_LI(FS(_T("BHO[%08X]: OnWindowTitleChanged()"), this))); SendInfoAboutPage(); return S_OK; }
void CMDIClient::ClosePage(CTabItem *pItem) { ATLASSERT(pItem); if (pItem->m_pCategory->GetWebData()->IsNoClose()) return; if (m_TabCtrl.GetTabItems().size() == 1) { // 只剩一个,则关闭category CloseCategory(pItem->m_pCategory); return; } CTabItem *pNewItem = FS()->TabItem(); if (pItem == pNewItem) { pNewItem = m_TabCtrl.GetLeftOrRight(pItem, true, false); ActivePage(pNewItem); } pItem->m_pCategory->m_TabItems.erase(pItem->m_pCategory->m_TabItems.begin() + pItem->GetIndex()); pItem->m_pCategory->Redraw(); m_TabCtrl.DeleteItem(pItem->GetIndex()); bool isTrueClose = true; if(isIE6 && wcscmp(pItem->m_pCategory->GetWebData()->GetName() , L"支付宝") == 0) isTrueClose = false; if(isIE6 && pItem->m_pCategory->m_ShowInfo == L"支付宝") isTrueClose = false; pItem->GetChildFrame()->OptionalDestroy(0, isTrueClose); }
void AGameObject::PostInitializeComponents() { //LOG( "%s [%s]->AGameObject::PostInitializeComponents()", *GetName(), *Name ); Super::PostInitializeComponents(); if( RootComponent ) { // Initialize position, but put object on the ground SetPosition( GetActorLocation() ); // Attach contact function to all bounding components. if( hitBox ) { hitBox->OnComponentBeginOverlap.AddDynamic( this, &AGameObject::OnHitContactBegin ); hitBox->OnComponentEndOverlap.AddDynamic( this, &AGameObject::OnHitContactEnd ); } else error( "NO HITBOX" ); if( repulsionBounds ) { repulsionBounds->OnComponentBeginOverlap.AddDynamic( this, &AGameObject::OnRepulsionContactBegin ); repulsionBounds->OnComponentEndOverlap.AddDynamic( this, &AGameObject::OnRepulsionContactEnd ); } else error( "NO REPULSIONBOUNDS" ); } else { error( FS( "RootComponent wasn't set in PostInitializeComponents()" ) ); } UpdateStats( 0.f ); Hp = Stats.HpMax; Speed = 0.f; Recovering = 1; //InitIcons(); }
STDMETHODIMP CXRefreshToolbar::GetWindow(HWND *phwnd) { DT(TRACE_I(FS(_T("Toolbar[%08X]: GetWindow(%08X)"), this, phwnd))); *phwnd = m_Toolbar; return S_OK; }
void ATheHUD::Unselect( vector<AGameObject*> objects ) { // If none of the objects are in the selection, there's no change. if( !in<AGameObject*>( Selected, objects ) ) { error( FS( "None of objects [%s] were in Selected [%s], nothing to unselect", *GetNames( objects ), *GetNames( Selected ) ) ); return; } for( AGameObject* go : objects ) { // Remove any selectors on there go->RemoveTagged( Game->flycam->SelectedTargetName ); // If I'm the only selected unit with on follow target then remove follow target selection // If go is the only follower / attacker in Selected, then remove the marker. if( go->FollowTarget ) if( Intersection<AGameObject>( Selected, go->FollowTarget->Followers ).size() <= 1 ) go->RemoveTagged( Game->flycam->FollowTargetName ); if( go->AttackTarget ) if( Intersection( Selected, go->AttackTarget->Attackers ).size() <= 1 ) go->RemoveTagged( Game->flycam->AttackTargetName ); } operator-=<AGameObject*>( Selected, objects ); //Reselect selected, to refresh the selectors on attack targets. Select( Selected ); }
STDMETHODIMP CUpgradrHelperbar::GetWindow(HWND *phwnd) { DT(TRACE_I(FS(_T("Helperbar[%08X]: GetWindow(%08X)"), this, phwnd))); *phwnd = m_MainWindow; return S_OK; }
void CTuotuoCategoryCtrl::OnLButtonDown(UINT /* nFlags */, CPoint ptCursor) { //CSogouToolTip::GetTooltip()->RelayEventSingleton(m_hWnd, INVALID_ITEM); if (::PtInRect(&m_rcTabItemAreaDraw, ptCursor)) { CategoryPosition pos; CCategoryItem *pItem = HitTest(ptCursor, &pos); if (pItem) { SetMousePosAndStatus(pos, Btn_MouseDown); if (pItem != m_pSelectedItem && pos == CatePos_TabItem) FS()->MDI()->ActiveCategory(pItem); else if (pItem == m_pSelectedItem) EnsureVisible(pItem); } } else if (m_bOverflowLeft && ::PtInRect(&m_rcScrollLLeft, ptCursor)) { SetMousePosAndStatus(CatePos_ScrollLLeftBtn, Btn_MouseDown); SetScrollDir(-1); } else if (m_bOverflowRight && ::PtInRect(&m_rcScrollRRight, ptCursor)) { SetMousePosAndStatus(CatePos_ScrollRRightBtn, Btn_MouseDown); SetScrollDir(1); } else SetMousePosAndStatus(CatePos_Unknown, Btn_MouseOut); if (m_ePosition != CatePos_Unknown) SetCapture(); }
void CConnectionManager::RegistryWatchDogThread() { HKEY hKey; if (RegOpenKeyEx(HKEY_CURRENT_USER, REGISTRY_ROOT_KEY_SITES_PARENT, 0, KEY_NOTIFY, &hKey) != ERROR_SUCCESS) { TRACE_E(FS(_T("Registry watchdog thread unable to open registry key: %s"), REGISTRY_ROOT_KEY_SITES_PARENT)); _endthreadex(2); return; } while (true) { if (RegNotifyChangeKeyValue(hKey, TRUE, REG_NOTIFY_CHANGE_NAME|REG_NOTIFY_CHANGE_LAST_SET, NULL, FALSE)!=ERROR_SUCCESS) { TRACE_E(_T("Registry watchdog thread unable to setup next waiting operation")); _endthreadex(1); return; } TRACE_W(_T("Registry watchdog triggered")); m_CS.Enter(); m_SitesModel.Load(REGISTRY_ROOT_KEY_SITES); m_CS.Leave(); TRACE_W(_T("Sites model reloaded!")); } RegCloseKey(hKey); _endthread(); }