git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@5369 ebf7c1c2-ba36-0410-9fe8-c592906822b4

This commit is contained in:
coalado 2009-04-22 13:32:10 +00:00
parent 449276373c
commit 9f0cb6045e
7 changed files with 162 additions and 413 deletions

View File

@ -4,8 +4,8 @@
<property name="cls" value="bin" />
<property name="dist" value="dist" />
<property name="res" value="ressourcen" />
<property name="keystore" value="G:\jDownloader.keystore" />
<property name="class-path" value="libs/registry.jar libs/cobra.jar libs/clink170.jar libs/svnkit.jar libs/mail.jar libs/htmlcleaner2_0.jar libs/hsqldb.jar libs/miglayout15-swing.jar libs/irclib.jar libs/BrowserLauncher2.jar libs/js.jar libs/swingx.jar libs/jl1.0.jar libs/savemytube.jar" />
<property name="keystore" value="J:\jDownloader.keystore" />
<property name="class-path" value="libs/JDGUI.jar libs/JDHttp.jar libs/JAntiCaptcha.jar libs/JDUtils.jar libs/balloontip.jar libs/BrowserLauncher2.jar libs/clink170.jar libs/cobra.jar libs/hsqldb.jar libs/htmlcleaner2_0.jar libs/irclib.jar libs/jl1.0.jar libs/js.jar libs/looks.jar libs/mail.jar libs/miglayout.jar libs/registry.jar libs/savemytube.jar libs/substance-swingx.jar libs/substance.jar libs/svnkit.jar libs/swingworker.jar libs/swingx.jar libs/synthetica.jar libs/syntheticaAddons.jar libs/syntheticaBlackMoon.jar libs/syntheticaBlackStar.jar libs/syntheticaBlueIce.jar libs/syntheticaBlueMoon.jar libs/syntheticaOrangeMetallic.jar libs/syntheticaSilverMoon.jar libs/syntheticaSimple2D.jar libs/syntheticaSkyMetallic.jar libs/syntheticaWhiteVision.jar" />
<target name="compile">
<mkdir dir="${cls}" />
<javac srcdir="${src}" destdir="${cls}" encoding="UTF-8" source="1.5" />
@ -15,32 +15,68 @@
<!-- jDownloader -->
<mkdir dir="${dist}" />
<manifest file="Manifest.MF">
<attribute name="Created-By" value="coalado" />
<attribute name="Created-By" value="JD-Team and AppWork UG" />
<attribute name="Main-Class" value="jd.Main" />
<attribute name="Class-Path" value="${class-path}" />
</manifest>
<jar jarfile="${dist}/JDownloader.jar" manifest="Manifest.MF">
<fileset dir="${cls}">
<include name="**/*.class" />
<exclude name="jd/plugins/decrypt/**" />
<exclude name="jd/http/**" />
<exclude name="jd/captcha/**" />
<exclude name="jd/gui/**" />
<exclude name="jd/plugins/host/**" />
<exclude name="jd/plugins/decrypt/**" />
<exclude name="jd/captcha/methods/**" />
<exclude name="jd/plugins/optional/**" />
<exclude name="sun/net/www/protocol/jdp/*.class" />
<include name="jd/plugins/host/HTTPAllgemein*" />
</fileset>
<fileset dir="${res}">
<include name="*.properties" />
<exclude name="jd/captcha/methods" />
</fileset>
</jar>
</jar>
<delete file="Manifest.MF" failonerror="false" />
<manifest file="Manifest.MF">
<attribute name="Created-By" value="JD-Team and AppWork UG" />
<attribute name="Class-Path" value="${class-path}" />
</manifest>
<mkdir dir="${dist}/libs" />
<jar jarfile="${dist}/libs/JDHttp.jar" manifest="Manifest.MF">
<fileset dir="${cls}">
<include name="jd/http/**" />
<include name="sun/net/www/protocol/jdp/*.class" />
</fileset>
</jar>
<jar jarfile="${dist}/libs/JDGUI.jar" manifest="Manifest.MF">
<fileset dir="${cls}">
<include name="jd/gui/**" />
</fileset>
</jar>
<jar jarfile="${dist}/libs/JAntiCaptcha.jar" manifest="Manifest.MF">
<fileset dir="${cls}">
<include name="jd/captcha/**" />
<exclude name="jd/captcha/methods/**" />
</fileset>
</jar>
<jar jarfile="${dist}/libs/JDUtils.jar" manifest="Manifest.MF">
<fileset dir="${cls}">
<include name="jd/nutils/**" />
</fileset>
</jar>
<delete file="Manifest.MF" failonerror="false" />
</target>
<target name="jarWebupdater">
<!--Webupdater-->
<manifest file="Manifest.MF">
<attribute name="Created-By" value="coalado" />
<attribute name="Main-Class" value="jd.update.Main" />
</manifest>
<jar jarfile="${dist}/jdupdate.jar" manifest="Manifest.MF">
<fileset dir="${cls}">
@ -55,9 +91,11 @@
<include name="jd/parser/Regex.class" />
<include name="sun/net/www/protocol/jdp/*.class" />
</fileset>
<zipfileset src="ressourcen/libs/hsqldb.jar" excludes="META-INF/*" />
<zipfileset src="ressourcen/libs/hsqldb.jar" excludes="META-INF/*" />
</jar>
<delete file="Manifest.MF" failonerror="false" />
</target>
@ -185,8 +223,8 @@
<signjar keystore="${keystore}" alias="jDownloader" storepass="jDownloader">
<path>
<fileset dir="${dist}" includes="**/*.jar" />
</path>
</signjar>
</target>

View File

@ -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

View File

@ -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]

View File

@ -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<br>
* See <a href=
* "http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How
* to Use Threads</a> 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[] {});
}
});
}
}

View File

@ -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();
}
}