void RAIN::ConnectionPool::ConnectPeer(RAIN::PeerID *pid) { /* check we're not connecting to ourselves */ if (globalCredentialManager->GetMyPeerID()->HashMatches(pid->hash)) { wxLogVerbose("RAIN::ConnectionPool: Tried to connect to ourselves - ignored"); return; } /* check we're not duplicating connections */ for (size_t i = 0; i < this->pool.size(); i++) { if (this->pool.at(i) && this->pool.at(i)->isConnected && this->pool.at(i)->pid->HashMatches(pid->hash)) { wxLogVerbose("RAIN::ConnectionPool: Tried to connect to already connected peer - ignored"); return; } } /* add default port */ wxString addr = pid->address; if (!addr.Contains(":")) { addr = wxString::Format("%s:%d", addr.c_str(), DEFAULT_PORT); } this->ConnectPeer(addr); }
void muFrame::TryUpdating() { if( !m_integrityDone || !m_locatorDone ) return; if( m_latestVersion <= m_currentVersion ) { wxLogVerbose(wxT("You have the latest version! %d"), m_currentVersion); m_detailsLabel->SetLabel(wxString::Format(wxT("Your Gunreal v%i is the latest version."), m_currentVersion)); Close(true); } else { wxLogVerbose(wxT("Updated version available! %d"), m_latestVersion); m_detailsLabel->SetLabel(wxString::Format(wxT("Downloading Gunreal v%i..."), m_latestVersion)); DisplayUpdatingProgress(); // Updating Thread muThread_Updater* updatingThread = new muThread_Updater(this, m_currentVersion, m_latestVersion, m_latestURL); if( updatingThread->Create() != wxTHREAD_NO_ERROR ) { wxLogError(wxT("Can't create muThread_Updater!")); Close(true); } if( updatingThread->Run() != wxTHREAD_NO_ERROR ) { wxLogError(wxT("Can't start muThread_Updater!")); Close(true); } } }
void MyProcessOutput::m_cancel_processOnButtonClick( wxCommandEvent& WXUNUSED(event) ) { if (m_process) { long pid = m_process->GetPid(); wxLogVerbose("terminate pid %ld", pid); if (!wxProcess::Exists(pid)) { wxLogVerbose("process doesn't exist anymore"); return; } int answer = wxMessageBox(_("Are you sure you want to forcefully terminate freshclam?"), _("Force terminate freshclam?"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION, this); if (answer != wxYES) return; wxLogVerbose("kill pid %ld", pid); wxKillError rc = wxProcess::Kill(pid, wxSIGKILL); if (rc != wxKILL_OK) { wxLogVerbose("kill pid %ld failed: %d", pid, rc); wxLogWarning(_("Failed to terminate process")); return; } wxLogVerbose("killed pid %ld", pid); /* wxProcessEvent event(0,pid,255); OnTerminate(event);*/ return; } // this is really the close button now EndModal(wxOK); }
~Log() { if (_messages.size() <= 1) { return; } // Build the file name for storing this game auto file = Helper::GetUserDataDir(); file.SetFullName(wxString::Format("%i.hsl", int(_messages[0].first / int(1e9)))); file.AppendDir("Logged"); auto filename = file.GetFullPath(); wxLogVerbose("saving %d messages to %s", _messages.size() - 1, filename); // Create the containing directory if needed if (!file.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL)) { wxLogError("error creating save directory: %s", filename); return; } // This should't happen, but check and log just in case if (file.Exists()) { wxLogWarning("overwriting existing game: %s", filename); } // Open the file wxFileOutputStream fout(file.GetFullPath()); if (!fout.Ok()) { wxLogError("error opening file: %s", filename); return; } // Zip the data while saving it to save some bandwidth later when the file is uploaded wxZlibOutputStream zout(fout, wxZ_BEST_COMPRESSION, wxZLIB_NO_HEADER); // Add header info // <nanotime> // 48 53 4C 48 09 00 00 00 // 09 XX XX XX XX XX XX XX XX auto version = Helper::GetHearthstoneVersion(); zout.Write(&_messages[0].first, 8) .Write("HSLH\t\0\0\0\t", 9) // HSLH 09000000 09 .Write(&version, 8); // Add the rest of the data auto size = 25; for (auto i = 1u; i < _messages.size(); i++) { auto time = _messages[i].first; auto msg = _messages[i].second; size += 8 + msg.size(); zout.Write(&time, 8).Write(msg.data(), msg.size()); } zout.Close(); wxLogVerbose("saved %d messages from %s (%d bytes, %lld compressed)", _messages.size() - 1, _name, size, fout.GetLength()); // Notify the app that it can upload the log file HearthLogApp::UploadLog(filename); }
void MyFrame::OnPropertyGridChange(wxPropertyGridEvent &event) { wxPGProperty* p = event.GetProperty(); if ( p ) { wxLogVerbose("OnPropertyGridChange(%s, value=%s)", p->GetName(), p->GetValueAsString()); } else { wxLogVerbose("OnPropertyGridChange(NULL)"); } }
void cRawParser::ParseCID(cXmlNode& node) { USE_PREFIX(node); cCarriedItem cid; cid.name = ParseString(node, wxT(RAWXML_CID), wxT("name"), NULL, useprefix).ToAscii(); cid.nametxt = ParseString(node, wxT(RAWXML_CID), wxT("nametxt"), NULL, useprefix).ToAscii(); cid.pluralnametxt = ParseString(node, wxT(RAWXML_CID), wxT("pluralnametxt"), NULL, useprefix).ToAscii(); wxLogVerbose(wxString::Format(_("Adding cid %s to %s."), wxString(cid.name.c_str(), wxConvLocal).c_str(), m_output.GetFullPath().c_str())); cXmlNode child(node.children()); while (child) { DO_CONDITION_COMMENT(child); if (child(RAWXML_CID_SHAPE)) { USE_PREFIX(child); cid.shape.shaped = ParseUnsigned(child, wxT(RAWXML_CID_SHAPE), wxT("shaped")); if (cid.shape.shaped) { cid.shape.shape1 = ParseString(child, wxT(RAWXML_CID_SHAPE), wxT("shape1"), NULL, useprefix).ToAscii(); cid.shape.shape2 = ParseString(child, wxT(RAWXML_CID_SHAPE), wxT("shape1"), NULL, useprefix).ToAscii(); } else { cid.shape.MakeBillboard(); cid.shape.fts = ParseString(child, wxT(RAWXML_CID_SHAPE), wxT("ftx"), NULL, useprefix).ToAscii(); } OPTION_PARSE(float, cid.shape.unk9, ParseFloat(child, wxT(RAWXML_CID_SHAPE), wxT("distance"))); OPTION_PARSE(unsigned long, cid.shape.defaultcolour, ParseUnsigned(child, wxT(RAWXML_CID_SHAPE), wxT("defaultcolour"))); OPTION_PARSE(float, cid.shape.scalex, ParseFloat(child, wxT(RAWXML_CID_SHAPE), wxT("scalex"))); OPTION_PARSE(float, cid.shape.scaley, ParseFloat(child, wxT(RAWXML_CID_SHAPE), wxT("scaley"))); } else if (child(RAWXML_CID_MORE)) { USE_PREFIX(child); OPTION_PARSE(unsigned long, cid.addonpack, ParseUnsigned(child, wxT(RAWXML_CID_MORE), wxT("addonpack"))); ParseStringOption(cid.icon, child, wxT("icon"), NULL, useprefix); } else if (child(RAWXML_CID_EXTRA)) {
void IRCDDBApp::userLeave (const wxString& nick) { wxMutexLocker lock(d->userMapMutex); wxString lnick = nick; lnick.MakeLower(); d->user.erase(lnick); // wxLogVerbose(wxT("rm %d: ") + nick, d->user.size()); if (d->currentServer.Len() > 0) { if (d->user.count(d->myNick) != 1) { wxLogVerbose(wxT("IRCDDBApp::userLeave: could not find own nick")); return; } IRCDDBAppUserObject me = d->user[d->myNick]; if (me.op == false) { // if I am not op, then look for new server if (d->currentServer.IsSameAs(lnick)) { // currentServer = null; d->state = 2; // choose new server d->timer = 200; d->initReady = false; } } } }
void cRawParser::ParseCHG(cXmlNode& node) { USE_PREFIX(node); cChangingRoom room; room.name = ParseString(node, wxT(RAWXML_CHG), wxT("name"), NULL, useprefix).ToAscii(); room.attraction.name = ParseString(node, wxT(RAWXML_CHG), wxT("nametxt"), NULL, useprefix).ToAscii(); room.attraction.description = ParseString(node, wxT(RAWXML_CHG), wxT("description"), NULL, useprefix).ToAscii(); room.sid = ParseString(node, wxT(RAWXML_CHG), wxT("sid"), NULL, useprefix).ToAscii(); room.spline = ParseString(node, wxT(RAWXML_CHG), wxT("roomspline"), NULL, useprefix).ToAscii(); wxLogVerbose(wxString::Format(_("Adding chg %s to %s."), wxString(room.name.c_str(), wxConvLocal).c_str(), m_output.GetFullPath().c_str())); cXmlNode child(node.children()); while (child) { DO_CONDITION_COMMENT(child); if (child(RAWXML_ATTRACTION)) { ParseAttraction(child, room.attraction); } else if (child.element()) { throw MakeNodeException<RCT3Exception>(wxString::Format(_("Unknown tag '%s' in chg tag"), child.wxname().c_str()),child); } child.go_next(); } ovlCHGManager* c_chg = m_ovl.GetManager<ovlCHGManager>(); c_chg->AddRoom(room); }
void muFrame::OnUpdateDownload(UpdaterEvent& event) { wxString changelog = event.GetString(); wxLogVerbose(wxT("Displaying changelog: %s"), changelog.c_str()); wxLaunchDefaultBrowser(changelog); RequestUserAttention(); }
void SigUIFrame::show_db(bool first) { wxLogNull logNo; char msg[512]; wxFileName filename(GetExecPath() + "lastupd"); if (!filename.IsFileReadable()) return; wxFile file(filename.GetFullPath()); if (!file.IsOpened()) return; memset(&msg, 0, sizeof(msg)); if (file.Read(msg, sizeof(msg) - 1) <= 0) return; wxString line = wxString(msg).BeforeFirst('\n'); wxString text = statusBar->GetStatusText(0); statusBar->SetStatusText(line, 0); if (first || lastmsg == msg) return; lastmsg = msg; //only show when changed, and not the first time if (icon->IsIconInstalled()) icon->RemoveIcon();//remove old balloon icon->SetIcon(GetIcon()); line = wxString(msg).AfterFirst('\n'); #ifdef _WIN32 icon->ShowBalloon(_("ClamAV database reloaded"), line, wxICON_INFORMATION); #endif wxFileName filename0(GetExecPath() + "forcerld"); wxLogVerbose("Reload delta: %s", filename.GetModificationTime().Subtract( filename0.GetModificationTime() ).Format()); }
void muFrame::OnURLGetterProgress(UpdaterEvent& event) { m_locatorProgress = wxDouble(event.GetInt()) / wxDouble(event.GetExtraLong()); DisplayCheckingProgress(); if( !event.GetString().IsEmpty() ) wxLogVerbose(wxT("[URLGetter] %s"), event.GetString().c_str()); }
void cRawParser::ParseGSI(cXmlNode& node) { USE_PREFIX(node); wxString name = ParseString(node, wxT(RAWXML_GSI), wxT("name"), NULL, useprefix); wxLogVerbose(wxString::Format(_("Adding gsi %s to %s."), name.c_str(), m_output.GetFullPath().c_str())); cGUISkinItem gsi; gsi.name = name.ToAscii(); wxString tex = ParseString(node, wxT(RAWXML_GSI), wxT("tex"), NULL, useprefix); gsi.texture = tex.ToAscii(); OPTION_PARSE(unsigned long, gsi.unk2, ParseUnsigned(node, RAWXML_GSI, "unk")); if (node.hasProp("type")) { gsi.gsi_type = ParseUnsigned(node, RAWXML_GSI, "type"); foreach(const cXmlNode& child, node.children()) { USE_PREFIX(child); DO_CONDITION_COMMENT_FOR(child); if (child(RAWXML_GSI_POSITION)) { unsigned long p = HandleUnsignedContent(child.wxcontent(), child, RAWXML_GSI_POSITION); gsi.values.push_back(p); } else if (child.element()) { throw MakeNodeException<RCT3Exception>(wxString::Format(_("Unknown tag '%s' in gsi(%s) tag"), child.wxname().c_str(), name.c_str()), child); } } } else {
void gravUtil::logVerbose( const char* str, ... ) { va_list args; va_start( args, str ); wxLogVerbose( getWXStringFromArgs( str, args ) ); va_end( args ); }
/** Creates a listener thread which opens an SSL socket * and creates connections for each received connection. */ RAIN::ConnectionListener::ConnectionListener(RAIN::ConnectionPool *cp) : wxThreadHelper() { this->connectionPool = cp; wxLogVerbose(wxT("RAIN::ConnectionListener created")); this->Create(); }
void CScrolledTreeCtrl::OnSize(wxSizeEvent & event) { wxLogVerbose(wxT("CScrolledTreeCtrl::OnSize")); HideVScrollbar(); AdjustRemoteScrollbars(); event.Skip(); }
void muFrame::OnIntegrityProgress(UpdaterEvent& event) { m_integrityProgress = wxDouble(event.GetInt()) / wxDouble(event.GetExtraLong()); DisplayCheckingProgress(); if( !event.GetString().IsEmpty() ) wxLogVerbose(wxT("[Integrity] %s"), event.GetString().c_str()); }
void muFrame::OnUpdatingProgress(UpdaterEvent& event) { if( event.GetExtraLong() > 0.0f ) m_updatingProgress = wxDouble(event.GetInt()) / wxDouble(event.GetExtraLong()); else m_updatingProgress = 0.0f; DisplayUpdatingProgress(); if( !event.GetString().IsEmpty() ) wxLogVerbose(wxT("[Updater] %s"), event.GetString().c_str()); if( m_updatingProgress > 0 ) { double dlnow = event.GetInt(); double dltotal = event.GetExtraLong(); static wxStopWatch eventWatch; static double lastdl = 0; double dldelta = dlnow - lastdl; dldelta /= 1024.0f; lastdl = dlnow; eventWatch.Pause(); double speed = 0; if( eventWatch.Time() > 0.0f ) speed = dldelta / eventWatch.Time(); eventWatch.Start(); static double speedAvg = 0.0f; if( speed >= 0.0f ) speedAvg = (speedAvg*0.95f + speed*0.05f); wxString remainingText = wxT("?"); if( speedAvg > 0 ) { double secondsRemaining = (dltotal-dlnow) / 1024.0f / (speedAvg * 1000.0f); wxTimeSpan span = wxTimeSpan::Seconds(secondsRemaining); remainingText = span.Format(); } // update label every second only static wxStopWatch limitWatch; limitWatch.Pause(); if( limitWatch.Time() > 1000 ) { m_detailsLabel->SetLabel(wxString::Format( wxT("Downloading Gunreal v%i... %s remaining (%03.1lf MB at %0.0lf KB/s)") , m_latestVersion , remainingText.c_str() , dltotal / 1024.0f / 1024.0f , speedAvg * 1000.0f )); limitWatch.Start(); } else limitWatch.Resume(); } }
CScrolledTreeCtrl::CScrolledTreeCtrl(wxWindow * parent, wxWindowID id, const wxPoint & pt, const wxSize & sz, long style) :wxTreeCtrl(parent, id, pt, sz, style & ~wxTR_ROW_LINES) { m_companionWindow = NULL; m_drawRowLines = (style & wxTR_ROW_LINES) != 0; wxLogVerbose(wxT("Creating STC, style=%08lX"), style); }
void cRawParser::ParseUnset(const cXmlNode& node, bool command) { wxString name = ParseString(node, wxT(RAWXML_UNSET), wxT("unset"), NULL); wxLogVerbose(wxString::Format(_("Unsetting variable %s."), name.c_str())); if (command) m_commandvariables.erase(name); else m_variables.erase(name); }
wxString exec_cmd(const char* cmdstr) { char buffer[1024]; FILE *stream = popen(cmdstr, "r"); wxString sret; if (stream) { wxLogVerbose("start %s \n", cmdstr); while (!feof(stream)) { if (fgets(buffer, sizeof(buffer)-1, stream) != NULL) { sret.Append(buffer); } } pclose(stream); wxLogVerbose("end %s \n", cmdstr); } else sret.Printf("ERROR popen %s\n", cmdstr); return sret; }
void cRawParser::ParseSet(const cXmlNode& node, bool command, const wxString& tag) { wxString name = ParseString(node, tag, wxT("set"), NULL); if (node.hasProp("to")) { wxString value = ParseString(node, tag, wxT("to"), NULL); wxLogVerbose(wxString::Format(_("Setting variable %s to %s."), name.c_str(), value.c_str())); if (command) m_commandvariables[name] = value; else m_variables[name] = value; } else { wxLogVerbose(wxString::Format(_("Setting variable %s."), name.c_str())); if (command) m_commandvariables[name] = wxT("1"); else m_variables[name] = wxT("1"); } }
void muFrame::OnURLGetterDone(UpdaterEvent& event) { m_locatorDone = true; m_locatorProgress = 1.0f; DisplayCheckingProgress(); if( !event.GetString().IsEmpty() ) wxLogVerbose(wxT("[URLGetter] %s"), event.GetString().c_str()); if( event.GetInt() != Updater_Done ) { wxLogVerbose(wxT("Searching for latest version failed!")); } else { TryUpdating(); } }
void CScrolledTreeCtrl::OnScroll(wxScrollWinEvent & event) { wxLogVerbose(wxT(" CScrolledTreeCtrl::OnScroll")); int orient = event.GetOrientation(); if (orient == wxHORIZONTAL) { event.Skip(); return; } wxScrolledWindow *scrollWin = GetScrolledWindow(); if (!scrollWin) return; int x, y; scrollWin->GetViewStart(&x, &y); wxLogVerbose(wxT(" CScrolledTreeCtrl -> ScrollToLine()")); ScrollToLine(-1, y); }
void CScrolledTreeCtrl::HideVScrollbar() { #ifdef __WXMSW__ if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxLogVerbose(wxT("-+-+- CScrolledTreeCtrl::HideVScrollbar")); ::ShowScrollBar((HWND) GetHWND(), SB_VERT, false); } #endif }
void SigUIFrame::OnChange(wxFileSystemWatcherEvent &event) { if (event.IsError()) { wxLogVerbose("fswatcher error: %s", event.GetErrorDescription()); return; } wxLogVerbose("event on %s", event.GetPath().GetFullPath()); switch (event.GetChangeType()) { default: break; case wxFSW_EVENT_CREATE: case wxFSW_EVENT_MODIFY: wxFileName filename = event.GetPath(); if (filename.GetName() != "lastupd") return; show_db(false); break; } }
void muFrame::OnClose(wxCloseEvent& event) { wxLogVerbose(wxT("Closing...")); if( m_startGame ) { wxGetApp().StartGame(); } event.Skip(); }
void Add(int64_t nanotime, Bytes message) { if (WasCanceled()) { // Cancel was called previously, so don't store messages anymore return; } _messages.emplace_back(nanotime, message); auto header = reinterpret_cast<int32_t *>(message.data()); wxLogVerbose("%lld %s (%d, %d)", nanotime, _name, header[0], header[1]); }
void muFrame::OnLatestVersion(UpdaterEvent& event) { int version = event.GetInt(); if( version >= m_latestVersion ) { m_latestVersion = version; m_latestURL.Add(event.GetString()); // Log wxLogVerbose(wxT("Latest version: %d at: %s"), version, event.GetString().c_str()); } }
void IRCDDBApp::rptrQTH(const wxString& callsign, double latitude, double longitude, const wxString& desc1, const wxString& desc2, const wxString& infoURL) { wxString pos; pos.Printf(wxT("%+09.5f %+010.5f"), latitude, longitude); wxString cs = callsign; wxString d1 = desc1; wxString d2 = desc2; d1.Append(wxT(' '), 20); d2.Append(wxT(' '), 20); wxRegEx nonValid(wxT("[^a-zA-Z0-9 +&(),./'-]")); nonValid.Replace(&d1, wxEmptyString); nonValid.Replace(&d2, wxEmptyString); pos.Replace(wxT(","), wxT(".")); d1.Replace(wxT(" "), wxT("_")); d2.Replace(wxT(" "), wxT("_")); cs.Replace(wxT(" "), wxT("_")); wxMutexLocker lock(d->moduleQTHURLMutex); d->moduleQTH[cs] = cs + wxT(" ") + pos + wxT(" ") + d1.Mid(0, 20) + wxT(" ") + d2.Mid(0, 20); wxLogVerbose(wxT("QTH: ") + d->moduleQTH[cs]); wxString url = infoURL; wxRegEx urlNonValid(wxT("[^[:graph:]]")); urlNonValid.Replace(&url, wxEmptyString); if (!url.IsEmpty()) { d->moduleURL[cs] = cs + wxT(" ") + url; wxLogVerbose(wxT("URL: ") + d->moduleURL[cs]); } d->infoTimer = 5; // send info in 5 seconds }
wxScrolledWindow *CScrolledTreeCtrl::GetScrolledWindow() const { //wxLogVerbose(wxT("CScrolledTreeCtrl::GetScrolledWindow")); wxWindow *parent = wxWindow::GetParent(); while (parent) { if (parent->IsKindOf(CLASSINFO(wxScrolledWindow))) { return (wxScrolledWindow *) parent; } parent = parent->GetParent(); } wxLogVerbose(wxT("CScrolledTreeCtrl::GetScrolledWindow(!!NONE!!)")); return NULL; }