Пример #1
0
bool XmlParser::LoadPlaylist(std::vector<StrSongInfo*> & playlist, const char* fileName)
{
    std::wstring wplaylistName;
    Win32Transcode::UTF8_to_Unicode(fileName, strlen(fileName), wplaylistName);

    XLFS_FILE_HANDLE hFile = NULL;
    m_playlist = &playlist;

    if (XLFS_OpenFile(wplaylistName.c_str(), L"rb", &hFile, NULL) != XLFS_RESULT_SUCCESS)
        return false;

    char buffer[1024 * 16];
    __int64 nReadLength = 0;
    __int64 nFilePosition = 0;
    bool fSuccess = true;
    if (!create())
    {
        XLFS_CloseFile(hFile);
        return false;
    }

    m_attrNamesOfColumn[MEDIA_TAG] = "media";
    m_attrNamesOfColumn[COVER_COL] = "cover";
    m_attrNamesOfColumn[NAME_COL] = "name";
    m_attrNamesOfColumn[SOURCE_COL] = "src";

    while(!XLFS_IsEOF(hFile) && fSuccess)
    {
        nReadLength = XLFS_ReadFile(hFile, (unsigned char*)buffer, (int)sizeof(char) *1024 * 16);
        fSuccess = parse(buffer, (int)nReadLength, 0);
    }

    XLFS_CloseFile(hFile);
    return true;
}
Пример #2
0
BOOL CSkinManager::LoadSkinXml(const wchar_t* lpFilePath)
{
    assert(lpFilePath);

    XLFS_FILE_HANDLE hFile = NULL;
    if(XLFS_OpenFile(lpFilePath, L"rb",&hFile,NULL) != XLFS_RESULT_SUCCESS)
    {
        return false;
    }

    char buffer[1024 * 16];

    __int64 nReadLength = 0;
    __int64 nFilePosition = 0;
    bool fSuccess = true;

    if (!create())
    {
		XLFS_CloseFile(hFile);

        return false;
    }

    m_ColorableBitmaps.clear();
    m_ColorableColors.clear();
    m_ColorableTextures.clear();

    while (!XLFS_IsEOF(hFile) && fSuccess)
    {
        nReadLength = XLFS_ReadFile(hFile,(unsigned char*)buffer,(int)sizeof(char) * 1024 * 16);
        fSuccess = this->parse(buffer,(int)nReadLength,0);
    }

    XLFS_CloseFile(hFile);

    destroy();

    return fSuccess;
}