Tools: Added universal TrinityCore banner with git version info to all tools

This commit is contained in:
Shauren
2016-07-17 17:24:53 +02:00
parent f27e1eea4a
commit a8c412a063
9 changed files with 108 additions and 23 deletions

38
src/common/Banner.cpp Normal file
View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Banner.h"
#include "GitRevision.h"
#include "StringFormat.h"
void Trinity::Banner::Show(char const* applicationName, void(*log)(char const* text), void(*logExtraInfo)())
{
log(Trinity::StringFormat("%s (%s)", GitRevision::GetFullVersion(), applicationName).c_str());
log("<Ctrl-C> to stop.\n");
log(" ______ __");
log("/\\__ _\\ __ __/\\ \\__");
log("\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __");
log(" \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\");
log(" \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\");
log(" \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\");
log(" \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\");
log(" C O R E /\\___/");
log("http://TrinityCore.org \\/__/\n");
if (logExtraInfo)
logExtraInfo();
}

29
src/common/Banner.h Normal file
View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TrinityCore_Banner_h__
#define TrinityCore_Banner_h__
namespace Trinity
{
namespace Banner
{
void Show(char const* applicationName, void(*log)(char const* text), void(*logExtraInfo)());
}
}
#endif // TrinityCore_Banner_h__

View File

@@ -28,6 +28,7 @@
#include "ProcessPriority.h"
#include "RealmList.h"
#include "GitRevision.h"
#include "Banner.h"
#include "SslContext.h"
#include "DatabaseLoader.h"
#include "LoginRESTService.h"
@@ -108,11 +109,18 @@ int main(int argc, char** argv)
sLog->RegisterAppender<AppenderDB>();
sLog->Initialize(nullptr);
TC_LOG_INFO("server.bnetserver", "%s (bnetserver)", GitRevision::GetFullVersion());
TC_LOG_INFO("server.bnetserver", "<Ctrl-C> to stop.\n");
TC_LOG_INFO("server.bnetserver", "Using configuration file %s.", sConfigMgr->GetFilename().c_str());
TC_LOG_INFO("server.bnetserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
TC_LOG_INFO("server.bnetserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
Trinity::Banner::Show("bnetserver",
[](char const* text)
{
TC_LOG_INFO("server.bnetserver", "%s", text);
},
[]()
{
TC_LOG_INFO("server.bnetserver", "Using configuration file %s.", sConfigMgr->GetFilename().c_str());
TC_LOG_INFO("server.bnetserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
TC_LOG_INFO("server.bnetserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
}
);
// Seed the OpenSSL's PRNG here.
// That way it won't auto-seed when calling BigNumber::SetRand and slow down the first world login

View File

@@ -39,6 +39,7 @@
#include "BattlegroundMgr.h"
#include "TCSoap.h"
#include "CliRunnable.h"
#include "Banner.h"
#include "GitRevision.h"
#include "WorldSocket.h"
#include "WorldSocketMgr.h"
@@ -132,20 +133,18 @@ extern int main(int argc, char** argv)
// If logs are supposed to be handled async then we need to pass the io_service into the Log singleton
sLog->Initialize(sConfigMgr->GetBoolDefault("Log.Async.Enable", false) ? &_ioService : nullptr);
TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon)", GitRevision::GetFullVersion());
TC_LOG_INFO("server.worldserver", "<Ctrl-C> to stop.\n");
TC_LOG_INFO("server.worldserver", " ______ __");
TC_LOG_INFO("server.worldserver", "/\\__ _\\ __ __/\\ \\__");
TC_LOG_INFO("server.worldserver", "\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __");
TC_LOG_INFO("server.worldserver", " \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\");
TC_LOG_INFO("server.worldserver", " \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\");
TC_LOG_INFO("server.worldserver", " \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\");
TC_LOG_INFO("server.worldserver", " \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\");
TC_LOG_INFO("server.worldserver", " C O R E /\\___/");
TC_LOG_INFO("server.worldserver", "http://TrinityCore.org \\/__/\n");
TC_LOG_INFO("server.worldserver", "Using configuration file %s.", sConfigMgr->GetFilename().c_str());
TC_LOG_INFO("server.worldserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
TC_LOG_INFO("server.worldserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
Trinity::Banner::Show("worldserver-daemon",
[](char const* text)
{
TC_LOG_INFO("server.worldserver", "%s", text);
},
[]()
{
TC_LOG_INFO("server.worldserver", "Using configuration file %s.", sConfigMgr->GetFilename().c_str());
TC_LOG_INFO("server.worldserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
TC_LOG_INFO("server.worldserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
}
);
OpenSSLCrypto::threadsSetup();

View File

@@ -25,7 +25,8 @@
#include "Patterns/Mac.hpp"
#include "Patterns/Windows.hpp"
#include <CompilerDefs.h>
#include "Banner.h"
#include "CompilerDefs.h"
#include <boost/algorithm/string/replace.hpp>
#include <boost/program_options.hpp>
@@ -131,6 +132,8 @@ int main(int argc, char** argv)
try
{
Trinity::Banner::Show("connection_patcher", [](char const* text) { std::cout << text << std::endl; }, nullptr);
auto vm = GetConsoleArguments(argc, argv);
// exit if help is enabled

View File

@@ -35,6 +35,7 @@
#include "DBFilesClientList.h"
#include "CascLib.h"
#include "dbcfile.h"
#include "Banner.h"
#include "StringFormat.h"
#include "adt.h"
@@ -1179,8 +1180,7 @@ bool OpenCascStorage(int locale)
int main(int argc, char * arg[])
{
printf("Map & DBC Extractor\n");
printf("===================\n");
Trinity::Banner::Show("Map & DBC Extractor", [](char const* text) { printf("%s\n", text); }, nullptr);
boost::filesystem::path current(boost::filesystem::current_path());
strcpy(input_path, current.string().c_str());

View File

@@ -19,6 +19,7 @@
#include "PathCommon.h"
#include "MapBuilder.h"
#include "Timer.h"
#include "Banner.h"
using namespace MMAP;
@@ -242,6 +243,8 @@ int finish(const char* message, int returnValue)
int main(int argc, char** argv)
{
Trinity::Banner::Show("MMAP generator", [](char const* text) { printf("%s\n", text); }, nullptr);
int threads = 3, mapnum = -1;
float maxAngle = 70.0f;
int tileX = -1, tileY = -1;

View File

@@ -20,9 +20,12 @@
#include <iostream>
#include "TileAssembler.h"
#include "Banner.h"
int main(int argc, char* argv[])
{
Trinity::Banner::Show("VMAP assembler", [](char const* text) { std::cout << text << std::endl; }, nullptr);
if (argc != 3)
{
std::cout << "usage: " << argv[0] << " <raw data dir> <vmap dest dir>" << std::endl;

View File

@@ -49,7 +49,7 @@
#include "mpqfile.h"
#include "vmapexport.h"
#include "Banner.h"
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
@@ -457,6 +457,8 @@ bool processArgv(int argc, char ** argv, const char *versionString)
int main(int argc, char ** argv)
{
Trinity::Banner::Show("VMAP data extractor", [](char const* text) { printf("%s\n", text); }, nullptr);
bool success = true;
const char *versionString = "V4.03 2015_05";