public static void writeWindowsRegistry(String localPath) throws Exception { WinRegistry.writeStringValue( WinRegistry.HKEY_CURRENT_USER, "SOFTWARE\\StackSync", "FilterFolder", localPath); WinRegistry.writeStringValue( WinRegistry.HKEY_CURRENT_USER, "SOFTWARE\\StackSync", "EnableOverlay", "1"); }
/** * Write a value in a given key/value name * * @param hkey * @param key * @param valueName * @param value * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ public static void writeStringValue(int hkey, String key, String valueName, String value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { if (hkey == HKEY_LOCAL_MACHINE) { writeStringValue(systemRoot, hkey, key, valueName, value); } else if (hkey == HKEY_CURRENT_USER) { writeStringValue(userRoot, hkey, key, valueName, value); } else { throw new IllegalArgumentException("hkey=" + hkey); } }
public static void setOverlayActivity(boolean active) throws Exception { String value; if (active) { value = "1"; } else { value = "0"; } WinRegistry.writeStringValue( WinRegistry.HKEY_CURRENT_USER, "SOFTWARE\\StackSync", "EnableOverlay", value); }