예제 #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;
}
예제 #5
0
파일: main.cpp 프로젝트: Alasaad/Desurium
void OnUploadComplete(uint32& status)
{
	Msg("Upload complete\n");
	g_bUploadDone = true;
	g_WaitCon.notify();
}
예제 #6
0
파일: main.cpp 프로젝트: Alasaad/Desurium
void OnUploadError(gcException &e)
{
	Warning(gcString("Failed to upload of mcf: {0}", e));
	g_WaitCon.notify();
}
예제 #7
0
파일: main.cpp 프로젝트: Alasaad/Desurium
void OnStartUploadComplete(gcString &strHash)
{
	g_strUploadHash = strHash;
	g_WaitCon.notify();
}
예제 #8
0
파일: main.cpp 프로젝트: Alasaad/Desurium
void OnMCFCreateComplete(gcString &strPath)
{	
	Msg("Completed creating Mcf.\n");
	g_strMcfOutPath = strPath;
	g_WaitCon.notify();
}
예제 #9
0
파일: main.cpp 프로젝트: Alasaad/Desurium
void OnMCFCreateError(gcException &e)
{
	Warning(gcString("Failed to create mcf: {0}", e));
	g_WaitCon.notify();
}
예제 #10
0
void OnPipeConnect(uint32 &e)
{
    g_bClientConnected = true;
    g_WaitCond.notify();
}
예제 #11
0
void OnPipeDisconnect(uint32 &e)
{
    g_WaitCond.notify();
}