本文整理汇总了TypeScript中winreg.keys函数的典型用法代码示例。如果您正苦于以下问题:TypeScript keys函数的具体用法?TypeScript keys怎么用?TypeScript keys使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了keys函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getMSDeployLatestRegKey
function getMSDeployLatestRegKey(registryKey: string): Q.Promise<string> {
var defer = Q.defer<string>();
var regKey = new winreg({
hive: winreg.HKLM,
key: registryKey
})
regKey.keys(function(err, subRegKeys) {
if(err) {
defer.reject(tl.loc("UnabletofindthelocationofMSDeployfromregistryonmachineError", err));
}
var latestKeyVersion = 0 ;
var latestSubKey;
for(var index in subRegKeys) {
var subRegKey = subRegKeys[index].key;
var subKeyVersion = subRegKey.substr(subRegKey.lastIndexOf('\\') + 1, subRegKey.length - 1);
if(!isNaN(subKeyVersion)){
var subKeyVersionNumber = parseFloat(subKeyVersion);
if(subKeyVersionNumber > latestKeyVersion) {
latestKeyVersion = subKeyVersionNumber;
latestSubKey = subRegKey;
}
}
}
if(latestKeyVersion < 3) {
defer.reject(tl.loc("UnsupportedinstalledversionfoundforMSDeployversionshouldbealteast3orabove", latestKeyVersion));
}
defer.resolve(latestSubKey);
});
return defer.promise;
}
示例2: _getToolRegKeyFromPath
/**
* Get resgistry key from path
* @param path path of window registry
*
* @returns registry key
*/
private _getToolRegKeyFromPath(path: string): Q.Promise<string> {
var defer = Q.defer<string>();
var regKey = new winreg({
hive: winreg.HKLM,
key: path
});
regKey.keys(function(err, subRegKeys) {
if(err) {
task.debug('Error during fetching registry key from path: '+ err);
defer.reject(new Error(task.loc("UnableToFindMysqlFromRegistryOnMachineError", err)));
}
let resgistryKeyResult: string;
if(subRegKeys){
for(var index in subRegKeys) {
let subRegKey: string = subRegKeys[index].key;
if(subRegKey.match("MySQL Server")){
task.debug('Window mysql registry key: '+ subRegKey);
resgistryKeyResult = subRegKey;
}
}
}
if(resgistryKeyResult){
defer.resolve(resgistryKeyResult);
}else{
defer.reject(new Error(task.loc("UnableToFindMysqlFromRegistry")));
}
});
return defer.promise;
}