static void LoadPlugin (SettingID PluginSettingID, SettingID PluginVerSettingID, plugin_type * & plugin, const char * PluginDir, stdstr & FileName, TraceType TraceLevel, const char * type) { if (plugin != NULL) { return; } FileName = g_Settings->LoadStringVal(PluginSettingID); CPath PluginFileName(PluginDir,FileName.c_str()); plugin = new plugin_type(); if (plugin) { WriteTraceF(TraceLevel,__FUNCTION__ ": %s Loading (%s): Starting",type,(LPCTSTR)PluginFileName); if (plugin->Load(PluginFileName)) { WriteTraceF(TraceLevel,__FUNCTION__ ": %s Current Ver: %s",type,plugin->PluginName()); g_Settings->SaveString(PluginVerSettingID,plugin->PluginName()); } else { WriteTraceF(TraceError,__FUNCTION__ ": Failed to load %s",(LPCTSTR)PluginFileName); delete plugin; plugin = NULL; } WriteTraceF(TraceLevel,__FUNCTION__ ": %s Loading Done",type); } else { WriteTraceF(TraceError,__FUNCTION__ ": Failed to allocate %s plugin",type); } }
static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID, plugin_type * & plugin, const char * PluginDir, stdstr & FileName, TraceModuleProject64 TraceLevel, const char * type, bool IsCopy) { if (plugin != NULL) { return; } FileName = g_Settings->LoadStringVal(PluginSettingID); CPath PluginFileName(PluginDir, FileName.c_str()); if (IsCopy) { PluginFileName.SetName(stdstr_f("%s-copy", PluginFileName.GetName().c_str()).c_str()); } plugin = new plugin_type(); if (plugin) { WriteTrace(TraceLevel, TraceDebug, "%s Loading (%s): Starting", type, (const char *)PluginFileName); if (plugin->Load(PluginFileName)) { WriteTrace(TraceLevel, TraceDebug, "%s Current Ver: %s", type, plugin->PluginName()); g_Settings->SaveString(PluginVerSettingID, plugin->PluginName()); } else { WriteTrace(TraceLevel, TraceError, "Failed to load %s", (const char *)PluginFileName); delete plugin; plugin = NULL; } WriteTrace(TraceLevel, TraceDebug, "%s Loading Done", type); } else { WriteTrace(TraceLevel, TraceError, "Failed to allocate %s plugin", type); } }