Ejemplo n.º 1
0
const wchar_t* plProfileManagerFull::GetProfilePath()
{
    static wchar_t profilePath[MAX_PATH];
    static bool initialized = false;

    if (!initialized)
    {
        initialized = true;

        plUnifiedTime curTime = plUnifiedTime::GetCurrent(plUnifiedTime::kLocal);

        PathGetUserDirectory(profilePath, arrsize(profilePath));
        PathAddFilename(profilePath, profilePath, L"Profile", arrsize(profilePath));
        plFileUtils::CreateDir(profilePath);
    
        wchar_t buff[256];
        hsSnwprintf(buff, 256, L"%02d-%02d-%04d_%02d-%02d//",
            curTime.GetMonth(),
            curTime.GetDay(),
            curTime.GetYear(),
            curTime.GetHour(),
            curTime.GetMinute());

        PathAddFilename(profilePath, profilePath, buff, arrsize(profilePath));
        plFileUtils::CreateDir(profilePath);
    }

    return profilePath;
}
Ejemplo n.º 2
0
        virtual void    GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height )
        {
            bool wemade_string = false;
            wchar_t* thestring;
            if ( fString1 && fString2 )
            {
                size_t length = wcslen( fString1 ) + wcslen( fString2 ) + 3;
                thestring = new wchar_t[ length ];
                hsSnwprintf( thestring, length, L"%s %s", fString1, fString2 );
                wemade_string = true;
            }
            else if (fString1)
                thestring = fString1;
            else if (fString2)
                thestring = fString2;
            else
                thestring = nil;
            *width = textGen->GetVisibleWidth() - 4;

            if ( fOverrideFontSize != -1 )
                textGen->SetFont( fColors->fFontFace, (uint16_t)fOverrideFontSize, fColors->fFontFlags );
            textGen->CalcWrappedStringSize( thestring, width, height );
            if ( fOverrideFontSize != -1 )
                textGen->SetFont( fColors->fFontFace, fColors->fFontSize, fColors->fFontFlags );

            if( height != nil )
                *height += 0;
            *width += 4;
            // clean up thestring if we made it
            if ( wemade_string )
                delete [] thestring;
        }
Ejemplo n.º 3
0
void plProfileManagerFull::ILogStats()
{
    wchar_t statFilename[256];
    hsSnwprintf(statFilename, 256, L"%s%s.csv", GetProfilePath(), fLogAgeName.c_str());

    bool exists = plFileUtils::FileExists(statFilename);

    hsUNIXStream s;
    if (s.Open(statFilename, L"ab"))
    {
        GroupSet groups;
        GetGroups(groups);

        GroupSet::iterator it;

        if (!exists)
        {
            const char* kSpawn = "Spawn";
            s.Write(strlen(kSpawn), kSpawn);
            s.WriteByte(',');

            for (it = groups.begin(); it != groups.end(); it++)
            {
                plString groupName = *it;
                IPrintGroup(&s, groupName.c_str(), true);
            }
            s.WriteByte('\r');
            s.WriteByte('\n');
        }

        s.Write(fLogSpawnName.length(), fLogSpawnName.c_str());
        s.WriteByte(',');

        for (it = groups.begin(); it != groups.end(); it++)
        {
            plString groupName = *it;
            IPrintGroup(&s, groupName.c_str());
        }
        s.WriteByte('\r');
        s.WriteByte('\n');

        s.Close();
    }

    fLogStats = false;
    fLogAgeName = L"";
    fLogSpawnName = "";
}