本文整理汇总了C++中FormatVersion函数的典型用法代码示例。如果您正苦于以下问题:C++ FormatVersion函数的具体用法?C++ FormatVersion怎么用?C++ FormatVersion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FormatVersion函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildUpdateFields
void CsUpdateFieldDumper::Dump()
{
BuildUpdateFields(ObjectFields, "ObjectField", GetInputData()->ObjectFields, "OBJECT_END", "");
BuildDynamicUpdateFields(ObjectDynamicFields, "ObjectDynamicField", std::vector<DynamicUpdateField>(), "OBJECT_DYNAMIC_END", "");
BuildUpdateFields(ItemFields, "ItemField", GetInputData()->ItemFields, "ITEM_END", "ObjectField.OBJECT_END");
BuildDynamicUpdateFields(ItemDynamicFields, "ItemDynamicField", GetInputData()->ItemDynamicFields, "ITEM_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END");
BuildUpdateFields(ContainerFields, "ContainerField", GetInputData()->ContainerFields, "CONTAINER_END", "ItemField.ITEM_END");
BuildDynamicUpdateFields(ContainerDynamicFields, "ContainerDynamicField", std::vector<DynamicUpdateField>(), "CONTAINER_DYNAMIC_END", "ItemDynamicField.ITEM_DYNAMIC_END");
BuildUpdateFields(UnitFields, "UnitField", GetInputData()->UnitFields, "UNIT_END", "ObjectField.OBJECT_END");
BuildDynamicUpdateFields(UnitDynamicFields, "UnitDynamicField", GetInputData()->UnitDynamicFields, "UNIT_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END");
BuildUpdateFields(PlayerFields, "PlayerField", GetInputData()->PlayerFields, "PLAYER_END", "UnitField.UNIT_END");
BuildDynamicUpdateFields(PlayerDynamicFields, "PlayerDynamicField", GetInputData()->PlayerDynamicFields, "PLAYER_DYNAMIC_END", "UnitDynamicField.UNIT_DYNAMIC_END");
BuildUpdateFields(GameObjectFields, "GameObjectField", GetInputData()->GameObjectFields, "GAMEOBJECT_END", "ObjectField.OBJECT_END");
BuildDynamicUpdateFields(GameObjectDynamicFields, "GameObjectDynamicField", GetInputData()->GameObjectDynamicFields, "GAMEOBJECT_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END");
BuildUpdateFields(DynamicObjectFields, "DynamicObjectField", GetInputData()->DynamicObjectFields, "DYNAMICOBJECT_END", "ObjectField.OBJECT_END");
BuildDynamicUpdateFields(DynamicObjectDynamicFields, "DynamicObjectDynamicField", std::vector<DynamicUpdateField>(), "DYNAMICOBJECT_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END");
BuildUpdateFields(CorpseFields, "CorpseField", GetInputData()->CorpseFields, "CORPSE_END", "ObjectField.OBJECT_END");
BuildDynamicUpdateFields(CorpseDynamicFields, "CorpseDynamicField", std::vector<DynamicUpdateField>(), "CORPSE_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END");
BuildUpdateFields(AreaTriggerFields, "AreaTriggerField", GetInputData()->AreaTriggerFields, "AREATRIGGER_END", "ObjectField.OBJECT_END");
BuildDynamicUpdateFields(AreaTriggerDynamicFields, "AreaTriggerDynamicField", std::vector<DynamicUpdateField>(), "AREATRIGGER_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END");
BuildUpdateFields(SceneObjectFields, "SceneObjectField", GetInputData()->SceneObjectFields, "SCENEOBJECT_END", "ObjectField.OBJECT_END");
BuildDynamicUpdateFields(SceneObjectDynamicFields, "SceneObjectDynamicField", std::vector<DynamicUpdateField>(), "SCENEOBJECT_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END");
BuildUpdateFields(ConversationFields, "ConversationField", GetInputData()->ConversationFields, "CONVERSATION_END", "ObjectField.OBJECT_END");
BuildDynamicUpdateFields(ConversationDynamicFields, "ConversationDynamicField", GetInputData()->ConversationDynamicFields, "CONVERSATION_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END");
std::ofstream updateFieldsDump("UpdateFields.cs");
updateFieldsDump << "namespace WowPacketParserModule.V" << FormatVersion("_") << ".Enums" << std::endl;
updateFieldsDump << "{" << std::endl;
updateFieldsDump << Tab << "// ReSharper disable InconsistentNaming" << std::endl;
updateFieldsDump << Tab << "// " << FormatVersion(".") << std::endl;
DumpEnums(updateFieldsDump);
updateFieldsDump << Tab << "// ReSharper restore InconsistentNaming" << std::endl;
updateFieldsDump << "}" << std::endl;
updateFieldsDump.close();
}
示例2: main
int main()
{
FormatVersion(2,2,1,GetCompilation());
FormatCompany(_T("Ssoor Corporation(www.ssoor.com)"),_T("Ssoor(R) Software(R) Internet cafe"),_T("(C) Ssoor Corporation. All rights reserved."));
SaveResourceInfo();
return 0;
}
示例3: FormatVersion
bool FileHDF5::checkHeader(FileMode mode) const {
bool check = true;
vector<int> vv;
string str;
if (root.hasAttr("format")) {
if (!root.getAttr("format", str) || str != FILE_FORMAT) {
check = false;
}
} else {
check = false;
}
if (check && root.hasAttr("version")) {
if (!root.getAttr("version", vv)) {
check = false;
} else {
FormatVersion ver = FormatVersion(vv);
if (mode == FileMode::ReadWrite) {
check = my_version.canWrite(ver);
} else {
check = my_version.canRead(ver);
}
}
} else {
check = false;
}
return check;
}
示例4: FormatSubVersion
// Format the subversion field according to BIP 14 spec (https://en.bitcoin.it/wiki/BIP_0014)
std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments)
{
std::ostringstream ss;
ss << "/";
ss << name << ":" << FormatVersion(nClientVersion);
if (!comments.empty())
ss << "(" << boost::algorithm::join(comments, "; ") << ")";
ss << "/";
return ss.str();
}
示例5: FormatSubVersion
/**
* Format the subversion field according to BIP 14 spec (https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki)
*/
std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments)
{
std::ostringstream ss;
ss << "/";
ss << name << ":" << FormatVersion(nClientVersion);
if (!comments.empty()) {
std::vector<std::string>::const_iterator it(comments.begin());
ss << "(" << *it;
for (++it; it != comments.end(); ++it)
ss << "; " << *it;
ss << ")";
}
ss << "/";
return ss.str();
}
示例6: BuildUpdateFields
void CppUpdateFieldDumper::Dump()
{
BuildUpdateFields(ObjectFields, "ObjectFields", GetInputData()->ObjectFields, "OBJECT_END", "");
BuildDynamicUpdateFields(ObjectDynamicFields, "ObjectDynamicFields", std::vector<DynamicUpdateField>(), "OBJECT_DYNAMIC_END", "");
BuildUpdateFields(ItemFields, "ItemFields", GetInputData()->ItemFields, "ITEM_END", "OBJECT_END");
BuildDynamicUpdateFields(ItemDynamicFields, "ItemDynamicFields", GetInputData()->ItemDynamicFields, "ITEM_DYNAMIC_END", "OBJECT_DYNAMIC_END");
BuildUpdateFields(ContainerFields, "ContainerFields", GetInputData()->ContainerFields, "CONTAINER_END", "ITEM_END");
BuildDynamicUpdateFields(ContainerDynamicFields, "ContainerDynamicFields", std::vector<DynamicUpdateField>(), "CONTAINER_DYNAMIC_END", "ITEM_DYNAMIC_END");
BuildUpdateFields(UnitFields, "UnitFields", GetInputData()->UnitFields, "UNIT_END", "OBJECT_END");
BuildDynamicUpdateFields(UnitDynamicFields, "UnitDynamicFields", GetInputData()->UnitDynamicFields, "UNIT_DYNAMIC_END", "OBJECT_DYNAMIC_END");
BuildUpdateFields(PlayerFields, "PlayerFields", GetInputData()->PlayerFields, "PLAYER_END", "UNIT_END");
Enum::Member head = *(PlayerFields.E.GetMember("PLAYER_FIELD_INV_SLOT_HEAD"));
head.ValueName = "PLAYER_FIELD_END_NOT_SELF";
head.Comment = "";
PlayerFields.E.AddMemberSorted(std::move(head));
BuildDynamicUpdateFields(PlayerDynamicFields, "PlayerDynamicFields", GetInputData()->PlayerDynamicFields, "PLAYER_DYNAMIC_END", "UNIT_DYNAMIC_END");
BuildUpdateFields(GameObjectFields, "GameObjectFields", GetInputData()->GameObjectFields, "GAMEOBJECT_END", "OBJECT_END");
BuildDynamicUpdateFields(GameObjectDynamicFields, "GameObjectDynamicFields", GetInputData()->GameObjectDynamicFields, "GAMEOBJECT_DYNAMIC_END", "OBJECT_DYNAMIC_END");
BuildUpdateFields(DynamicObjectFields, "DynamicObjectFields", GetInputData()->DynamicObjectFields, "DYNAMICOBJECT_END", "OBJECT_END");
BuildDynamicUpdateFields(DynamicObjectDynamicFields, "DynamicObjectDynamicFields", std::vector<DynamicUpdateField>(), "DYNAMICOBJECT_DYNAMIC_END", "OBJECT_DYNAMIC_END");
BuildUpdateFields(CorpseFields, "CorpseFields", GetInputData()->CorpseFields, "CORPSE_END", "OBJECT_END");
BuildDynamicUpdateFields(CorpseDynamicFields, "CorpseDynamicFields", std::vector<DynamicUpdateField>(), "CORPSE_DYNAMIC_END", "OBJECT_DYNAMIC_END");
BuildUpdateFields(AreaTriggerFields, "AreaTriggerFields", GetInputData()->AreaTriggerFields, "AREATRIGGER_END", "OBJECT_END");
BuildDynamicUpdateFields(AreaTriggerDynamicFields, "AreaTriggerDynamicFields", std::vector<DynamicUpdateField>(), "AREATRIGGER_DYNAMIC_END", "OBJECT_DYNAMIC_END");
BuildUpdateFields(SceneObjectFields, "SceneObjectFields", GetInputData()->SceneObjectFields, "SCENEOBJECT_END", "OBJECT_END");
BuildDynamicUpdateFields(SceneObjectDynamicFields, "SceneObjectDynamicFields", std::vector<DynamicUpdateField>(), "SCENEOBJECT_DYNAMIC_END", "OBJECT_DYNAMIC_END");
BuildUpdateFields(ConversationFields, "ConversationFields", GetInputData()->ConversationFields, "CONVERSATION_END", "OBJECT_END");
BuildDynamicUpdateFields(ConversationDynamicFields, "ConversationDynamicFields", GetInputData()->ConversationDynamicFields, "CONVERSATION_DYNAMIC_END", "OBJECT_DYNAMIC_END");
time_t now = time(nullptr);
tm date;
localtime_s(&date, &now);
date.tm_year += 1900;
std::ofstream updateFieldsDump("UpdateFields.h");
updateFieldsDump << "/*" << std::endl;
updateFieldsDump << " * Copyright (C) 2008-" << date.tm_year << " TrinityCore <http://www.trinitycore.org/>" << std::endl;
updateFieldsDump << " * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>" << std::endl;
updateFieldsDump << " *" << std::endl;
updateFieldsDump << " * This program is free software; you can redistribute it and/or modify it" << std::endl;
updateFieldsDump << " * under the terms of the GNU General Public License as published by the" << std::endl;
updateFieldsDump << " * Free Software Foundation; either version 2 of the License, or (at your" << std::endl;
updateFieldsDump << " * option) any later version." << std::endl;
updateFieldsDump << " *" << std::endl;
updateFieldsDump << " * This program is distributed in the hope that it will be useful, but WITHOUT" << std::endl;
updateFieldsDump << " * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or" << std::endl;
updateFieldsDump << " * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for" << std::endl;
updateFieldsDump << " * more details." << std::endl;
updateFieldsDump << " *" << std::endl;
updateFieldsDump << " * You should have received a copy of the GNU General Public License along" << std::endl;
updateFieldsDump << " * with this program. If not, see <http://www.gnu.org/licenses/>." << std::endl;
updateFieldsDump << " */" << std::endl;
updateFieldsDump << std::endl;
updateFieldsDump << "#ifndef _UPDATEFIELDS_H" << std::endl;
updateFieldsDump << "#define _UPDATEFIELDS_H" << std::endl;
updateFieldsDump << std::endl;
updateFieldsDump << "// Auto generated for version " << FormatVersion(", ") << std::endl;
updateFieldsDump << std::endl;
DumpEnums(updateFieldsDump);
updateFieldsDump << "#endif // _UPDATEFIELDS_H" << std::endl;
updateFieldsDump.close();
std::ofstream updateFieldFlags("UpdateFieldFlags.cpp");
updateFieldFlags << "/*" << std::endl;
updateFieldFlags << " * Copyright (C) 2008-" << date.tm_year << " TrinityCore <http://www.trinitycore.org/>" << std::endl;
updateFieldFlags << " *" << std::endl;
updateFieldFlags << " * This program is free software; you can redistribute it and/or modify it" << std::endl;
updateFieldFlags << " * under the terms of the GNU General Public License as published by the" << std::endl;
updateFieldFlags << " * Free Software Foundation; either version 2 of the License, or (at your" << std::endl;
updateFieldFlags << " * option) any later version." << std::endl;
updateFieldFlags << " *" << std::endl;
updateFieldFlags << " * This program is distributed in the hope that it will be useful, but WITHOUT" << std::endl;
updateFieldFlags << " * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or" << std::endl;
updateFieldFlags << " * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for" << std::endl;
updateFieldFlags << " * more details." << std::endl;
updateFieldFlags << " *" << std::endl;
updateFieldFlags << " * You should have received a copy of the GNU General Public License along" << std::endl;
updateFieldFlags << " * with this program. If not, see <http://www.gnu.org/licenses/>." << std::endl;
updateFieldFlags << " */" << std::endl;
updateFieldFlags << std::endl;
updateFieldFlags << "#include \"UpdateFieldFlags.h\"" << std::endl;
updateFieldFlags << std::endl;
DumpFlags(updateFieldFlags, "ItemUpdateFieldFlags[CONTAINER_END]",
{ &GetInputData()->ObjectFields, &GetInputData()->ItemFields, &GetInputData()->ContainerFields });
//.........这里部分代码省略.........
示例7: switch
/**
* @brief DLGPROC for C7ZipMismatchException's ReportError() popup.
*/
INT_PTR CALLBACK C7ZipMismatchException::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
theApp.TranslateDialog(hWnd);
if (GetDlgItem(hWnd, 9001) == NULL)
{
// Dialog template isn't up to date. Give it a second chance.
EndDialog(hWnd, -1);
return FALSE;
}
C7ZipMismatchException *pThis = (C7ZipMismatchException *)lParam;
CRawString<TCHAR,2600> cText;
CRawString<TCHAR,80> cPresent, cMissing, cOutdated, cNone, cPlugin;
if (pThis->m_pCause)
{
pThis->m_pCause->GetErrorMessage(cText.Data, cText.Size);
SetDlgItemText(hWnd, 107, cText.Data);
}
else
{
GetDlgItemText(hWnd, 107, cText.Data, cText.Size);
switch (GetOptionsMgr()->GetInt(OPT_ARCHIVE_ENABLE))
{
case 0:
lstrcat(cText.Data, theApp.LoadString(IDS_MERGE7Z_ENABLE_0).c_str());
break;
case 2:
lstrcat(cText.Data, theApp.LoadString(IDS_MERGE7Z_ENABLE_2).c_str());
break;
}
SetDlgItemText(hWnd, 107, cText.Data);
}
GetDlgItemText(hWnd, 112, cPresent.Data, cPresent.Size);
GetDlgItemText(hWnd, 122, cMissing.Data, cMissing.Size);
GetDlgItemText(hWnd, 132, cOutdated.Data, cOutdated.Size);
GetDlgItemText(hWnd, 120, cNone.Data, cNone.Size);
GetDlgItemText(hWnd, 102, cPlugin.Data, cPlugin.Size);
wsprintf(cText.Data, cPlugin.Data, DllBuild_Merge7z);
SetDlgItemText(hWnd, 102, cText.Data);
SetDlgItemText
(
hWnd, 109,
(
pThis->m_dwVer7zRecommended == pThis->m_dwVer7zInstalled
|| pThis->m_dwVer7zRecommended == pThis->m_dwVer7zLocal
) ? cPresent.Data : cMissing.Data
);
DWORD dwDllBuild = FormatVersion(cText.Data, cPlugin.Data, pThis->m_dwVer7zRecommended);
SetDlgItemText(hWnd, 110, *cText.Data ? cText.Data : cNone.Data);
SetDlgItemText(hWnd, 111, cPlugin.Data);
SetDlgItemText(hWnd, 112, *cPlugin.Data == '\0' ? cPlugin.Data :
dwDllBuild == ~0 ? cMissing.Data : dwDllBuild < DllBuild_Merge7z ? cOutdated.Data : cPresent.Data);
dwDllBuild = FormatVersion(cText.Data, cPlugin.Data, pThis->m_dwVer7zInstalled);
SetDlgItemText(hWnd, 120, *cText.Data ? cText.Data : cNone.Data);
SetDlgItemText(hWnd, 121, cPlugin.Data);
SetDlgItemText(hWnd, 122, *cPlugin.Data == '\0' ? cPlugin.Data :
dwDllBuild == ~0 ? cMissing.Data : dwDllBuild < DllBuild_Merge7z ? cOutdated.Data : cPresent.Data);
dwDllBuild = FormatVersion(cText.Data, cPlugin.Data, pThis->m_dwVer7zLocal);
SetDlgItemText(hWnd, 130, *cText.Data ? cText.Data : cNone.Data);
SetDlgItemText(hWnd, 131, cPlugin.Data);
SetDlgItemText(hWnd, 132, *cPlugin.Data == '\0' ? cPlugin.Data :
dwDllBuild == ~0 ? cMissing.Data : dwDllBuild < DllBuild_Merge7z ? cOutdated.Data : cPresent.Data);
GetModuleFileName(0, cText.Data, MAX_PATH);
PathRemoveFileSpec(cText.Data);
PathAppend(cText.Data, _T("Merge7z*.dll"));
DlgDirListDLLs(hWnd, cText.Data, 105);
if (DWORD cchPath = GetEnvironmentVariable(_T("path"), 0, 0))
{
static const TCHAR cSep[] = _T(";");
LPTSTR pchPath = new TCHAR[cchPath];
GetEnvironmentVariable(_T("PATH"), pchPath, cchPath);
LPTSTR pchItem = pchPath;
while (int cchItem = StrCSpn(pchItem += StrSpn(pchItem, cSep), cSep))
{
if (cchItem < MAX_PATH)
{
CopyMemory(cText.Data, pchItem, cchItem*sizeof*pchItem);
cText.Data[cchItem] = 0;
PathAppend(cText.Data, _T("Merge7z*.dll"));
DlgDirListDLLs(hWnd, cText.Data, 105);
}
pchItem += cchItem;
}
delete[] pchPath;
}
if (SendDlgItemMessage(hWnd, 105, LB_GETCOUNT, 0, 0) == 0)
{
SendDlgItemMessage(hWnd, 105, LB_ADDSTRING, 0, (LPARAM) cNone.Data);
}
HICON hIcon = LoadIcon(0, IDI_EXCLAMATION);
SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM) hIcon);
if (pThis->m_bShowAllways)
{
//.........这里部分代码省略.........
示例8: AppInit2
//.........这里部分代码省略.........
" -daemon \t\t " + _("Run in the background as a daemon and accept commands\n") +
" -testnet \t\t " + _("Use the test network\n") +
" -rpcuser=<user> \t " + _("Username for JSON-RPC connections\n") +
" -rpcpassword=<pw>\t " + _("Password for JSON-RPC connections\n") +
" -rpcport=<port> \t\t " + _("Listen for JSON-RPC connections on <port>\n") +
" -rpcallowip=<ip> \t\t " + _("Allow JSON-RPC connections from specified IP address\n") +
" -rpcconnect=<ip> \t " + _("Send commands to node running on <ip>\n");
#ifdef USE_SSL
strUsage += string() +
_("\nSSL options: (see the Bitcoin Wiki for SSL setup instructions)\n") +
" -rpcssl=1 \t " + _("Use OpenSSL (https) for JSON-RPC connections\n") +
" -rpcsslcertificatchainfile=<file.cert>\t " + _("Server certificate file (default: server.cert)\n") +
" -rpcsslprivatekeyfile=<file.pem> \t " + _("Server private key (default: server.pem)\n") +
" -rpcsslciphers=<ciphers> \t " + _("Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)\n");
#endif
strUsage += string() +
" -? \t\t " + _("This help message\n");
#if defined(__WXMSW__) && defined(GUI)
// Tabs make the columns line up in the message box
wxMessageBox(strUsage, "Bitcoin", wxOK);
#else
// Remove tabs
strUsage.erase(std::remove(strUsage.begin(), strUsage.end(), '\t'), strUsage.end());
fprintf(stderr, "%s", strUsage.c_str());
#endif
return false;
}
fDebug = GetBoolArg("-debug");
fPrintToDebugger = GetBoolArg("-printtodebugger");
fTestNet = GetBoolArg("-testnet");
if (fCommandLine)
{
int ret = CommandLineRPC(argc, argv);
exit(ret);
}
if (!fDebug && !pszSetDataDir[0])
ShrinkDebugFile();
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
printf("Bitcoin version %s%s beta\n", FormatVersion(VERSION).c_str(), pszSubVer);
#ifdef GUI
printf("OS version %s\n", ((string)wxGetOsDescription()).c_str());
printf("System default language is %d %s\n", g_locale.GetSystemLanguage(), ((string)g_locale.GetSysName()).c_str());
printf("Language file %s (%s)\n", (string("locale/") + (string)g_locale.GetCanonicalName() + "/LC_MESSAGES/bitcoin.mo").c_str(), ((string)g_locale.GetLocale()).c_str());
#endif
printf("Default data directory %s\n", GetDefaultDataDir().c_str());
if (GetBoolArg("-loadblockindextest"))
{
CTxDB txdb("r");
txdb.LoadBlockIndex();
PrintBlockTree();
return false;
}
//
// Limit to single instance per user
// Required to protect the database files if we're going to keep deleting log.*
//
#if defined(__WXMSW__) && defined(GUI)
// wxSingleInstanceChecker doesn't work on Linux
wxString strMutexName = wxString("bitcoin_running.") + getenv("HOMEPATH");
for (int i = 0; i < strMutexName.size(); i++)
if (!isalnum(strMutexName[i]))
strMutexName[i] = '.';
wxSingleInstanceChecker* psingleinstancechecker = new wxSingleInstanceChecker(strMutexName);
if (psingleinstancechecker->IsAnotherRunning())
{
printf("Existing instance found\n");
unsigned int nStart = GetTime();
loop
{
// Show the previous instance and exit
HWND hwndPrev = FindWindowA("wxWindowClassNR", "Bitcoin");
if (hwndPrev)
{
if (IsIconic(hwndPrev))
ShowWindow(hwndPrev, SW_RESTORE);
SetForegroundWindow(hwndPrev);
return false;
}
if (GetTime() > nStart + 60)
return false;
// Resume this instance if the other exits
delete psingleinstancechecker;
Sleep(1000);
psingleinstancechecker = new wxSingleInstanceChecker(strMutexName);
if (!psingleinstancechecker->IsAnotherRunning())
break;
}
}
示例9: FormatVersion
// Copyright (c) 2017 The Zcash developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "deprecation.h"
#include "alert.h"
#include "clientversion.h"
#include "init.h"
#include "ui_interface.h"
#include "util.h"
#include "chainparams.h"
static const std::string CLIENT_VERSION_STR = FormatVersion(CLIENT_VERSION);
void EnforceNodeDeprecation(int nHeight, bool forceLogging, bool fThread) {
// Do not enforce deprecation in regtest or on testnet
std::string networkID = Params().NetworkIDString();
if (networkID != "main") return;
int blocksToDeprecation = DEPRECATION_HEIGHT - nHeight;
if (blocksToDeprecation <= 0) {
// In order to ensure we only log once per process when deprecation is
// disabled (to avoid log spam), we only need to log in two cases:
// - The deprecating block just arrived
// - This can be triggered more than once if a block chain reorg
// occurs, but that's an irregular event that won't cause spam.
// - The node is starting
if (blocksToDeprecation == 0 || forceLogging) {
auto msg = strprintf(_("This version has been deprecated as of block height %d."),
示例10: CreateBrowserViewer
//.........这里部分代码省略.........
L"}\n"
L"</style>\n"
L"</head>\n"
L"<body>\n";
UnicodeString Br = "<br/>\n";
AddPara(ThirdParty, LoadStr(ABOUT_THIRDPARTY_HEADER));
AddPara(ThirdParty,
FMTLOAD(PUTTY_BASED_ON, (LoadStr(PUTTY_VERSION))) + Br +
LoadStr(PUTTY_COPYRIGHT) + Br +
CreateLink(LoadStr(PUTTY_LICENSE_URL), LoadStr(ABOUT_THIRDPARTY_LICENSE)) + Br +
CreateLink(LoadStr(PUTTY_URL)));
#ifndef NO_FILEZILLA
UnicodeString OpenSSLVersionText = GetOpenSSLVersionText();
CutToChar(OpenSSLVersionText, L' ', true); // "OpenSSL"
UnicodeString OpenSSLVersion = CutToChar(OpenSSLVersionText, L' ', true);
CutToChar(OpenSSLVersionText, L' ', true); // day
CutToChar(OpenSSLVersionText, L' ', true); // month
UnicodeString OpenSSLYear = CutToChar(OpenSSLVersionText, L' ', true);
AddPara(ThirdParty,
FMTLOAD(OPENSSL_BASED_ON, (OpenSSLVersion)) + Br +
FMTLOAD(OPENSSL_COPYRIGHT2, (OpenSSLYear)) + Br +
CreateLink(LoadStr(OPENSSL_URL)));
AddPara(ThirdParty,
LoadStr(FILEZILLA_BASED_ON2) + Br +
LoadStr(FILEZILLA_COPYRIGHT2) + Br +
CreateLink(LoadStr(FILEZILLA_URL)));
#endif
AddPara(ThirdParty,
FMTLOAD(NEON_BASED_ON, (NeonVersion())) + Br +
LoadStr(NEON_COPYRIGHT) + Br +
CreateLink(LoadStr(NEON_URL)));
#define EXPAT_LICENSE_URL L"license:expat"
AddPara(ThirdParty,
FMTLOAD(EXPAT_BASED_ON, (ExpatVersion())) + Br +
CreateLink(EXPAT_LICENSE_URL, LoadStr(ABOUT_THIRDPARTY_LICENSE)) + Br +
CreateLink(LoadStr(EXPAT_URL)));
AddBrowserLinkHandler(ThirdPartyWebBrowser, EXPAT_LICENSE_URL, ExpatLicenceHandler);
#ifndef NO_COMPONENTS
AddPara(ThirdParty,
FMTLOAD(ABOUT_TOOLBAR2000, (Toolbar2000Version)) + Br +
LoadStr(ABOUT_TOOLBAR2000_COPYRIGHT) + Br +
CreateLink(LoadStr(ABOUT_TOOLBAR2000_URL)));
AddPara(ThirdParty,
FMTLOAD(ABOUT_TBX, (TBXVersionString)) + Br +
LoadStr(ABOUT_TBX_COPYRIGHT) + Br +
CreateLink(LoadStr(ABOUT_TBX_URL)));
AddPara(ThirdParty,
LoadStr(ABOUT_FILEMANAGER) + Br +
LoadStr(ABOUT_FILEMANAGER_COPYRIGHT));
#endif
UnicodeString JclVersion =
FormatVersion(JclVersionMajor, JclVersionMinor, JclVersionRelease);
AddPara(ThirdParty,
FMTLOAD(ABOUT_JCL, (JclVersion)) + Br +
CreateLink(LoadStr(ABOUT_JCL_URL)));
AddPara(ThirdParty,
LoadStr(ABOUT_PNG) + Br +
LoadStr(ABOUT_PNG_COPYRIGHT) + Br +
CreateLink(LoadStr(ABOUT_PNG_URL)));
ThirdParty +=
L"</body>\n"
L"</html>\n";
std::unique_ptr<TMemoryStream> ThirdPartyStream(new TMemoryStream());
UTF8String ThirdPartyUTF8 = UTF8String(ThirdParty);
ThirdPartyStream->Write(ThirdPartyUTF8.c_str(), ThirdPartyUTF8.Length());
ThirdPartyStream->Seek(0, 0);
// For stream-loaded document, when set only after loading from OnDocumentComplete,
// browser stops working
SetBrowserDesignModeOff(ThirdPartyWebBrowser);
TStreamAdapter * ThirdPartyStreamAdapter = new TStreamAdapter(ThirdPartyStream.get(), soReference);
IPersistStreamInit * PersistStreamInit = NULL;
if (ALWAYS_TRUE(ThirdPartyWebBrowser->Document != NULL) &&
SUCCEEDED(ThirdPartyWebBrowser->Document->QueryInterface(IID_IPersistStreamInit, (void **)&PersistStreamInit)) &&
ALWAYS_TRUE(PersistStreamInit != NULL))
{
PersistStreamInit->Load(static_cast<_di_IStream>(*ThirdPartyStreamAdapter));
}
}