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


Java Advapi32Util.registryValueExists方法代码示例

本文整理汇总了Java中com.sun.jna.platform.win32.Advapi32Util.registryValueExists方法的典型用法代码示例。如果您正苦于以下问题:Java Advapi32Util.registryValueExists方法的具体用法?Java Advapi32Util.registryValueExists怎么用?Java Advapi32Util.registryValueExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.jna.platform.win32.Advapi32Util的用法示例。


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

示例1: checkKeyExists

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
private void checkKeyExists(
                             String rootKey,
                             String keyPath,
                             String keyName ) {

    try {
        WinReg.HKEY rootHKey = getHKey(rootKey);
        if (!Advapi32Util.registryValueExists(rootHKey, keyPath, keyName)) {
            throw new RegistryOperationsException("Registry key does not exist. "
                                                  + getDescription(rootKey, keyPath, keyName));
        }
    } catch (Win32Exception e) {
        throw new RegistryOperationsException("Registry key path does not exist. "
                                              + getDescription(rootKey, keyPath, keyName), e);
    }
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:17,代码来源:LocalRegistryOperations.java

示例2: registryDeleteValue

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
private static void registryDeleteValue(WinReg.HKEY root, String keyPath, String valueName) {
    boolean exists = Advapi32Util.registryValueExists(root, keyPath, valueName);
    if (exists) {
        Advapi32Util.registryDeleteValue(root, keyPath, valueName);
    }
}
 
开发者ID:jindrapetrik,项目名称:jpexs-decompiler,代码行数:7,代码来源:ContextMenuTools.java

示例3: initLang

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
public static void initLang() {
    if (!Configuration.locale.hasValue()) {
        if (Platform.isWindows()) {
            //Load from Installer
            String uninstKey = "{E618D276-6596-41F4-8A98-447D442A77DB}_is1";
            uninstKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + uninstKey;
            try {
                if (Advapi32Util.registryKeyExists(WinReg.HKEY_LOCAL_MACHINE, uninstKey)) {
                    if (Advapi32Util.registryValueExists(WinReg.HKEY_LOCAL_MACHINE, uninstKey, "NSIS: Language")) {
                        String installedLoc = Advapi32Util.registryGetStringValue(WinReg.HKEY_LOCAL_MACHINE, uninstKey, "NSIS: Language");
                        int lcid = Integer.parseInt(installedLoc);
                        char[] buf = new char[9];
                        int cnt = Kernel32.INSTANCE.GetLocaleInfo(lcid, Kernel32.LOCALE_SISO639LANGNAME, buf, 9);
                        String langCode = new String(buf, 0, cnt).trim().toLowerCase();

                        cnt = Kernel32.INSTANCE.GetLocaleInfo(lcid, Kernel32.LOCALE_SISO3166CTRYNAME, buf, 9);
                        String countryCode = new String(buf, 0, cnt).trim().toLowerCase();

                        List<String> langs = Arrays.asList(SelectLanguageDialog.getAvailableLanguages());
                        for (int i = 0; i < langs.size(); i++) {
                            langs.set(i, langs.get(i).toLowerCase());
                        }

                        String selectedLang = null;

                        if (langs.contains(langCode + "-" + countryCode)) {
                            selectedLang = SelectLanguageDialog.getAvailableLanguages()[langs.indexOf(langCode + "-" + countryCode)];
                        } else if (langs.contains(langCode)) {
                            selectedLang = SelectLanguageDialog.getAvailableLanguages()[langs.indexOf(langCode)];
                        }
                        if (selectedLang != null) {
                            Configuration.locale.set(selectedLang);
                        }
                    }
                }
            } catch (Exception ex) {
                //ignore
            }
        }
    }
    Locale.setDefault(Locale.forLanguageTag(Configuration.locale.get()));
    AppStrings.updateLanguage();

    Helper.decompilationErrorAdd = AppStrings.translate(Configuration.autoDeobfuscate.get() ? "deobfuscation.comment.failed" : "deobfuscation.comment.tryenable");
}
 
开发者ID:jindrapetrik,项目名称:jpexs-decompiler,代码行数:46,代码来源:Main.java


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