diff --git a/build/build.xml b/build/build.xml
index f97bf54158..52685b373f 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -4,8 +4,8 @@
-
-
+
+
@@ -15,32 +15,68 @@
-
+
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -55,9 +91,11 @@
-
-
+
+
+
+
@@ -185,8 +223,8 @@
-
-
+
+
diff --git a/ressourcen/libs/ICE_JNIRegistry.dll b/ressourcen/ICE_JNIRegistry.dll
similarity index 100%
rename from ressourcen/libs/ICE_JNIRegistry.dll
rename to ressourcen/ICE_JNIRegistry.dll
diff --git a/ressourcen/nsis-setup.nsi b/ressourcen/nsis-setup.nsi
deleted file mode 100644
index 91664e8c24..0000000000
--- a/ressourcen/nsis-setup.nsi
+++ /dev/null
@@ -1,281 +0,0 @@
-# Auto-generated by EclipseNSIS Script Wizard
-# 15.06.2008 20:22:26
-
-Name JDownloader
-
-; Definitions for Java 6.0
-!define JRE_VERSION "6.0"
-!define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=20287"
-;!define JRE_VERSION "5.0"
-;!define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=18675&/jre-1_5_0_15-windows-i586-p.exe"
-
-# Defines
-!define REGKEY "SOFTWARE\$(^Name)"
-!define VERSION 0.1.475
-!define COMPANY JD-Team
-!define URL http://www.jdownloader.org
-
-# MUI defines
-!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
-!define MUI_FINISHPAGE_NOAUTOCLOSE
-!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
-!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
-!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
-!define MUI_STARTMENUPAGE_DEFAULTFOLDER JDownloader
-!define MUI_FINISHPAGE_RUN $INSTDIR\JD-WinLauncher.exe
-!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
-!define MUI_UNFINISHPAGE_NOAUTOCLOSE
-!define MUI_LANGDLL_REGISTRY_ROOT HKLM
-!define MUI_LANGDLL_REGISTRY_KEY ${REGKEY}
-!define MUI_LANGDLL_REGISTRY_VALUENAME InstallerLanguage
-
-#Warum fehlen anscheinend einige Sprachen?
-#Antwort:
-#http://nsis.sourceforge.net/Why_does_the_language_selection_dialog_hide_some_languages
-
-# Included files
-!include Sections.nsh
-!include MUI.nsh
-
-# Reserved Files
-!insertmacro MUI_RESERVEFILE_LANGDLL
-ReserveFile "${NSISDIR}\Plugins\AdvSplash.dll"
-
-# Variables
-Var StartMenuGroup
-
-# Installer pages
-!insertmacro MUI_PAGE_WELCOME
-!insertmacro MUI_PAGE_DIRECTORY
-!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
-!insertmacro MUI_PAGE_INSTFILES
-!insertmacro MUI_PAGE_FINISH
-!insertmacro MUI_UNPAGE_CONFIRM
-!insertmacro MUI_UNPAGE_INSTFILES
-
-# Installer languages
-!insertmacro MUI_LANGUAGE English
-!insertmacro MUI_LANGUAGE German
-!insertmacro MUI_LANGUAGE Russian
-!insertmacro MUI_LANGUAGE Spanish
-!insertmacro MUI_LANGUAGE Turkish
-!insertmacro MUI_LANGUAGE Polish
-!insertmacro MUI_LANGUAGE Czech
-!insertmacro MUI_LANGUAGE Ukrainian
-!insertmacro MUI_LANGUAGE French
-!insertmacro MUI_LANGUAGE Italian
-!insertmacro MUI_LANGUAGE Dutch
-!insertmacro MUI_LANGUAGE Bulgarian
-!insertmacro MUI_LANGUAGE Danish
-!insertmacro MUI_LANGUAGE Finnish
-!insertmacro MUI_LANGUAGE Norwegian
-!insertmacro MUI_LANGUAGE Portuguese
-!insertmacro MUI_LANGUAGE Greek
-
-# Installer attributes
-OutFile JDownloader-Install.exe
-InstallDir $PROGRAMFILES\JDownloader
-CRCCheck on
-XPStyle on
-ShowInstDetails show
-VIProductVersion 0.1.475.0
-VIAddVersionKey /LANG=${LANG_GERMAN} ProductName JDownloader
-VIAddVersionKey /LANG=${LANG_GERMAN} ProductVersion "${VERSION}"
-VIAddVersionKey /LANG=${LANG_GERMAN} CompanyName "${COMPANY}"
-VIAddVersionKey /LANG=${LANG_GERMAN} CompanyWebsite "${URL}"
-VIAddVersionKey /LANG=${LANG_GERMAN} FileVersion "${VERSION}"
-VIAddVersionKey /LANG=${LANG_GERMAN} FileDescription ""
-VIAddVersionKey /LANG=${LANG_GERMAN} LegalCopyright ""
-InstallDirRegKey HKLM "${REGKEY}" Path
-ShowUninstDetails show
-
-# Installer sections
-!macro CREATE_SMGROUP_SHORTCUT NAME PATH
- Push "${NAME}"
- Push "${PATH}"
- Call CreateSMGroupShortcut
-!macroend
-
-Section -JDownloader SEC0000
- Call DetectJRE
- SetOutPath "$INSTDIR"
- SetOverwrite on
- File "C:\JDownloader_01475\JDownloader\JDownloader.jar"
- File "C:\JDownloader_01475\JDownloader\JDownloaderContainer.jar"
- File "C:\JDownloader_01475\JDownloader\JDownloaderPlugins.jar"
- File "C:\JDownloader_01475\JDownloader\JD-WinLauncher.exe"
- SetOutPath "$INSTDIR\libs"
- File "C:\JDownloader_01475\JDownloader\libs\BrowserLauncher2.jar"
- File "C:\JDownloader_01475\JDownloader\libs\jl1.0.jar"
- File "C:\JDownloader_01475\JDownloader\libs\js.jar"
- File "C:\JDownloader_01475\JDownloader\libs\swingx-0.9.2.jar"
- File "C:\JDownloader_01475\JDownloader\libs\swingx.jar"
- !insertmacro CREATE_SMGROUP_SHORTCUT "JDownloader starten" $INSTDIR\JD-WinLauncher.exe
- !insertmacro CREATE_SMGROUP_SHORTCUT "JDownloader Homepage" http://www.jdownloader.org
- !insertmacro CREATE_SMGROUP_SHORTCUT "JDownloader Wiki" http://wiki.jdownloader.org
- SetOutPath $DESKTOP
- CreateShortcut $DESKTOP\JDownloader.lnk $INSTDIR\JD-WinLauncher.exe
- WriteRegStr HKLM "${REGKEY}\Components" JDownloader 1
-SectionEnd
-
-Section -post SEC0001
- WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
- SetOutPath $INSTDIR
- WriteUninstaller $INSTDIR\uninstall.exe
- !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
- SetOutPath $SMPROGRAMS\$StartMenuGroup
- CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk" $INSTDIR\uninstall.exe
- !insertmacro MUI_STARTMENU_WRITE_END
- WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
- WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
- WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
- WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
- WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
- WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
- WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
- WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
-SectionEnd
-
-# Macro for selecting uninstaller sections
-!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
- Push $R0
- ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
- StrCmp $R0 1 0 next${UNSECTION_ID}
- !insertmacro SelectSection "${UNSECTION_ID}"
- GoTo done${UNSECTION_ID}
-next${UNSECTION_ID}:
- !insertmacro UnselectSection "${UNSECTION_ID}"
-done${UNSECTION_ID}:
- Pop $R0
-!macroend
-
-# Uninstaller sections
-!macro DELETE_SMGROUP_SHORTCUT NAME
- Push "${NAME}"
- Call un.DeleteSMGroupShortcut
-!macroend
-
-Section /o -un.JDownloader UNSEC0000
- Delete /REBOOTOK $DESKTOP\JDownloader.lnk
- !insertmacro DELETE_SMGROUP_SHORTCUT "JDownloader Wiki"
- !insertmacro DELETE_SMGROUP_SHORTCUT "JDownloader Homepage"
- !insertmacro DELETE_SMGROUP_SHORTCUT "JDownloader starten"
- Delete /REBOOTOK $INSTDIR\libs\\swingx.jar
- Delete /REBOOTOK $INSTDIR\libs\\swingx-0.9.2.jar
- Delete /REBOOTOK $INSTDIR\libs\\js.jar
- Delete /REBOOTOK $INSTDIR\libs\\jl1.0.jar
- Delete /REBOOTOK $INSTDIR\libs\\BrowserLauncher2.jar
- Delete /REBOOTOK $INSTDIR\JD-WinLauncher.exe
- Delete /REBOOTOK $INSTDIR\JDownloaderPlugins.jar
- Delete /REBOOTOK $INSTDIR\JDownloaderContainer.jar
- Delete /REBOOTOK $INSTDIR\JDownloader.jar
- DeleteRegValue HKLM "${REGKEY}\Components" JDownloader
-SectionEnd
-
-Section -un.post UNSEC0001
- DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
- Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk"
- Delete /REBOOTOK $INSTDIR\uninstall.exe
- DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
- DeleteRegValue HKLM "${REGKEY}" Path
- DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
- DeleteRegKey /IfEmpty HKLM "${REGKEY}"
- RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
- RmDir /REBOOTOK $INSTDIR
- Push $R0
- StrCpy $R0 $StartMenuGroup 1
- StrCmp $R0 ">" no_smgroup
-no_smgroup:
- Pop $R0
-SectionEnd
-
-# Installer functions
-Function .onInit
- InitPluginsDir
- Push $R1
- File /oname=$PLUGINSDIR\spltmp.bmp K:\jDownloader\jd\img\jd_logo_large.bmp
- advsplash::show 1000 600 400 -1 $PLUGINSDIR\spltmp
- Pop $R1
- Pop $R1
- !insertmacro MUI_LANGDLL_DISPLAY
-FunctionEnd
-
-Function CreateSMGroupShortcut
- Exch $R0 ;PATH
- Exch
- Exch $R1 ;NAME
- Push $R2
- StrCpy $R2 $StartMenuGroup 1
- StrCmp $R2 ">" no_smgroup
- SetOutPath $SMPROGRAMS\$StartMenuGroup
- CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$R1.lnk" $R0
-no_smgroup:
- Pop $R2
- Pop $R1
- Pop $R0
-FunctionEnd
-
-# Uninstaller functions
-Function un.onInit
- ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
- !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
- !insertmacro MUI_UNGETLANGUAGE
- !insertmacro SELECT_UNSECTION JDownloader ${UNSEC0000}
-FunctionEnd
-
-Function un.DeleteSMGroupShortcut
- Exch $R1 ;NAME
- Push $R2
- StrCpy $R2 $StartMenuGroup 1
- StrCmp $R2 ">" no_smgroup
- Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$R1.lnk"
-no_smgroup:
- Pop $R2
- Pop $R1
-FunctionEnd
-
-# Installer Language Strings
-# TODO Update the Language Strings with the appropriate translations.
-
-LangString ^UninstallLink ${LANG_ENGLISH} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_GERMAN} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_RUSSIAN} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_SPANISH} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_TURKISH} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_POLISH} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_CZECH} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_UKRAINIAN} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_FRENCH} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_ITALIAN} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_DUTCH} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_BULGARIAN} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_DANISH} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_FINNISH} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_NORWEGIAN} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_PORTUGUESE} "Uninstall $(^Name)"
-LangString ^UninstallLink ${LANG_GREEK} "Uninstall $(^Name)"
-
-Function GetJRE
- MessageBox MB_OK "JDownloader uses Java ${JRE_VERSION}, it will now \
- be downloaded and installed"
-
- StrCpy $2 "$TEMP\Java Runtime Environment.exe"
- nsisdl::download /TIMEOUT=30000 ${JRE_URL} $2
- Pop $R0 ;Get the return value
- StrCmp $R0 "success" +3
- MessageBox MB_OK "Download failed: $R0"
- Quit
- ExecWait $2
- Delete $2
-FunctionEnd
-
-
-Function DetectJRE
- ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \
- "CurrentVersion"
- StrCmp $2 ${JRE_VERSION} done
-
- Call GetJRE
-
- done:
-FunctionEnd
diff --git a/ressourcen/tools/Windows/uninstall.reg b/ressourcen/tools/Windows/uninstall.reg
new file mode 100644
index 0000000000..84823e212b
--- /dev/null
+++ b/ressourcen/tools/Windows/uninstall.reg
@@ -0,0 +1,56 @@
+Windows Registry Editor Version 5.00
+
+
+
+
+
+;Remove all JDownloader Registry entries
+[-HKEY_CLASSES_ROOT\JDownloader jd file]
+[-HKEY_CLASSES_ROOT\JDownloader dlc file]
+[-HKEY_CLASSES_ROOT\JDownloader ccf file]
+[-HKEY_CLASSES_ROOT\JDownloader rsdf file]
+[-HKEY_CLASSES_ROOT\.dlc]
+[-HKEY_CLASSES_ROOT\.ccf]
+[-HKEY_CLASSES_ROOT\.rsdf]
+[-HKEY_CLASSES_ROOT\.jd]
+[-HKEY_CLASSES_ROOT\JDownloader jd-Container]
+[-HKEY_CLASSES_ROOT\JDownloader jd-Container\shell]
+[-HKEY_CLASSES_ROOT\JDownloader jd-Container\DefaultIcon]
+[-HKEY_CLASSES_ROOT\JDownloader jd-Container\shell\open\command]
+[-HKEY_CLASSES_ROOT\JDownloader dlc-Container]
+[-HKEY_CLASSES_ROOT\JDownloader dlc-Container\shell]
+[-HKEY_CLASSES_ROOT\JDownloader dlc-Container\DefaultIcon]
+[-HKEY_CLASSES_ROOT\JDownloader dlc-Container\shell\open\command]
+[-HKEY_CLASSES_ROOT\JDownloader ccf-Container]
+[-HKEY_CLASSES_ROOT\JDownloader ccf-Container\shell]
+[-HKEY_CLASSES_ROOT\JDownloader ccf-Container\DefaultIcon]
+[-HKEY_CLASSES_ROOT\JDownloader ccf-Container\shell\open\command]
+[-HKEY_CLASSES_ROOT\JDownloader rsdf-Container]
+[-HKEY_CLASSES_ROOT\JDownloader rsdf-Container\shell]
+[-HKEY_CLASSES_ROOT\JDownloader rsdf-Container\DefaultIcon]
+[-HKEY_CLASSES_ROOT\JDownloader rsdf-Container\shell\open\command]
+[-HKEY_CLASSES_ROOT\jd]
+[-HKEY_CLASSES_ROOT\jd\DefaultIcon]
+[-HKEY_CLASSES_ROOT\jd\shell]
+[-HKEY_CLASSES_ROOT\jd]
+[-HKEY_CLASSES_ROOT\jd\shell\open\command]
+[-HKEY_CLASSES_ROOT\jdlist]
+[-HKEY_CLASSES_ROOT\jdlist\DefaultIcon]
+[-HKEY_CLASSES_ROOT\jdlist\shell]
+[-HKEY_CLASSES_ROOT\jdlist]
+[-HKEY_CLASSES_ROOT\jdlist\shell\open\command]
+[-HKEY_CLASSES_ROOT\dlc]
+[-HKEY_CLASSES_ROOT\dlc\DefaultIcon]
+[-HKEY_CLASSES_ROOT\dlc\shell]
+[-HKEY_CLASSES_ROOT\dlc]
+[-HKEY_CLASSES_ROOT\dlc\shell\open\command]
+[-HKEY_CLASSES_ROOT\ccf]
+[-HKEY_CLASSES_ROOT\ccf\DefaultIcon]
+[-HKEY_CLASSES_ROOT\ccf\shell]
+[-HKEY_CLASSES_ROOT\ccf]
+[-HKEY_CLASSES_ROOT\ccf\shell\open\command]
+[-HKEY_CLASSES_ROOT\rsdf]
+[-HKEY_CLASSES_ROOT\rsdf\DefaultIcon]
+[-HKEY_CLASSES_ROOT\rsdf\shell]
+[-HKEY_CLASSES_ROOT\rsdf]
+[-HKEY_CLASSES_ROOT\rsdf\shell\open\command]
diff --git a/src/jd/Main_EDT_Debug.java b/src/jd/Main_EDT_Debug.java
deleted file mode 100644
index 222137c261..0000000000
--- a/src/jd/Main_EDT_Debug.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package jd;
-
-import javax.swing.RepaintManager;
-import javax.swing.SwingUtilities;
-
-import debug.EDT_ThreadHangMonitor;
-import debug.EDT_ViolationsDetector;
-
-public class Main_EDT_Debug {
-
- public static void main(String[] args) {
- // Start VM with -Xmx256M
- // JD won't print out shit if it hasn't enough RAM...cheaky bastard.
- DebugEDTViolations();
-
- // Vergesst DebugThreadHangs erstmal. EDT violations sind wichtiger und
- // vor allem haeufiger.
- // DebugThreadHangs();
- }
-
- /**
- * Used to detect Event Dispatch Thread rule violations
- * See How
- * to Use Threads for more info
- */
- private static void DebugEDTViolations() {
- RepaintManager.setCurrentManager(new EDT_ViolationsDetector());
- // JD is now started in the EDT. Still later on it can make calls to
- // Swing methods outside of the EDT. The Program will detect this and
- // print a warning on the console giving you the code-location where
- // this violation happened.
- // Solution: You have to wrap the calls to Swing
- // methods in a Runnable and give it to SwingUtilities.invokeLater(...)
- // to invoke the calls to the Swing methods in the EDT, as we did below.
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- jd.Main.main(new String[] {});
- }
- });
-
- // Example: setVisible is a Swing method. Calling it like this (outside
- // EDT) will print an error to the console. Comment it out to remove
- // this problem.
- // new JFrame().setVisible(true);
- }
-
- /**
- * Monitors the AWT event dispatch thread for events that take longer than a
- * certain time to be dispatched. The principle is to record the time at
- * which we start processing an event, and have another thread check
- * frequently to see if we're still processing. If the other thread notices
- * that we've been processing a single event for too long, it prints a stack
- * trace showing what the event dispatch thread is doing, and continues to
- * time it until it finally finishes. This is useful in determining what
- * code is causing your Java application's GUI to be unresponsive.
- */
- @SuppressWarnings("unused")
- private static void DebugThreadHangs() {
- EDT_ThreadHangMonitor.initMonitoring();
-
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- jd.Main.main(new String[] {});
- }
- });
- }
-
-}
diff --git a/src/jd/utils/JDFileReg.java b/src/jd/utils/JDFileReg.java
index 398306b349..c65dcce50a 100644
--- a/src/jd/utils/JDFileReg.java
+++ b/src/jd/utils/JDFileReg.java
@@ -16,77 +16,82 @@
package jd.utils;
-import java.io.File;
-
import jd.config.SubConfiguration;
import jd.controlling.JDLogger;
import jd.gui.skins.simple.SimpleGuiConstants;
import jd.nutils.OSDetector;
-
-import com.ice.jni.registry.RegStringValue;
-import com.ice.jni.registry.Registry;
-import com.ice.jni.registry.RegistryException;
-import com.ice.jni.registry.RegistryKey;
-import com.ice.jni.registry.RegistryValue;
+import jd.nutils.io.JDIO;
public class JDFileReg {
- public static void setKey(String key, String valueName, String value) throws RegistryException {
- RegistryKey topKey = Registry.getTopLevelKey("HKCR");
- RegistryKey localKey = topKey.openSubKey(key);
- String dv = localKey.getDefaultValue();
+ public static String createSetKey(String key, String valueName, String value) {
+ StringBuilder sb = new StringBuilder();
- if (!dv.equals(value)) {
- JDLogger.getLogger().info("Created Windows Registry entry:" + key + "=" + value);
- localKey = topKey.createSubKey(key, value, RegistryKey.ACCESS_WRITE);
- }
- RegistryValue v = localKey.getValue(valueName);
- if (!v.equals(value)) {
- RegStringValue val = new RegStringValue(localKey, valueName, value);
- JDLogger.getLogger().info("Created Windows Registry entry:" + key + "/" + valueName + "=" + value);
- localKey.setValue(val);
- localKey.flushKey();
+ sb.append("\r\n[HKEY_CLASSES_ROOT\\" + key + "]");
+
+ if (valueName != null && valueName.trim().length() > 0) {
+ sb.append("\r\n\"" + valueName + "\"=\"" + value + "\"");
+ } else {
+ sb.append("\r\n@=\"" + value + "\"");
}
+
+ return sb.toString();
}
public static void registerFileExts() {
- // 5bc4004260d83e0cf69addb8f9262837
- // 6f3ad5e9971f92aa28eb01c2ac11f896
- // f19fbcb71e9682d307e331c04a45fd53
- try {
- if (OSDetector.isWindows() && SubConfiguration.getConfig(SimpleGuiConstants.GUICONFIGNAME).getBooleanProperty("FILE_REGISTER", true)) {
- registerWinFileExt("jd");
- registerWinFileExt("dlc");
- registerWinFileExt("ccf");
- registerWinFileExt("rsdf");
- registerWinProtocol("jd");
- registerWinProtocol("jdlist");
- registerWinProtocol("dlc");
- registerWinProtocol("ccf");
- registerWinProtocol("rsdf");
+
+ if (OSDetector.isWindows() && SubConfiguration.getConfig(SimpleGuiConstants.GUICONFIGNAME).getBooleanProperty("FILE_REGISTER", true)) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(createRegisterWinFileExt("jd"));
+ sb.append(createRegisterWinFileExt("dlc"));
+ sb.append(createRegisterWinFileExt("ccf"));
+ sb.append(createRegisterWinFileExt("rsdf"));
+ sb.append(createRegisterWinProtocol("jd"));
+ sb.append(createRegisterWinProtocol("jdlist"));
+ sb.append(createRegisterWinProtocol("dlc"));
+ sb.append(createRegisterWinProtocol("ccf"));
+ sb.append(createRegisterWinProtocol("rsdf"));
+ JDIO.writeLocalFile(JDUtilities.getResourceFile("tmp/installcnl.reg"), "Windows Registry Editor Version 5.00\r\n\r\n\r\n\r\n" + sb.toString());
+
+ JDUtilities.runCommand("regedit", new String[] { "/e", "test.reg", "HKEY_CLASSES_ROOT\\.dlc" }, JDUtilities.getResourceFile("tmp").getAbsolutePath(), 600);
+ if (!JDUtilities.getResourceFile("tmp/test.reg").exists()) {
+
+ JDUtilities.runCommand("regedit", new String[] { "/s", "installcnl.reg" }, JDUtilities.getResourceFile("tmp").getAbsolutePath(), 600);
+ JDUtilities.runCommand("regedit", new String[] { "/e", "test.reg", "HKEY_CLASSES_ROOT\\.dlc" }, JDUtilities.getResourceFile("tmp").getAbsolutePath(), 600);
+ if (JDUtilities.getResourceFile("tmp/test.reg").exists()) {
+ JDLogger.getLogger().info("Installed Click'n'Load and associated .*dlc,.*ccf,.*rsdf and .*jd with JDownloader. Uninstall with " + JDUtilities.getResourceFile("tools/windows/uninstall.reg"));
+ } else {
+ JDLogger.getLogger().severe("Installation of CLick'n'Load failed. Try to execute " + JDUtilities.getResourceFile("tmp/installcnl.reg").getAbsolutePath() + " manually");
+ }
+
}
- } catch (Throwable e) {
- System.err.println("Run in " + new File("ICE_JNIRegistry.dll").getAbsolutePath());
+ JDUtilities.getResourceFile("tmp/test.reg").delete();
+
}
+
}
- private static void registerWinFileExt(String ext) throws RegistryException {
- String name = "JDownloader " + ext + "-Container";
- String command = JDUtilities.getResourceFile("JDownloader.exe").getAbsolutePath() + " \"%1\"";
+ private static String createRegisterWinFileExt(String ext) {
- setKey(name, "", "JDownloader " + ext + " file");
- setKey(name + "\\shell", "", "open");
- setKey(name + "\\DefaultIcon", "", JDUtilities.getResourceFile("JDownloader.exe").getAbsolutePath());
- setKey(name + "\\shell\\open\\command", "", command);
+ String command = JDUtilities.getResourceFile("JDownloader.exe").getAbsolutePath().replace("\\", "\\\\") + " \\\"%1\\\"";
+ StringBuilder sb = new StringBuilder();
+ sb.append("\r\n\r\n;Register fileextension ." + ext);
+ sb.append(createSetKey("." + ext, "", "JDownloader " + ext + " file"));
+ sb.append(createSetKey("JDownloader " + ext + " file" + "\\shell", "", "open"));
+ sb.append(createSetKey("JDownloader " + ext + " file" + "\\DefaultIcon", "", JDUtilities.getResourceFile("JDownloader.exe").getAbsolutePath().replace("\\", "\\\\")));
+ sb.append(createSetKey("JDownloader " + ext + " file" + "\\shell\\open\\command", "", command));
+ return sb.toString();
}
- private static void registerWinProtocol(String p) throws RegistryException {
- String command = JDUtilities.getResourceFile("JDownloader.exe").getAbsolutePath() + " --add-link \"%1\"";
-
- setKey(p, "", "JDownloader " + p);
- setKey(p + "\\DefaultIcon", "", JDUtilities.getResourceFile("JDownloader.exe").getAbsolutePath());
- setKey(p + "\\shell", "", "open");
- setKey(p, "Url Protocol", "");
- setKey(p + "\\shell\\open\\command", "", command);
+ private static String createRegisterWinProtocol(String p) {
+ String command = JDUtilities.getResourceFile("JDownloader.exe").getAbsolutePath().replace("\\", "\\\\") + " --add-link \\\"%1\\\"";
+ StringBuilder sb = new StringBuilder();
+ sb.append("\r\n\r\n;Register Protocol " + p + "://jdownloader.org/sample." + p);
+ sb.append(createSetKey(p, "", "JDownloader " + p));
+ sb.append(createSetKey(p + "\\DefaultIcon", "", JDUtilities.getResourceFile("JDownloader.exe").getAbsolutePath().replace("\\", "\\\\")));
+ sb.append(createSetKey(p + "\\shell", "", "open"));
+ sb.append(createSetKey(p, "Url Protocol", ""));
+ sb.append(createSetKey(p + "\\shell\\open\\command", "", command));
+ return sb.toString();
}
}
diff --git a/ressourcen/ubiquity.js b/tools/ubiquity.js
similarity index 100%
rename from ressourcen/ubiquity.js
rename to tools/ubiquity.js