void Ui::connectControl(tstring name, HWND handle) { controls[toansi(name)] = handle; if(name.compare(_T("WizardForm")) == 0) uiMainWindowHandle = handle; }
int bufSizeVal(_TCHAR *value) { string val = toansi(tstrlower(STR(value))); if(val.compare("default") == 0) return DEFAULT_READ_BUFSIZE; if(val.compare("auto") == 0) return DEFAULT_READ_BUFSIZE; int bufSize = _ttoi(value); return bufSize ? bufSize : DEFAULT_READ_BUFSIZE; }
DWORD timeoutVal(_TCHAR *value) { string val = toansi(tstrlower(STR(value))); if(val.compare("infinite") == 0) return TIMEOUT_INFINITE; if(val.compare("infinity") == 0) return TIMEOUT_INFINITE; if(val.compare("inf") == 0) return TIMEOUT_INFINITE; return _ttoi(value); }
void idpSetInternalOption(_TCHAR *name, _TCHAR *value) { string key = toansi(_tcslwr(name)); if (key.compare("allowcontinue") == 0) ui.allowContinue = boolVal(value); else if(key.compare("retrybutton") == 0) ui.hasRetryButton = boolVal(value); else if(key.compare("useragent") == 0) userAgent = value; else if(key.compare("invalidcert") == 0) { string val = toansi(_tcslwr(value)); if (val.compare("showdlg") == 0) internetOptions.invalidCert = INVC_SHOWDLG; else if(val.compare("stop") == 0) internetOptions.invalidCert = INVC_STOP; else if(val.compare("ignore") == 0) internetOptions.invalidCert = INVC_IGNORE; } else if(key.compare("connecttimeout") == 0) internetOptions.connectTimeout = timeoutVal(value); else if(key.compare("sendtimeout") == 0) internetOptions.sendTimeout = timeoutVal(value); else if(key.compare("receivetimeout") == 0) internetOptions.receiveTimeout = timeoutVal(value); }
int invCertVal(_TCHAR *value) { string val = toansi(tstrlower(STR(value))); if(val.compare("showdialog") == 0) return INVC_SHOWDLG; if(val.compare("showdlg") == 0) return INVC_SHOWDLG; if(val.compare("stop") == 0) return INVC_STOP; if(val.compare("ignore") == 0) return INVC_IGNORE; return INVC_SHOWDLG; }
int dlgVal(_TCHAR *value) { string val = toansi(tstrlower(STR(value))); if(val.compare("none") == 0) return DLG_NONE; if(val.compare("simple") == 0) return DLG_SIMPLE; if(val.compare("filelist") == 0) return DLG_FILELIST; if(val.compare("urllist") == 0) return DLG_URLLIST; return boolVal(value) ? DLG_NONE : DLG_SIMPLE; }
DWORD proxyVal(_TCHAR *value) { string val = toansi(tstrlower(STR(value))); if(val.compare("auto") == 0) return INTERNET_OPEN_TYPE_PRECONFIG; if(val.compare("preconfig") == 0) return INTERNET_OPEN_TYPE_PRECONFIG; if(val.compare("preconf") == 0) return INTERNET_OPEN_TYPE_PRECONFIG; if(val.compare("direct") == 0) return INTERNET_OPEN_TYPE_DIRECT; if(val.compare("none") == 0) return INTERNET_OPEN_TYPE_DIRECT; if(val.compare("proxy") == 0) return INTERNET_OPEN_TYPE_PROXY; return INTERNET_OPEN_TYPE_PRECONFIG; }
bool boolVal(_TCHAR *value) { string val = toansi(_tcslwr(value)); if(val.compare("true") == 0) return true; if(val.compare("yes") == 0) return true; if(val.compare("y") == 0) return true; if(val.compare("false") == 0) return false; if(val.compare("no") == 0) return false; if(val.compare("n") == 0) return false; return _ttoi(value) > 0; }
bool boolVal(_TCHAR *value) { string val = toansi(tstrlower(STR(value))); if(val.compare("true") == 0) return true; if(val.compare("t") == 0) return true; if(val.compare("yes") == 0) return true; if(val.compare("y") == 0) return true; if(val.compare("false") == 0) return false; if(val.compare("f") == 0) return false; if(val.compare("no") == 0) return false; if(val.compare("n") == 0) return false; return _ttoi(value) > 0; }
void idpSetInternalOption(_TCHAR *name, _TCHAR *value) { if(!name) return; TRACE(_T("idpSetInternalOption(%s, %s)"), name, value); string key = toansi(tstrlower(name)); if(key.compare("allowcontinue") == 0) { ui.allowContinue = boolVal(value); downloader.stopOnError = !ui.allowContinue; } else if(key.compare("stoponerror") == 0) downloader.stopOnError = boolVal(value); else if(key.compare("preserveftpdirs") == 0) downloader.preserveFtpDirs = boolVal(value); else if(key.compare("readbuffersize") == 0) downloader.readBufferSize = bufSizeVal(value); else if(key.compare("retrybutton") == 0) ui.hasRetryButton = boolVal(value); else if(key.compare("redrawbackground") == 0) ui.redrawBackground = boolVal(value); else if(key.compare("errordialog") == 0) ui.errorDlgMode = dlgVal(value); else if(key.compare("errordlg") == 0) ui.errorDlgMode = dlgVal(value); else if(key.compare("useragent") == 0) internetOptions.userAgent = STR(value); else if(key.compare("referer") == 0) internetOptions.referer = STR(value); else if(key.compare("invalidcert") == 0) internetOptions.invalidCert = invCertVal(value); else if(key.compare("oninvalidcert") == 0) internetOptions.invalidCert = invCertVal(value); else if(key.compare("connecttimeout") == 0) internetOptions.connectTimeout = timeoutVal(value); else if(key.compare("sendtimeout") == 0) internetOptions.sendTimeout = timeoutVal(value); else if(key.compare("receivetimeout") == 0) internetOptions.receiveTimeout = timeoutVal(value); else if(key.compare("username") == 0) internetOptions.login = STR(value); else if(key.compare("password") == 0) internetOptions.password = STR(value); else if(key.compare("proxymode") == 0) internetOptions.accessType = proxyVal(value); else if(key.compare("proxyusername") == 0) internetOptions.proxyLogin = STR(value); else if(key.compare("proxypassword") == 0) internetOptions.proxyPassword = STR(value); else if(key.compare("proxyname") == 0) { internetOptions.proxyName = STR(value); if(!internetOptions.proxyName.empty()) internetOptions.accessType = INTERNET_OPEN_TYPE_PROXY; } }
void Ui::addMessage(tstring name, tstring message) { messages[toansi(name)] = message; }