当前位置: 首页>>代码示例>>Java>>正文


Java Regor类代码示例

本文整理汇总了Java中at.jta.Regor的典型用法代码示例。如果您正苦于以下问题:Java Regor类的具体用法?Java Regor怎么用?Java Regor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Regor类属于at.jta包,在下文中一共展示了Regor类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readKeyValue

import at.jta.Regor; //导入依赖的package包/类
/**
 * Windows-only. Utility method to read the default value from a key in the registry.
 */
private static String readKeyValue(Regor regor, Key key, String path, String valueName)
		throws RegistryErrorException
{
	Key openKey = regor.openKey(key, path, Regor.KEY_READ);
	if (openKey != null)
	{
		try
		{
			byte buf[] = regor.readValue(openKey, valueName);
			if (buf != null)
			{
				return Regor.parseValue(buf);
			}
		}
		finally
		{
			regor.closeKey(openKey);
		}

	}
	return null;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:26,代码来源:BrowserUtilWindows.java

示例2: getVersionFrom

import at.jta.Regor; //导入依赖的package包/类
private String getVersionFrom(String[] paths, String keyValue, Key key)
{
	try
	{
		Regor regor = new Regor();

		for (String path : paths)
		{
			String version = readKeyValue(regor, key, path, keyValue);
			if (!StringUtil.isEmpty(version))
			{
				return version;
			}
		}
	}
	catch (Throwable e)
	{
		IdeLog.logError(CorePlugin.getDefault(), e);
	}
	return null;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:22,代码来源:BrowserUtilWindows.java

示例3: getChromeVersion

import at.jta.Regor; //导入依赖的package包/类
private String getChromeVersion()
{
	String[] paths = new String[] { "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Google Chrome",
			"Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Google Chrome" }; //$NON-NLS-1$ //$NON-NLS-2$
	String keyValue = "Version"; //$NON-NLS-1$ 
	String version = getVersionFrom(paths, keyValue, Regor.HKEY_CURRENT_USER);
	if (StringUtil.isEmpty(version))
	{
		return getVersionFrom(paths, keyValue);
	}
	return version;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:13,代码来源:BrowserUtilWindows.java

示例4: discoverInstalledBrowsers

import at.jta.Regor; //导入依赖的package包/类
/**
 * This method tries to discover all the browsers installed in the computer.
 */
@Override
public List<BrowserInfo> discoverInstalledBrowsers()
{
	// Map Location -> info (remove duplicates from WOW6432Node).
	Map<String, BrowserInfo> browsers = new HashMap<String, BrowserInfo>();
	try
	{
		// On Windows, the available browsers should be found in the registry.
		// See: http://stackoverflow.com/questions/2370732/how-to-find-all-the-browsers-installed-on-a-machine
		Regor regor = new Regor();

		for (String path : new String[] { "Software\\Clients\\StartMenuInternet", //$NON-NLS-1$
				"Software\\WOW6432Node\\Clients\\StartMenuInternet" }) //$NON-NLS-1$ 
		{
			Key key = regor.openKey(Regor.HKEY_LOCAL_MACHINE, path, Regor.KEY_READ);
			if (key != null)
			{
				try
				{
					@SuppressWarnings("unchecked")
					List<String> keys = regor.listKeys(key);
					if (keys != null)
					{
						for (String s : keys)
						{
							String browserName = readKeyValue(regor, key, s);
							String browserLocation = readKeyValue(regor, key, s + "\\shell\\open\\command"); //$NON-NLS-1$

							if (browserName != null && browserLocation != null)
							{
								// Only add it if it really exists.
								if (browserLocation.startsWith("\"") && browserLocation.endsWith("\"")) //$NON-NLS-1$ //$NON-NLS-2$
								{
									browserLocation = browserLocation.substring(1, browserLocation.length() - 1);
								}
								if (new File(browserLocation).exists())
								{
									browsers.put(browserLocation, new BrowserInfo(browserName, browserLocation));
								}
							}
						}
					}
				}
				finally
				{
					regor.closeKey(key);
				}
			}
		}
	}
	catch (Throwable e)
	{
		IdeLog.logError(CorePlugin.getDefault(), e);
	}
	return new ArrayList<BrowserInfo>(browsers.values());
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:60,代码来源:BrowserUtilWindows.java

示例5: getOperaVersion

import at.jta.Regor; //导入依赖的package包/类
/**
 * Note that getting the opera version is a bit less straightforward because it adds the version number to the key,
 * so, we have to list to get it.
 */
private String getOperaVersion()
{
	try
	{
		Regor regor = new Regor();

		for (String path : new String[] { "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\", //$NON-NLS-1$
				"Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" }) //$NON-NLS-1$
		{
			Key key = regor.openKey(Regor.HKEY_LOCAL_MACHINE, path, Regor.KEY_READ);
			if (key != null)
			{
				try
				{
					@SuppressWarnings("unchecked")
					List<String> keys = regor.listKeys(key);
					if (keys != null)
					{
						for (String s : keys)
						{
							if (s.toLowerCase().startsWith("opera")) { //$NON-NLS-1$
								// Additional validation: check publisher.
								String publisher = readKeyValue(regor, key, s, "Publisher"); //$NON-NLS-1$
								if (!StringUtil.isEmpty(publisher)
										&& publisher.toLowerCase().startsWith("opera software")) //$NON-NLS-1$
								{
									String version = readKeyValue(regor, key, s, "DisplayVersion"); //$NON-NLS-1$
									if (!StringUtil.isEmpty(version))
									{
										return version;
									}
								}
							}
						}
					}
				}
				finally
				{
					regor.closeKey(key);
				}
			}
		}
	}
	catch (Throwable e)
	{
		IdeLog.logError(CorePlugin.getDefault(), e);
	}
	return null;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:54,代码来源:BrowserUtilWindows.java


注:本文中的at.jta.Regor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。