コード例 #1
0
ファイル: Registry.cpp プロジェクト: nhinze/rhodes
DWORD ConvertToType(rho::String neonType)
{
	std::transform(neonType.begin(), neonType.end(), neonType.begin(), ::tolower);
	if (neonType.compare("string") == 0)
		return 1;
	else if (neonType.compare("binary") == 0)
		return 3;
	else if (neonType.compare("dword") == 0)
		return 4;
	else if (neonType.compare("multisz") == 0)
		return 7;
	else
	{
		LOG(WARNING) + "Unrecognised registry type, received " + neonType;
		return 1;
	}
}
コード例 #2
0
ファイル: Registry.cpp プロジェクト: nhinze/rhodes
HKEY ConvertToHKEY(rho::String neonKey)
{
	std::transform(neonKey.begin(), neonKey.end(), neonKey.begin(), ::tolower);
	if (neonKey.compare("hkcr") == 0)
		return HKEY_CLASSES_ROOT;
	else if (neonKey.compare("hkcu") == 0)
		return HKEY_CURRENT_USER;
	else if (neonKey.compare("hklm") == 0)
		return HKEY_LOCAL_MACHINE;
	else if (neonKey.compare("hku") == 0)
		return HKEY_USERS;
	else
	{
		LOG(WARNING) + "Unrecognised hive value, received " + neonKey;
		return HKEY_USERS;
	}
}
コード例 #3
0
ファイル: BrowserFactory.cpp プロジェクト: nhinze/rhodes
EBrowserEngineType BrowserFactory::convertBrowserType(rho::String browserType)
{
    rho::String browserTypeTag;
    
    std::transform(browserType.begin(), browserType.end(), 
        std::back_inserter(browserTypeTag), ::tolower);

    if (browserTypeTag == String(IETag))
    {
        return eIE;
    }
    else if (browserTypeTag == String(webkitTag))
    {
        return eWebkit;
    }

    return eNone;
}
コード例 #4
0
ファイル: Rhodes.cpp プロジェクト: codealot/rhodes
bool CRhodesModule::ParseCommandLine(LPCTSTR lpCmdLine, HRESULT* pnRetCode ) throw( )
{
	m_nRestarting = 1;
	TCHAR szTokens[] = _T("-/");
	LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
    getRhoRootPath();

	m_logPort = "";

	while (lpszToken != NULL)
	{
		if (WordCmpI(lpszToken, _T("Restarting"))==0) {
			m_nRestarting = 10;
		}

		if (wcsncmp(lpszToken, _T("log"), 3)==0) 
		{
			String token = convertToStringA(lpszToken);
			//parseToken will allocate extra byte at the end of the returned token value
			char* port = parseToken( token.c_str(), token.length() );
			if (port) {
				String strLogPort = port;
				m_logPort = strLogPort;
				free(port);
			}
			else {
				m_logPort = rho::String("11000");
			}
		}

#if defined(APP_BUILD_CAPABILITY_MOTOROLA)
        else if (wcsnicmp(lpszToken, _T("s"),1)==0)
        {
			String token = convertToStringA(lpszToken);
			char* path = parseToken( token.c_str(), token.length() );
			if (path) {
				// RhoElements v1.0 compatibility mode
				rho_wmimpl_set_startpage(path);
				free(path);
			}
        }
        else if (wcsnicmp(lpszToken, _T("c"),1)==0)
        {
			String token = convertToStringA(lpszToken);
            char* path = parseToken( token.c_str(), token.length() );
			if (path) {
				rho_wmimpl_set_configfilepath(path);
				free(path);
			}
        }
#endif // APP_BUILD_CAPABILITY_MOTOROLA

#if defined(OS_WINDOWS)
		else if (wcsncmp(lpszToken, _T("http_proxy_url"),14)==0) 
        {
			String token = convertToStringA(lpszToken);
            char *proxy = parseToken( token.c_str(), token.length() );
			
			if (proxy)
            {
				m_strHttpProxy = proxy;
                free(proxy);
            }
			else 
				LOG(WARNING) + "invalid value for \"http_proxy_url\" cmd parameter";

		} else if (wcsncmp(lpszToken, _T("approot"),7)==0) 
        {
			String token = convertToStringA(lpszToken);
			//parseToken will allocate extra byte at the end of the returned token value
            char* path = parseToken( token.c_str(), token.length() );
			if (path) {
				int len = strlen(path);
				if (!(path[len-1]=='\\' || path[len-1]=='/')) {
#ifdef RHODES_EMULATOR
					path[len] = '/';
#else
					path[len] = '\\';
#endif
					path[len+1]  = 0;
				}
				m_strRootPath = path;
				free(path);
			}
		} else if (wcsncmp(lpszToken, _T("rhodespath"),10)==0) 
        {
			String token = convertToStringA(lpszToken);
			//parseToken will allocate extra byte at the end of the returned token value
            char* path = parseToken( token.c_str(), token.length() );
			if (path) {
				m_strRhodesPath = path;
				free(path);
			}
		} /* else if (wcsncmp(lpszToken, _T("appname"),7)==0) 
        {
			String token = convertToStringA(lpszToken);
			//parseToken will allocate extra byte at the end of the returned token value
            char* path = parseToken( token.c_str(), token.length() );
			if (path) {
                convertToStringW(path, m_strAppNameW);
				free(path);
			}
		} else if (wcsncmp(lpszToken, _T("debughost"),9)==0) 
        {
			String token = convertToStringA(lpszToken);
			//parseToken will allocate extra byte at the end of the returned token value
            char* host = parseToken( token.c_str(), token.length() );
			if (host) {
				m_strDebugHost = host;
				free(host);
			}
		} else if (wcsncmp(lpszToken, _T("debugport"),9)==0) 
        {
			String token = convertToStringA(lpszToken);
			//parseToken will allocate extra byte at the end of the returned token value
            char* port = parseToken( token.c_str(), token.length() );
			if (port) {
				m_strDebugPort = port;
				free(port);
			}
		} */
#else
        else if (wcsnicmp(lpszToken, _T("approot"),7)==0)
        {
            String token = convertToStringA(lpszToken);
			char* path = parseToken( token.c_str(), token.length() );
			if (path) {
				// RhoElements v2.0 Shared Runtime command line parameter
				m_strRootPath = path;
                if (m_strRootPath.substr(0,7).compare("file://")==0)
                    m_strRootPath.erase(0,7);
                ::std::replace(m_strRootPath.begin(), m_strRootPath.end(), '\\', '/');
                if (m_strRootPath.at(m_strRootPath.length()-1)!='/')
                    m_strRootPath.append("/");
                m_strRootPath.append("rho/");
        	}
			free(path);
        }
#endif
		lpszToken = FindOneOf(lpszToken, szTokens);
	}

	return __super::ParseCommandLine(lpCmdLine, pnRetCode);
}