예제 #1
0
int CALLBACK WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
#ifdef DEBUG
    //BootLoaderUtil::WaitForDebugger();
#endif

#ifndef DEBUG
    MiniDumpGenerator miniDump;
    miniDump.showMessageBox(false);
#endif

    BootLoaderUtil::SetCurrentDir();

    if (!BootLoaderUtil::SetDllDir(".\\bin"))
        exit(-100);

    std::vector<std::string> out;
    UTIL::STRING::tokenize(gcString(lpCmdLine), out, " ");

    std::string userAgent;

    UTIL::STRING::base64_decode(out[2], [&userAgent](const unsigned char* buff, size_t size) -> bool
    {
        userAgent.append((const char*)buff, size);
        return true;
    });

    InitWebControl(out[1].c_str(), userAgent.c_str());

    {
        IPC::PipeServer pipeserver(out[0].c_str(), 1, true);

        pipeserver.onConnectEvent += delegate(&OnPipeConnect);
        pipeserver.onDisconnectEvent += delegate(&OnPipeDisconnect);

        pipeserver.start();

        g_WaitCond.wait(15);

        if (g_bClientConnected)
            g_WaitCond.wait();
    }

    ShutdownWebControl();
}
예제 #2
0
파일: main.cpp 프로젝트: Alasaad/Desurium
bool StartUpload(DesuraId id)
{
	Msg("Starting Mcf Upload....\n");

	//start upload
	UserCore::Thread::MCFThreadI* pPrepThread = g_pUserHandle->getThreadManager()->newUploadPrepThread(id, g_strMcfOutPath.c_str());

	*pPrepThread->getErrorEvent() += delegate(&OnStartUploadError);
	*pPrepThread->getCompleteStringEvent() += delegate(&OnStartUploadComplete);

	pPrepThread->start();

	g_WaitCon.wait();

	return g_strUploadHash.size() != 0;
}
예제 #3
0
파일: main.cpp 프로젝트: Alasaad/Desurium
bool CreateMcf(DesuraId id, std::string &strFolderPath)
{
	Msg("Creating Mcf....\n");

	UserCore::Thread::MCFThreadI* pThread = g_pUserHandle->getThreadManager()->newCreateMCFThread(id, strFolderPath.c_str());

	*pThread->getMcfProgressEvent() += delegate(&OnMCFCreateProgress);
	*pThread->getErrorEvent() += delegate(&OnMCFCreateError);
	*pThread->getCompleteStringEvent() += delegate(&OnMCFCreateComplete);

	pThread->start();
	safe_delete(pThread);

	g_WaitCon.wait();

	return g_strMcfOutPath.size() != 0;
}
예제 #4
0
파일: main.cpp 프로젝트: Alasaad/Desurium
bool UploadMcf()
{
	Msg("Uploading Mcf....\n");

	//upload
	UserCore::Misc::UploadInfoThreadI* info = g_pUserHandle->getUploadManager()->findItem(g_strUploadHash.c_str());
	assert(info);

	*info->getUploadProgressEvent() += delegate(&OnUploadProgress);
	*info->getErrorEvent() += delegate(&OnUploadError);
	*info->getCompleteEvent() += delegate(&OnUploadComplete);

	if (info->isPaused())
		info->unpause();

	info->start();
	g_WaitCon.wait();

	return g_bUploadDone;
}