func init // add using module sys.add_use('Microsoft.Win32') // defines an instance of RegistryKey sys.add_var(this.name, 'RegistryKey') //blk_vars.println('private RegistryKey ' + this.codename + ';') // initialize properties if(linked("onError")) sys.add_use('System.Security') this.setfield('ex', 'ex' + this.id) end end func doOpen(data) linked("onError") ? blk.println('try {').inc() : '' blk.println(this.codename, ' = ', 'RegistryKey.OpenBaseKey(RegistryHive.', this.props("RegistryHive").value, ', RegistryView.', this.props("RegistryView").value, ');') event("onRegistryKey", this.codename) if(linked("onError")) blk.dec().println('} catch(SecurityException ', this.ex, ') {').inc() event("onError", this.ex + '.Message') blk.dec().println('}') end end func doOpenRemote(data) linked("onError") ? blk.println('try {').inc() : '' blk.println(this.codename, ' = ', 'RegistryKey.OpenRemoteBaseKey(RegistryHive.', this.props("RegistryHive").value, ', ' + d("MachineName"), ', RegistryView.', this.props("RegistryView").value, ');') event("onRegistryKey", this.codename) if(linked("onError")) blk.dec().println('} catch(SecurityException ', this.ex, ') {').inc() event("onError", this.ex + '.Message') blk.dec().println('}') end end func doFromHandle(data) linked("onError") ? blk.println('try {').inc() : '' blk.println(this.codename, ' = ', 'RegistryKey.FromHandle(', d("Handle"), ', RegistryView.', this.props("RegistryView").value, ');') event("onRegistryKey", this.codename) if(linked("onError")) blk.dec().println('} catch(SecurityException ', this.ex, ') {').inc() event("onError", this.ex + '.Message') blk.dec().println('}') end end func doClose blk.println(this.codename, '.Close();') end func doDispose blk.println(this.codename, '.Dispose();') end func doFlush(data) blk.println(this.codename, '.Flush();') end func RegistryKey return(this.codename) end func SubKeyNames return(this.codename + '.GetSubKeyNames()') end func ValueNames return(this.codename + '.GetValueNames()') end func Handle return(this.codename + '.Handle') end func Name return(this.codename + '.Name') end func SubKeyCount return(this.codename + '.SubKeyCount') end func ValueCount return(this.codename + '.ValueCount') end func View return(this.codename + '.View') end