Esempio n. 1
0
DumpReturn PlayerDumpWriter::WriteDump(const std::string& file, uint32 guid)
{
    FILE *fout = fopen(file.c_str(), "w");
    if (!fout)
        return DUMP_FILE_OPEN_ERROR;

    std::string dump = GetDump(guid);

    fprintf(fout,"%s\n",dump.c_str());
    fclose(fout);
    return DUMP_SUCCESS;
}
Esempio n. 2
0
DumpReturn PlayerDumpWriter::WriteDump(const std::string& file, uint32 guid) {
    FILE *fout = fopen(file.c_str(), "w");
    if (!fout)
        return DUMP_FILE_OPEN_ERROR;

    DumpReturn ret = DUMP_SUCCESS;
    std::string dump;
    if (!GetDump(guid, dump))
        ret = DUMP_CHARACTER_DELETED;

    fprintf(fout, "%s\n", dump.c_str());
    fclose(fout);
    return ret;
}
Esempio n. 3
0
DumpReturn PlayerDumpWriter::WriteDump(const std::string& file, uint32 guid)
{
    if (sWorld->getBoolConfig(CONFIG_PDUMP_NO_PATHS))
        if (strstr(file.c_str(), "\\") || strstr(file.c_str(), "/"))
            return DUMP_FILE_OPEN_ERROR;
    if (sWorld->getBoolConfig(CONFIG_PDUMP_NO_OVERWRITE))
        if (FILE* f = fopen(file.c_str(), "r"))
        {
            fclose(f);
            return DUMP_FILE_OPEN_ERROR;
        }
    FILE* fout = fopen(file.c_str(), "w");
    if (!fout)
        return DUMP_FILE_OPEN_ERROR;

    DumpReturn ret = DUMP_SUCCESS;
    std::string dump;
    if (!GetDump(guid, dump))
        ret = DUMP_CHARACTER_DELETED;

    fprintf(fout, "%s\n", dump.c_str());
    fclose(fout);
    return ret;
}
Esempio n. 4
0
DumpReturn PlayerDumpWriter::WriteDump(const std::string& file, uint32 guid)
{
    if (sWorld->getBoolConfig(CONFIG_PDUMP_NO_PATHS))
        if (strstr(file.c_str(), "\\") || strstr(file.c_str(), "/"))
            return DUMP_FILE_OPEN_ERROR;
    if (sWorld->getBoolConfig(CONFIG_PDUMP_NO_OVERWRITE))
        if (FILE* f = fopen(file.c_str(), "r"))
        {
            fclose(f);
            return DUMP_FILE_OPEN_ERROR;
        }

    FILE* fout = NULL;

    std::string dumpsDir = ConfigMgr::GetStringDefault("DumpsDir", "");
    if (!dumpsDir.empty())
    {
        if ((dumpsDir.at(dumpsDir.length()-1) != '/') && (dumpsDir.at(dumpsDir.length()-1) != '\\'))
            dumpsDir.push_back('/');

        fout = fopen((dumpsDir+file).c_str(), "w");
    }else 
        fout = fopen(file.c_str(), "w");
    
    if (!fout)
        return DUMP_FILE_OPEN_ERROR;

    DumpReturn ret = DUMP_SUCCESS;
    std::string dump;
    if (!GetDump(guid, dump))
        ret = DUMP_CHARACTER_DELETED;

    fprintf(fout, "%s\n", dump.c_str());
    fclose(fout);
    return ret;
}