
var EXPORTED_SYMBOLS=["IOFileModule_avg","IODirModule_avg","IORegistryModule_avg"];var _IOUtils_avg={ItemIsEmpty:function(item){if(typeof item=="undefined"||item==null||item=="")
return true;else
return false;},ToBoolean:function(obj){if(typeof obj=="undefined")
return false;var isBoolean=true;switch(obj){case'0':isBoolean=false;break;case 0:isBoolean=false;break;case false:isBoolean=false;break;case'false':isBoolean=false;break;case'False':isBoolean=false;break;case'':isBoolean=false;break;case null:isBoolean=false;break;case NaN:isBoolean=false;break;default:isBoolean=true;break;}
return isBoolean;}};var IOFileModule_avg={localfileCID:'@mozilla.org/file/local;1',localfileIID:Components.interfaces.nsILocalFile,finstreamCID:'@mozilla.org/network/file-input-stream;1',finstreamIID:Components.interfaces.nsIFileInputStream,foutstreamCID:'@mozilla.org/network/file-output-stream;1',foutstreamIID:Components.interfaces.nsIFileOutputStream,sinstreamCID:'@mozilla.org/scriptableinputstream;1',sinstreamIID:Components.interfaces.nsIScriptableInputStream,suniconvCID:'@mozilla.org/intl/scriptableunicodeconverter',suniconvIID:Components.interfaces.nsIScriptableUnicodeConverter,open:function(path){try{var file=Components.classes[this.localfileCID].createInstance(this.localfileIID);file.initWithPath(path);return file;}
catch(e){return false;}},read:function(file,charset){try{var data=new String();var fiStream=Components.classes[this.finstreamCID].createInstance(this.finstreamIID);var siStream=Components.classes[this.sinstreamCID].createInstance(this.sinstreamIID);fiStream.init(file,1,0,false);siStream.init(fiStream);data+=siStream.read(-1);siStream.close();fiStream.close();if(charset){data=this.toUnicode(charset,data);}
return data;}
catch(e){return false;}},write:function(file,data,mode,charset){try{var foStream=Components.classes[this.foutstreamCID].createInstance(this.foutstreamIID);if(charset){data=this.fromUnicode(charset,data);}
var flags=0x02|0x08|0x20;if(mode=='a'){flags=0x02|0x10;}
foStream.init(file,flags,parseInt("0664",8),0);foStream.write(data,data.length);foStream.close();return true;}
catch(e){return false;}},copy:function(file,dir,fileName){try{file.copyTo(dir,fileName);return true;}catch(e){return false;}},move:function(sourceFile,newFile,fileName){try{sourceFile.moveTo(newFile,fileName);if(!newFile.isReadable()||!newFile.isWritable()){newFile.permissions=parseInt("0664",8);}
return true;}
catch(e){return false;}},create:function(file){try{file.create(0x00,parseInt("0664",8));return true;}
catch(e){return false;}},unlink:function(file){try{file.remove(false);return true;}
catch(e){return false;}},path:function(file){try{return'file:///'+file.path.replace(/\\/g,'\/').replace(/^\s*\/?/,'').replace(/\ /g,'%20');}
catch(e){return false;}},toUnicode:function(charset,data){try{var uniConv=Components.classes[this.suniconvCID].createInstance(this.suniconvIID);uniConv.charset=charset;data=uniConv.ConvertToUnicode(data);}
catch(e){}
return data;},fromUnicode:function(charset,data){try{var uniConv=Components.classes[this.suniconvCID].createInstance(this.suniconvIID);uniConv.charset=charset;data=uniConv.ConvertFromUnicode(data);}
catch(e){}
return data;},LocalFilePathToURI:function(file){var path=file.path;var ioService=Components.classes['@mozilla.org/network/io-service;1'].getService(Components.interfaces.nsIIOService);var url=ioService.newFileURI(file);var fileURL=url.spec;return fileURL;},URIToLocalFilePath:function(url){var path="";var ioService=Components.classes['@mozilla.org/network/io-service;1'].getService(Components.interfaces.nsIIOService);var uri=ioService.newURI(url,"UTF-8",null)
try{var file=uri.QueryInterface(Components.interfaces.nsIFileURL).file;path=file.path;}catch(e){}
return path;}};var IODirModule_avg={sep:'\\',dirservCID:'@mozilla.org/file/directory_service;1',propsIID:Components.interfaces.nsIProperties,fileIID:Components.interfaces.nsIFile,get:function(type){try{var dir=Components.classes[this.dirservCID].createInstance(this.propsIID).get(type,this.fileIID);return dir;}
catch(e){return false;}},open:function(path){return IOFileModule_avg.open(path);},create:function(dir){try{dir.create(0x01,parseInt("0755",8));if(!dir.isReadable()||!dir.isWritable()){dir.permissions=parseInt("0755",8);}
return true;}
catch(e){return false;}},move:function(sourceDir,newDir,dirName){try{sourceDir.moveTo(newDir,dirName);if(!newDir.isReadable()||!newDir.isWritable()){newDir.permissions=parseInt("0755",8);}
return true;}
catch(e){return false;}},read:function(dir,recursive){var list=new Array();try{if(dir.isDirectory()){if(recursive==null){recursive=false;}
var files=dir.directoryEntries;list=this._read(files,recursive);}}
catch(e){}
return list;},_read:function(dirEntry,recursive){var list=new Array();try{while(dirEntry.hasMoreElements()){list.push(dirEntry.getNext().QueryInterface(IOFileModule_avg.localfileIID));}
if(recursive){var list2=new Array();for(var i=0;i<list.length;++i){if(list[i].isDirectory()){files=list[i].directoryEntries;list2=this._read(files,recursive);}}
for(i=0;i<list2.length;++i){list.push(list2[i]);}}}
catch(e){}
return list;},unlink:function(dir,recursive){try{if(recursive==null){recursive=false;}
dir.remove(recursive);return true;}
catch(e){return false;}},path:function(dir){return IOFileModule_avg.path(dir);},split:function(str,join){var arr=str.split(/\/|\\/),i;str=new String();for(i=0;i<arr.length;++i){str+=arr[i]+((i!=arr.length-1)?join:'');}
return str;},join:function(str,split){var arr=str.split(split),i;str=new String();for(i=0;i<arr.length;++i){str+=arr[i]+((i!=arr.length-1)?this.sep:'');}
return str;},OperatingSystemTempDir:function(){return this.get('TmpD');}};var IORegistryModule_avg={WIN_REG_ROOT:{"CLASSES_ROOT":"ROOT_KEY_CLASSES_ROOT","CURRENT_USER":"ROOT_KEY_CURRENT_USER","LOCAL_MACHINE":"ROOT_KEY_LOCAL_MACHINE"},WIN_REG_TYPES:{"String":"SZ","Int32":"DWORD"},WIN_REG_ACCESS_MODE:{"READ":"ACCESS_READ","WRITE":"ACCESS_WRITE","ALL":"ACCESS_ALL"},ReadRegistryKey:function(rootKey,path,key,regType){var keyValue="";var wrk=Components.classes["@mozilla.org/windows-registry-key;1"].createInstance(Components.interfaces.nsIWindowsRegKey);var wrkRoot=wrk.ROOT_KEY_CURRENT_USER;switch(rootKey){case"ROOT_KEY_CLASSES_ROOT":wrkRoot=wrk.ROOT_KEY_CLASSES_ROOT;break;case"ROOT_KEY_LOCAL_MACHINE":wrkRoot=wrk.ROOT_KEY_LOCAL_MACHINE;break;default:break;}
try{wrk.open(wrkRoot,path,wrk.ACCESS_READ);if(_IOUtils_avg.ItemIsEmpty(regType)||regType==this.WIN_REG_TYPES.String)
keyValue=wrk.readStringValue(key);else if(regType==this.WIN_REG_TYPES.Int32)
keyValue=wrk.readIntValue(key);else
keyValue=wrk.readStringValue(key);wrk.close();return keyValue;}
catch(ex){if(_IOUtils_avg.ItemIsEmpty(regType)||regType==this.WIN_REG_TYPES.String)
return"";else if(regType==this.WIN_REG_TYPES.Int32)
return-1;else
return"";}}};