vox-core
Version:
Runtime de aplicaciones multiplataforma
102 lines (83 loc) • 2.91 kB
JavaScript
// Esta implementación de RegistryKey tiene una principal diferencia en algunos de sus métodos
// en comparación con c#
// y es que acá algunos de sus métodos es imposible hacerlos de manera síncrona
var Registry=require("./Registry");
var RegistryKind=require("./RegistryValueKind");
var registryKeyClass;
var RegistryKey= module.exports=function(obj){
this.CSid=obj.CSid;
this.manager=obj.manager;
}
RegistryKey.prototype.toString= RegistryKey.prototype.inspect= function(){
return this._keyname?this._keyname: ("RegistryKey (" + this.CSid + ")");
}
RegistryKey._from=function(obj){
return new RegistryKey(obj);
}
var task= Registry.ready();
task.oncomplete= function(){
if(task.exception){
return;
}
var convert= function(task,rtask){
rtask.oncomplete= function(){
if(rtask.result){
var obj= new RegistryKey(rtask.result);
rtask= rtask.result.ToString()
rtask.oncomplete= function(){
obj._keyname= rtask.result;
task.result= obj;
task.finish();
}
}
else{
task.result= rtask.result;
task.exception= rtask.exception;
task.finish();
}
}
}
registryKeyClass=Registry.$registryKey;
RegistryKey.prototype.getNameAsync=registryKeyClass.prototype.getName;
RegistryKey.prototype.getSubKeyCountAsync=registryKeyClass.prototype.getSubKeyCount;
RegistryKey.prototype.getValueCountAsync=registryKeyClass.prototype.getValueCount;
RegistryKey.prototype.createSubKeyAsync= function(){
var task= new core.VW.Task();
var rtask= registryKeyClass.prototype.CreateSubKey(this,arguments);
convert(task,rtask)
return task;
}
RegistryKey.prototype.deleteSubKeyAsync=registryKeyClass.prototype.DeleteSubKey;
RegistryKey.prototype.deleteValueAsync=registryKeyClass.prototype.DeleteValue;
RegistryKey.prototype.flushAsync=registryKeyClass.prototype.Flush;
RegistryKey.prototype.getSubKeyNamesAsync= function(){
this.native=true;
var val= registryKeyClass.prototype.GetSubKeyNames.apply(this,arguments);
this.native= false;
return val;
}
RegistryKey.prototype.getValueAsync=registryKeyClass.prototype.GetValue;
RegistryKey.prototype.getValueKindAsync= function(){
this.native=true;
var rtask= registryKeyClass.prototype.GetValueKind.apply(this,arguments);
rtask.beforeExpose(function(obj){
return RegistryKind.parse(obj);
});
this.native=false
return rtask;
};
RegistryKey.prototype.getValueNamesAsync= function(){
this.native=true;
var val= registryKeyClass.prototype.GetValueNames.apply(this,arguments);
this.native= false;
return val;
}
RegistryKey.prototype.openSubKeyAsync= function(){
var task= new core.VW.Task();
var rtask= registryKeyClass.prototype.OpenSubKey.apply(this,arguments);
convert(task,rtask)
return task;
}
RegistryKey.prototype.setValueAsync=registryKeyClass.prototype.SetValue;
RegistryKey.prototype.dispose=registryKeyClass.prototype.dispose;
};