My Project
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
ParaEngine::CAutoUpdaterApp Class Reference

This is used to create an application using interprocess communication. More...

#include <AutoUpdaterApp.h>

Inheritance diagram for ParaEngine::CAutoUpdaterApp:
NPL::IAutoUpdaterClient::IAutoUpdaterCallback CMyApp ParaEngine::CInterprocessAppClient

Public Types

typedef std::list< std::string > Domain_Map_t
 

Public Member Functions

virtual int SetCommandLine (const char *sCmdLine)
 init command line so that we can use IPC calls before calling Run() method. More...
 
virtual int SetAppDir ()
 set working directory More...
 
virtual bool BeginCoreUpdate (const char *sCurVersion, const char *sSessionDir)
 begin core update. More...
 
virtual bool SendHostMsg (int nMsg, DWORD param1=0, DWORD param2=0, const char *filename=NULL, const char *sCode=NULL, int nPriority=0)
 sent interprocess message to the host process. More...
 
virtual void SendError (int nErrorCode, const char *errorMsg=NULL)
 send error message to host app. More...
 
virtual void SendLog (const char *logMsg)
 send log message to host app. More...
 
virtual bool IsUrlTrusted (const std::string &sUrl)
 whether the url is from a trusted web domain. More...
 
virtual void OnProgress (const NPL::IAutoUpdaterClient::ProgressMessage &msg)
 auto updater call back. More...
 

Protected Member Functions

bool TryGetNextCoreUpdateMessage ()
 
NPL::CAutoUpdaterClientCreateGetAutoUpdater ()
 
void ReleaseAutoUpdater ()
 
int DoCoreUpdate_imp ()
 update the core game engine. More...
 

Static Protected Member Functions

static int MatchFilePattern (const std::string &input, const std::string &sPattern)
 whether the input string match a given file pattern. More...
 
static bool IsAlphaNumeric (char c)
 

Protected Attributes

std::string m_sCmdLine
 
CCommandLineParserm_pCmdLineParams
 
bool m_bAutoUpdateComplete
 
NPL::CAutoUpdaterClientm_pAutoUpdater
 
Domain_Map_t m_trusted_domains
 

Detailed Description

This is used to create an application using interprocess communication.

Member Function Documentation

§ BeginCoreUpdate()

bool ParaEngine::CAutoUpdaterApp::BeginCoreUpdate ( const char *  sCurVersion,
const char *  sSessionDir 
)
virtual

begin core update.

one can use TryGetNextCoreUpdateMessage() to process the update message.

Parameters
sCurVersion"0" is forcing full update, "" is using the current version in the current working directory. or a version number like "0.2.70"
sSessionDirwe will keep temporary download file under update/[sUpdaterName]/[version] directory. if this is NULL, we will use the default name "web"

§ DoCoreUpdate_imp()

int ParaEngine::CAutoUpdaterApp::DoCoreUpdate_imp ( )
protected

update the core game engine.

§ IsUrlTrusted()

bool ParaEngine::CAutoUpdaterApp::IsUrlTrusted ( const std::string &  sUrl)
virtual

whether the url is from a trusted web domain.

§ MatchFilePattern()

int ParaEngine::CAutoUpdaterApp::MatchFilePattern ( const std::string &  input,
const std::string &  sPattern 
)
staticprotected

whether the input string match a given file pattern.

Only wild card * is supported, where * can only match to AlphaNumeric character. e.g : assert(MatchFilePattern("http://update.paraengine.com/webplayer/redist1.exe", "http://*.paraengine.com/webplayer/") == 1) assert(MatchFilePattern("http://www.paraengine.com/webplayer/redist1.exe", "http://*.paraengine.com/webplayer/*.*") == 0) assert(MatchFilePattern("http://www.paraengine.com/webplayer/redist1.exe", "http://*.paraengine.com/*") == -1)

Returns
0 if it is a perfect match. 1 if the beginning of input matches the sPattern perfectly. or -1 if something does not match.

§ OnProgress()

void ParaEngine::CAutoUpdaterApp::OnProgress ( const NPL::IAutoUpdaterClient::ProgressMessage msg)
virtual

auto updater call back.

Implements NPL::IAutoUpdaterClient::IAutoUpdaterCallback.

Reimplemented in CMyApp.

§ SendError()

void ParaEngine::CAutoUpdaterApp::SendError ( int  nErrorCode,
const char *  errorMsg = NULL 
)
virtual

send error message to host app.

§ SendHostMsg()

bool ParaEngine::CAutoUpdaterApp::SendHostMsg ( int  nMsg,
DWORD  param1 = 0,
DWORD  param2 = 0,
const char *  filename = NULL,
const char *  sCode = NULL,
int  nPriority = 0 
)
virtual

sent interprocess message to the host process.

Reimplemented in ParaEngine::CInterprocessAppClient.

§ SendLog()

void ParaEngine::CAutoUpdaterApp::SendLog ( const char *  logMsg)
virtual

send log message to host app.

§ SetAppDir()

int ParaEngine::CAutoUpdaterApp::SetAppDir ( )
virtual

set working directory

Returns
: -1 if app_dir is not allowed. it must be in user's local dir. return 0 if succeed.

§ SetCommandLine()

int ParaEngine::CAutoUpdaterApp::SetCommandLine ( const char *  sCmdLine)
virtual

init command line so that we can use IPC calls before calling Run() method.

Returns
0 if command line is empty or not changed. otherise return 1.

Reimplemented in ParaEngine::CInterprocessAppClient.


The documentation for this class was generated from the following files: