/*!
 * \brief Start patching the file
 *
 * \param patcher CPatcher object
 * \param maxProgressCb Callback for receiving maximum progress value
 * \param progressCb Callback for receiving current progress value
 * \param detailsCb Callback for receiving detailed progress text
 * \param userData Pointer to pass to callback functions
 * \return true on success, otherwise false (and error set appropriately)
 *
 * \sa Patcher::patchFile()
 */
bool mbp_patcher_patch_file(CPatcher *patcher,
                            ProgressUpdatedCallback progressCb,
                            FilesUpdatedCallback filesCb,
                            DetailsUpdatedCallback detailsCb,
                            void *userData)
{
    CASTP(patcher);

    CallbackWrapper wrapper;
    wrapper.progressCb = progressCb;
    wrapper.filesCb = filesCb;
    wrapper.detailsCb = detailsCb;
    wrapper.userData = userData;

    return p->patchFile(&progressCbWrapper, &filesCbWrapper, &detailsCbWrapper,
                        reinterpret_cast<void *>(&wrapper));
}
/*!
 * \brief Cancel the patching of a file
 *
 * \param patcher CPatcher object
 *
 * \sa Patcher::cancelPatching()
 */
void mbp_patcher_cancel_patching(CPatcher *patcher)
{
    CASTP(patcher);
    p->cancelPatching();
}
/*!
 * \brief Sets the FileInfo object corresponding to the file to patch
 *
 * \param patcher CPatcher object
 * \param info CFileInfo
 *
 * \sa Patcher::setFileInfo()
 */
void mbp_patcher_set_fileinfo(CPatcher *patcher, const CFileInfo *info)
{
    CASTP(patcher);
    p->setFileInfo(reinterpret_cast<const mbp::FileInfo *>(info));
}
/*!
 * \brief The path of the newly patched file
 *
 * \param patcher CPatcher object
 * \return Path to new file
 *
 * \sa Patcher::newFilePath()
 */
char * mbp_patcher_new_file_path(CPatcher *patcher)
{
    CASTP(patcher);
    return string_to_cstring(p->newFilePath());
}