Example #1
0
void Patcher::LoadPatchesInfo()
{
    WIN32_FIND_DATA fil;
    HANDLE hFil=FindFirstFile("./patches/*.mpq",&fil);
    if(hFil==INVALID_HANDLE_VALUE)
        return;                                             //no patches were found

    LoadPatchMD5(fil.cFileName);

    while(FindNextFile(hFil,&fil))
        LoadPatchMD5(fil.cFileName);
}
Example #2
0
void Patcher::LoadPatchesInfo()
{
    DIR * dirp;
    //int errno;
    struct dirent * dp;
    dirp = opendir("./patches/");
    if(!dirp)
        return;
    while (dirp)
    {
        errno = 0;
        if ((dp = readdir(dirp)) != NULL)
        {
            int l = strlen(dp->d_name);
            if(l < 8)
                continue;
            if(!memcmp(&dp->d_name[l-4],".mpq",4))
                LoadPatchMD5(dp->d_name);
        }
        else
        {
            if(errno != 0)
            {
                closedir(dirp);
                return;
            }
            break;
        }
    }

    if(dirp)
        closedir(dirp);
}
Example #3
0
void PatchCache::LoadPatchesInfo()
{
    const int MIN_FILENAME_LENGTH = 8;
    boost::filesystem::path p = "./patches/";

    try
    {
        if (boost::filesystem::exists(p) && boost::filesystem::is_directory(p))
        {
            boost::filesystem::directory_iterator end_itr;

            for (boost::filesystem::directory_iterator itr(p); itr != end_itr; ++itr)
            {
                if (!boost::filesystem::is_regular_file(itr->status()))
                    continue;

                if (itr->path().filename().string().length() >= MIN_FILENAME_LENGTH
                    && itr->path().filename().extension().string() == ".mpq")
                    LoadPatchMD5(itr->path());

            }
        }
    }
    catch (const boost::filesystem::filesystem_error& ex)
    {
        sLog.outError("PatchCache::LoadPatchInfos: Error occured: %s", ex.what());
    }
}
Example #4
0
void PatchCache::LoadPatchesInfo()
{
    ACE_DIR* dirp = ACE_OS::opendir(ACE_TEXT("./patches/"));

    if (!dirp)
        return;

    ACE_DIRENT* dp;

    while ((dp = ACE_OS::readdir(dirp)) != NULL)
    {
        int l = strlen(dp->d_name);
        if (l < 8)
            continue;

        if (!memcmp(&dp->d_name[l - 4], ".mpq", 4))
            LoadPatchMD5(dp->d_name);
    }

    ACE_OS::closedir(dirp);
}
Example #5
0
void Patcher::LoadPatchesInfo()
{
    DIR* dirp;
    struct dirent* dp;
    dirp = opendir(PATCH_PATH);

    if (!dirp)
    {
        TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Impossible to open folder %s to search for available patches ! Client patching disabled.", PATCH_PATH);
        return;
    }

    while (dirp)
    {
        errno = 0;

        if ((dp = readdir(dirp)) != NULL)
        {
            int l = strlen(dp->d_name);

            if (l < 8)
                continue;

            if (!strcmp(&dp->d_name[l - 4], ".mpq"))
                LoadPatchMD5(PATCH_PATH, dp->d_name);
        }
        else
        {
            if (errno != 0)
            {
                closedir(dirp);
                return;
            }
            break;
        }
    }

    if (dirp)
        closedir(dirp);
}