home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 January / PCO0198.ISO / browser / net_linx / java40.jar / netscape / softupdate / WinRegItem.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-11-03  |  2.5 KB  |  86 lines

  1. package netscape.softupdate;
  2.  
  3. final class WinRegItem extends InstallObject {
  4.    private WinReg reg;
  5.    private int rootkey;
  6.    private int command;
  7.    private String subkey;
  8.    private String name;
  9.    private Object value;
  10.  
  11.    WinRegItem(WinReg var1, int var2, int var3, String var4, String var5, Object var6) throws SoftUpdateException {
  12.       super(var1.softUpdate());
  13.       this.reg = var1;
  14.       this.command = var3;
  15.       this.rootkey = var2;
  16.       this.subkey = var4;
  17.       this.name = var5;
  18.       this.value = var6;
  19.    }
  20.  
  21.    protected void Complete() throws SoftUpdateException {
  22.       switch (this.command) {
  23.          case 1:
  24.             this.reg.finalCreateKey(this.rootkey, this.subkey, this.name);
  25.             return;
  26.          case 2:
  27.             this.reg.finalDeleteKey(this.rootkey, this.subkey);
  28.             return;
  29.          case 3:
  30.             this.reg.finalDeleteValue(this.rootkey, this.subkey, this.name);
  31.             return;
  32.          case 4:
  33.             this.reg.finalSetValueString(this.rootkey, this.subkey, this.name, (String)this.value);
  34.             return;
  35.          case 5:
  36.             this.reg.finalSetValue(this.rootkey, this.subkey, this.name, (WinRegValue)this.value);
  37.             return;
  38.          default:
  39.             throw new SoftUpdateException("WinRegItem", -208);
  40.       }
  41.    }
  42.  
  43.    float GetInstallOrder() {
  44.       return 3.0F;
  45.    }
  46.  
  47.    public String toString() {
  48.       switch (this.command) {
  49.          case 1:
  50.             return "Create Registry Key " + this.keystr(this.rootkey, this.subkey, (String)null);
  51.          case 2:
  52.             return "Delete Registry key " + this.keystr(this.rootkey, this.subkey, (String)null);
  53.          case 3:
  54.             return "Delete Registry value " + this.keystr(this.rootkey, this.subkey, this.name);
  55.          case 4:
  56.             return "Store Registry value " + this.keystr(this.rootkey, this.subkey, this.name);
  57.          case 5:
  58.             return "Store Registry value " + this.keystr(this.rootkey, this.subkey, this.name);
  59.          default:
  60.             return "Unknown " + this.keystr(this.rootkey, this.subkey, this.name);
  61.       }
  62.    }
  63.  
  64.    private String keystr(int var1, String var2, String var3) {
  65.       String var4;
  66.       switch (var1) {
  67.          case Integer.MIN_VALUE:
  68.             var4 = "\\HKEY_CLASSES_ROOT\\";
  69.             break;
  70.          case -2147483647:
  71.             var4 = "\\HKEY_CURRENT_USER\\";
  72.             break;
  73.          case -2147483646:
  74.             var4 = "\\HKEY_LOCAL_MACHINE\\";
  75.             break;
  76.          case -2147483645:
  77.             var4 = "\\HKEY_USERS\\";
  78.             break;
  79.          default:
  80.             var4 = "\\#" + var1 + "\\";
  81.       }
  82.  
  83.       return var3 == null ? var4 + var2 : var4 + var2 + " [" + var3 + "]";
  84.    }
  85. }
  86.