home *** CD-ROM | disk | FTP | other *** search
- var intReadDif=0;
- var str_arr;
-
- var Rd=0;
- var Wt=0;
-
- var UpDownR;
- var ChangeSpeedR=0;
- var CurrentRP=-135;
-
- var UpDownW;
- var ChangeSpeedW=0;
- var CurrentWP=-135;
-
- var Iteration;
- var Tempr;
- var tempr;
-
- var schet;
- var progID="BS.hlGadgetCom"
- var Hdd;
- var ReadWrVC;
- var TypeVC;
- var TempretureVC;
- var GTypeVC;
- var UrgentVC;
- var UrgentV;
- var UrgentS;
-
- var DiskVC;
- var UrgentTemprVC;
- function RegAsmUninstall(root, progId, clsid)
- {
- var wshShell;
- wshShell = new ActiveXObject("WScript.Shell");
-
- wshShell.RegDelete(root + "\\Software\\Classes\\", progId);
- wshShell.RegDelete(root + "\\Software\\Classes\\CLSID\\" + clsid);
- }
- function RegAsmInstall(root, progId, cls, clsid, assembly, version, codebase)
- {
- var wshShell;
- wshShell = new ActiveXObject("WScript.Shell");
- wshShell.RegWrite(root + "\\Software\\Classes\\", progId);
- wshShell.RegWrite(root + "\\Software\\Classes\\" + progId + "\\", cls);
- wshShell.RegWrite(root + "\\Software\\Classes\\" + progId + "\\CLSID\\", clsid);
- wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + clsid + "\\", cls);
- wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + clsid + "\\InprocServer32\\", "mscoree.dll");
- wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + clsid + "\\InprocServer32\\ThreadingModel", "Both");
- wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + clsid + "\\InprocServer32\\Class", cls);
- wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + clsid + "\\InprocServer32\\Assembly", assembly);
- wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + clsid + "\\InprocServer32\\RuntimeVersion", "v2.0.50727");
- wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + clsid + "\\InprocServer32\\CodeBase", codebase);
- wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + clsid + "\\InprocServer32\\" + version + "\\Class", cls);
- wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + clsid + "\\InprocServer32\\" + version + "\\Assembly", assembly);
- wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + clsid + "\\InprocServer32\\" + version + "\\RuntimeVersion", "v2.0.50727");
- wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + clsid + "\\InprocServer32\\" + version + "\\CodeBase", codebase);
- wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + clsid + "\\ProgId\\", progId);
- wshShell.RegWrite(root + "\\Software\\Classes\\CLSID\\" + clsid + "\\Implemented Categories\\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}\\", "");
- }
- function RegAsmUninstall(root, progId, clsid)
- {
- var wshShell;
- wshShell = new ActiveXObject("WScript.Shell");
- wshShell.RegDelete(root + "\\Software\\Classes\\"+progId);
- wshShell.RegDelete(root + "\\Software\\Classes\\CLSID\\" + clsid);
- }
- function DeleteTempFiles( path)
- {
- var FSO,f;
- FSO = new ActiveXObject("Scripting.FileSystemObject");
- f=FSO.GetFile(path);
- f.Delete();
- }
-
-
- function GetInstallObject(path)
- {
- return new ActiveXObject(path);
- }
- function InstallAll()
- {
- var path;
- var extrpath;
- var extrpath1;
- var extrpath2;
- var extrpath3;
- var schet6=0;
- var Inst=null;
- var Directory;
- var guidIn="{AC960F61-67EB-4a8a-ADE2-3BC63852608D}";
- var guidHdl="{099838F0-BC87-4787-9E59-8611F214EE97}"
- var wshShell;
- var status;
- extrpath1=gadget.storage.extract("installer.exe");
- extrpath=gadget.storage.extract("installer.exe.manifest");
- wshShell = new ActiveXObject("WScript.Shell");
- try
- {
- status=wshShell.Run(extrpath1,1,true);
- }
- catch (e)
- {
- Alert("Can't install gadget"+e);
- }
- Hdd=GetInstallObject("BS.hlGadgetCom");
- DeleteTempFiles(extrpath1);
- DeleteTempFiles(extrpath);
- }
-
- function LoadSettings()
- {
- if (options.exists("Disk"))
- {
- switch (parseInt(options.getValue("TemprIndex")))
- {
- case 1: TempretureVC = 120000; break;
- case 2: TempretureVC = 300000; break;
- case 3: TempretureVC = 600000; break;
- case 4: TempretureVC = 1800000; break;
- default: TempretureVC = 60000;
- }
- switch (parseInt(options.getValue("RwActivity")))
- {
- case 1: ReadWrVC = 6; break;
- case 2: ReadWrVC = 10; break;
- case 3: ReadWrVC = 20; break;
- default: ReadWrVC = 3;
- }
- switch (parseInt(options.getValue("HealthIndex")))
- {
- case 1: UrgentVC = 240000; break;
- case 2: UrgentVC = 480000; break;
- case 3: UrgentVC = 960000; break;
- case 4: UrgentVC = 1800000; break;
- case 4: UrgentVC = 3600000; break;
- default: UrgentVC = 120000;
- }
- TypeVC=options.getValue("WarnIndex");
- DiskVC=options.getValue("Disk");
- GTypeVC=options.getValue("TempUnit")
- UrgentTemprVC=options.getValue("UrgentTempret");
- }
- }
- function Gadget_showOptions()
- {
- var str;
- var inco;
- var income;
- if (options.exists("Disk"))
- str=options.getValue("Disk")+"-"+options.getValue("RwActivity")+"-"+options.getValue("TemprIndex")+"-"+options.getValue("WarnIndex")+"-"+options.getValue("HealthIndex")+"-"+options.getValue("UrgentTempret")+"-"+options.getValue("TempUnit");
- else
- str="";
- inco=Hdd.GetAllChoice(str)
- if (inco.length>5)
- {
- income=inco.split('-');
- options.putValue("Disk",income[0]);
- options.putValue("RwActivity",income[1]);
- options.putValue("TemprIndex",income[2]);
- options.putValue("WarnIndex",income[3]);
- options.putValue("HealthIndex",income[4]);
- options.putValue("UrgentTempret",income[5]);
- options.putValue("TempUnit",income[6]);
- view_onOpen();
- }
- }
- function _onOptionChanged()
- {
-
- }
- function view_onOpen()
- {
-
- _onOptionChanged(); // to initialize any preexisting options
- view.onoptionchanged = _onOptionChanged;
- try
- {
- Hdd=GetInstallObject("BS.hlGadgetCom");
- }
- catch(e)
- {
- if (Hdd==null)
- gadget.debug.trace("Null");
- else
- gadget.debug.trace("NOT NULL");
- }
- if (Hdd==null)
- {
- InstallAll();
- Hdd=GetInstallObject("BS.hlGadgetCom");
- }
- Hdd.Init();
- plugin.onShowOptionsDlg = Gadget_showOptions;
- LoadSettings();
- tempreture.innerText="";
- vpath.innerText="";
- if (ReadWrVC!=null)
- Iteration=ReadWrVC;
- else
- Iteration=ReadWrVC=3;
- if (TempretureVC==null)
- TempretureVC=60000;
- if (GTypeVC==null)
- GTypeVC=0;
- if (UrgentVC==null)
- UrgentVC=120000;
- if (DiskVC!=null)
- {
- if (DiskVC.length<5)
- vpath.innerText=DiskVC;
- else
- DiskVC="All disks";
- }
- else
- {
- DiskVC="All disks";
- vpath.innerText="All disks";
- }
- if (TypeVC==null)
- TypeVC=0;
- if (UrgentTemprVC==null)
- UrgentTemprVC=55;
-
- Urgent.X=98;
- Urgent.Y=5;
- ReadArr.rotation=-135;
- writeArr.rotation=-135;
- if (DiskVC!="All disks")
- {
-
- ReadTempreture();
- AnimateGadget();
- ReadUrgent();
- vpath.innerText=DiskVC;
- }
- else
- {
- vpath.innerText="";
- Urgent.X=41;
- Urgent.Y=45;
- Center.src="img/0.png";
- ReadUrgentAll();
- AnimateGadgetAll();
- }
- }
- function ReadUrgentAll()
- {
- clearTimeout(UrgentS);
- UrgentV=Hdd.GetDiskHealth();
- if (UrgentV.length<10)
- {
- Urgent.src="img/"+UrgentV+"48.png";
- if (UrgentV=="red")
- Hdd.Alert(TypeVC,"default.wav");
- }
- else
- Urgent.src="img/unknow48.png";
- UrgentS = setTimeout("ReadUrgentAll()",UrgentVC);
- }
-
- function ReadUrgent()
- {
- clearTimeout(UrgentS);
- UrgentV=Hdd.GetCurrDiskHealth(DiskVC);
- if (UrgentV.length<8)
- {
- Urgent.src="img/"+UrgentV+".png";
- if (UrgentV=="red")
- Hdd.Alert(TypeVC,"default.wav");
- }
- else
- Urgent.src="img/unknow.png";
- UrgentS = setTimeout("ReadUrgent()",UrgentVC);
- }
- function ReadTempreture()
- {
- var CenterVa;
- var tempVal;
- CenterVa=Hdd.GetPercentFull(DiskVC);
- CenterVa=100-parseInt(CenterVa);
- clearTimeout(tempr);
- tempVal=Hdd.GetTempretBypart(DiskVC);
- Tempr=tempVal.split('-');
- if (CenterVa>=10)
- {
- Center.src="img/"+CenterVa+".png";
- }
- else
- {
- Center.src="img/0.png";
- }
- if ((tempVal.length<13))
- {
- if (parseInt(Tempr[GTypeVC])>parseInt(UrgentTemprVC))
- {
- tempreture.color="#FF0000";
- Hdd.Alert(TypeVC,"default.wav");
- if (parseInt(GTypeVC)==0)
- Tempr[GTypeVC]=Tempr[GTypeVC]+"\xB0C";
- else
- Tempr[GTypeVC]=Tempr[GTypeVC]+" F";
- tempreture.innerText=Tempr[GTypeVC];
- }
- else
- {
- tempreture.color="#00FF00";
- if (parseInt(GTypeVC)==0)
- Tempr[GTypeVC]=Tempr[GTypeVC]+"\xB0C";
- else
- Tempr[GTypeVC]=Tempr[GTypeVC]+" F";
- tempreture.innerText=Tempr[GTypeVC];
- }
- }
- else
- tempreture.innerText="";
- tempr = setTimeout("ReadTempreture()",TempretureVC);
- }
- function AnimateGadgetAll()
- {
- clearTimeout(schet);
- ReadArr.rotation=CurrentRP;
- writeArr.rotation=CurrentWP;
- if (Rd==100)
- ReadPe.innerText="R 100%";
- else
- if (Rd<10)
- ReadPe.innerText="R "+Rd+"%";
- else
- ReadPe.innerText="R "+Rd+"%";
-
-
- if (Wt==100)
- WritePe.innerText="W 100%";
- else
- if (Wt<10)
- WritePe.innerText="W "+Wt+"%";
- else
- WritePe.innerText="W "+Wt+"%";
-
- if (Iteration==0)
- {
- str_arr=Hdd.GetAllPartBusy().split(',');
- Rd=str_arr[0];
- Wt=str_arr[1];
- Iteration=ReadWrVC;
- }
- CalculateR ();
- CalculateW ();
- Iteration=Iteration-1;
- schet = setTimeout("AnimateGadgetAll()", 120);
- }
- function AnimateGadget()
- {
- clearTimeout(schet);
- ReadArr.rotation=CurrentRP;
- writeArr.rotation=CurrentWP;
- if (Rd==100)
- ReadPe.innerText="R 100%";
- else
- if (Rd<10)
- ReadPe.innerText="R "+Rd+"%";
- else
- ReadPe.innerText="R "+Rd+"%";
-
-
- if (Wt==100)
- WritePe.innerText="W 100%";
- else
- if (Wt<10)
- WritePe.innerText="W "+Wt+"%";
- else
- WritePe.innerText="W "+Wt+"%";
-
-
- if (Iteration==0)
- {
- str_arr=Hdd.GetPartitionBusy(DiskVC).split(',');
- Rd=str_arr[0];
- Wt=str_arr[1];
- Iteration=ReadWrVC;
- }
- CalculateR ();
- CalculateW ();
- Iteration=Iteration-1;
- schet = setTimeout("AnimateGadget()", 100);
- }
- function CalculateR ()
- {
- if (Math.abs(CurrentRP-(Rd*2.7-135))>10)
- {
- if ((Rd*2.7-135)>CurrentRP)
- {
- CurrentRP=CurrentRP+10;
- UpDownR=1;
- }
- else
- {
- CurrentRP=CurrentRP-10;
- UpDownR=-1;
- }
-
- if (UpDownR==1)
- {
- if (CurrentRP>135)
- {
- CurrentRP=135;
- }
- }
- else
- {
- if (CurrentRP<-135)
- {
- CurrentRP=-135;
- }
- }
- }
- else
- CurrentRP= Math.round(Rd*2.7-135);
- }
- function CalculateW ()
- {
- if (Math.abs(CurrentWP-(Wt*2.7-135))>10)
- {
- if ((Wt*2.7-135)>CurrentWP)
- {
- CurrentWP=CurrentWP+10;
- UpDownW=1;
- }
- else
- {
- CurrentWP=CurrentWP-10;
- UpDownW=-1;
- }
-
- if (UpDownW==1)
- {
- if (CurrentWP>135)
- {
- CurrentWP=135;
- }
- }
- else
- {
- if (CurrentWP<-135)
- {
- CurrentWP=-135;
- }
- }
- }
- else
- CurrentWP= Math.round(Wt*2.7-135);
- }