home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 May / Chip Mayıs 2001.iso / prog / share / 30 / setup.exe / data1.cab / Fsi_-_English / Update / Update.js < prev   
Encoding:
Text File  |  2001-03-15  |  1.5 KB  |  49 lines

  1. function update()
  2. {
  3.     app = new ActiveXObject('FSI.FSIApplication');
  4.     version = app.GetRegistryString(true, 'Version');
  5.     version = version.split('.')[0];
  6.     versionInfo = app.GetRegistryString(true, 'VersionInfo');
  7.     thePath = app.AppDirectory + 'FSIUpdater\\Updater.exe'
  8.  
  9.     if (app.CurrentUpdater < app.LatestUpdater)
  10.     {
  11.         app.OpenStatusDialog('Updating', '\nGetting updater file information...');
  12.         result = updateUpdater(app, thePath);
  13.         app.CloseStatusDialog(0);
  14.         if (!result)
  15.         {
  16.             app.DeleteTempDir();
  17.             window.showModalDialog("../InitFusion/UpdateIncomplete.html", 0,
  18.                 "status:no;help:no;border:thin;dialogWidth:205px;dialogHeight:110px;center:yes;scroll:no;");
  19.             return false;
  20.         }
  21.     }
  22.  
  23.     app.Spawn(thePath, '/auto', app.GetTempDir(), '', '', '');
  24.     app.RunFSI(app.GetTempDir() + '\\Update.html', 'run()');
  25.     return app.GetInstVar('update');
  26.  
  27. function updateUpdater(app, localPath)
  28. {
  29.     request = 'Application=Fusion&Version=' + version + '&VersionInfo=' + versionInfo + '&Type=UpdaterUpdate';
  30.     response = app.HttpRequest('http://www.netobjects.com/update/UpdateFile.cgi', '', request, false, false, true);
  31.  
  32.     app.StatusDialogText('\nDownloading updater file...');
  33.  
  34.     args = response.split(',');
  35.     if (args.length < 8)
  36.         return false;
  37.  
  38.     port = (args[3].length == 0 ? 21 : args[3]);
  39.     path = args[6];
  40.  
  41.     localArgs = path.split('/');
  42.     
  43.     if (!app.GetFile(args[0], args[1], args[2], port, false, args[4], args[5], path, localPath, args[7] == 'binary'))
  44.         return false;
  45.     
  46.     app.CurrentUpdater = app.LatestUpdater;
  47.     return true;
  48. }