本文整理汇总了C++中SharedDatabase::LoadLogSettings方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedDatabase::LoadLogSettings方法的具体用法?C++ SharedDatabase::LoadLogSettings怎么用?C++ SharedDatabase::LoadLogSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedDatabase
的用法示例。
在下文中一共展示了SharedDatabase::LoadLogSettings方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv) {
RegisterExecutablePlatform(ExePlatformClientExport);
Log.LoadLogSettingsDefaults();
set_exception_handler();
Log.Out(Logs::General, Logs::Status, "Client Files Export Utility");
if(!EQEmuConfig::LoadConfig()) {
Log.Out(Logs::General, Logs::Error, "Unable to load configuration file.");
return 1;
}
const EQEmuConfig *config = EQEmuConfig::get();
SharedDatabase database;
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
"database connection");
return 1;
}
/* Register Log System and Settings */
database.LoadLogSettings(Log.log_settings);
Log.StartFileLogs();
ExportSpells(&database);
ExportSkillCaps(&database);
ExportBaseData(&database);
Log.CloseFileLogs();
return 0;
}
示例2: main
int main(int argc, char **argv) {
RegisterExecutablePlatform(ExePlatformSharedMemory);
Log.LoadLogSettingsDefaults();
set_exception_handler();
Log.Out(Logs::General, Logs::Status, "Shared Memory Loader Program");
if(!EQEmuConfig::LoadConfig()) {
Log.Out(Logs::General, Logs::Error, "Unable to load configuration file.");
return 1;
}
const EQEmuConfig *config = EQEmuConfig::get();
SharedDatabase database;
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
"database connection");
return 1;
}
/* Register Log System and Settings */
database.LoadLogSettings(Log.log_settings);
Log.StartFileLogs();
bool load_all = true;
bool load_items = false;
bool load_factions = false;
bool load_loot = false;
bool load_skill_caps = false;
bool load_spells = false;
bool load_bd = false;
if(argc > 1) {
load_all = false;
for(int i = 1; i < argc; ++i) {
switch(argv[i][0]) {
case 'a':
if(strcasecmp("all", argv[i]) == 0) {
load_all = true;
}
break;
case 'b':
if(strcasecmp("base_data", argv[i]) == 0) {
load_bd = true;
}
break;
case 'i':
if(strcasecmp("items", argv[i]) == 0) {
load_items = true;
}
break;
case 'f':
if(strcasecmp("factions", argv[i]) == 0) {
load_factions = true;
}
break;
case 'l':
if(strcasecmp("loot", argv[i]) == 0) {
load_loot = true;
}
break;
case 's':
if(strcasecmp("skill_caps", argv[i]) == 0) {
load_skill_caps = true;
} else if(strcasecmp("spells", argv[i]) == 0) {
load_spells = true;
}
break;
}
}
}
if(load_all || load_items) {
Log.Out(Logs::General, Logs::Status, "Loading items...");
try {
LoadItems(&database);
} catch(std::exception &ex) {
Log.Out(Logs::General, Logs::Error, "%s", ex.what());
return 1;
}
}
if(load_all || load_factions) {
Log.Out(Logs::General, Logs::Status, "Loading factions...");
try {
LoadFactions(&database);
} catch(std::exception &ex) {
Log.Out(Logs::General, Logs::Error, "%s", ex.what());
return 1;
}
}
if(load_all || load_loot) {
//.........这里部分代码省略.........
示例3: main
int main(int argc, char **argv) {
RegisterExecutablePlatform(ExePlatformSharedMemory);
Log.LoadLogSettingsDefaults();
set_exception_handler();
Log.Out(Logs::General, Logs::Status, "Shared Memory Loader Program");
if(!EQEmuConfig::LoadConfig()) {
Log.Out(Logs::General, Logs::Error, "Unable to load configuration file.");
return 1;
}
auto Config = EQEmuConfig::get();
SharedDatabase database;
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
"database connection");
return 1;
}
/* Register Log System and Settings */
database.LoadLogSettings(Log.log_settings);
Log.StartFileLogs();
database.LoadVariables();
/* If we're running shared memory and hotfix has no custom name, we probably want to start from scratch... */
std::string db_hotfix_name;
if (database.GetVariable("hotfix_name", db_hotfix_name)) {
if (!db_hotfix_name.empty() && strcasecmp("hotfix_", db_hotfix_name.c_str()) == 0) {
Log.Out(Logs::General, Logs::Status, "Current hotfix in variables is the default %s, clearing out variable", db_hotfix_name.c_str());
std::string query = StringFormat("UPDATE `variables` SET `value`='' WHERE (`varname`='hotfix_name')");
database.QueryDatabase(query);
}
}
std::string hotfix_name = "";
bool load_all = true;
bool load_items = false;
bool load_factions = false;
bool load_loot = false;
bool load_skill_caps = false;
bool load_spells = false;
bool load_bd = false;
if(argc > 1) {
for(int i = 1; i < argc; ++i) {
switch(argv[i][0]) {
case 'b':
if(strcasecmp("base_data", argv[i]) == 0) {
load_bd = true;
load_all = false;
}
break;
case 'i':
if(strcasecmp("items", argv[i]) == 0) {
load_items = true;
load_all = false;
}
break;
case 'f':
if(strcasecmp("factions", argv[i]) == 0) {
load_factions = true;
load_all = false;
}
break;
case 'l':
if(strcasecmp("loot", argv[i]) == 0) {
load_loot = true;
load_all = false;
}
break;
case 's':
if(strcasecmp("skill_caps", argv[i]) == 0) {
load_skill_caps = true;
load_all = false;
} else if(strcasecmp("spells", argv[i]) == 0) {
load_spells = true;
load_all = false;
}
break;
case '-': {
auto split = SplitString(argv[i], '=');
if(split.size() >= 2) {
auto command = split[0];
auto argument = split[1];
if(strcasecmp("-hotfix", command.c_str()) == 0) {
hotfix_name = argument;
load_all = true;
}
}
break;
}
}
}
//.........这里部分代码省略.........