1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #include "precompile.h"
- #include "modManage.h"
- #include <map>
- #include <string>
- #include <windows.h>
- using namespace std;
- map<string, mod_runInfo*> modManage;
- int paramSplit(char* srcStr, char dstParam[10][MAX_PATH])
- {
- char *split = " ", *p = NULL;
- int i = 0;
- if (NULL == srcStr || NULL == dstParam)
- return -1;
- p = strtok(srcStr, split);
- for (i = 0; p != NULL; i++)
- {
- strcpy(&(dstParam[i][0]), p);
- p = strtok(NULL,split);
- }
- return i;
- }
- const mod_runInfo* queryModInfo(const char *modName)
- {
- if(NULL == modName)
- return NULL;
- map<string, mod_runInfo*>::iterator iter = modManage.find(string(modName));
- if (iter != modManage.end())
- return iter->second;
- else
- return NULL;
- }
- int AddmodInfo(mod_runInfo* threadInfo, const char *modName)
- {
- if (NULL == queryModInfo(modName))
- modManage.insert(pair<string,mod_runInfo*>(string(modName), threadInfo));
- return 0;
- }
- int removeModInfo(const char *modName)
- {
- if (NULL == modName)
- return -1;
- map<string, mod_runInfo*>::iterator iter = modManage.find(string(modName));
- if (iter != modManage.end())
- {
- free(iter->second);
- modManage.erase(iter);
- }
- return 0;
- }
|