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

This commit is contained in:
coalado 2009-08-19 22:11:00 +00:00
parent 30ebc2b64c
commit f7a8858d17
12 changed files with 95 additions and 11 deletions

View File

@ -0,0 +1,38 @@
#include <windows.h>
#include <shellapi.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <stdlib.h>
#include <ctype.h>
//Source for recycle.exe - doesn't have to be distributed with jd!
using namespace std;
int main (int argc, char *argv[])
{
if(argc!=2){
return 0;
};
strcat (argv[1],"\0");
SHFILEOPSTRUCTA fop;
// initialize all data required for the copy
fop.hwnd = NULL;
fop.wFunc = FO_DELETE;
fop.pFrom = argv[1]; //src is a char array should be valid but
fop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_ALLOWUNDO;
if(!SHFileOperation(&fop)) //performs copy only if path exist
{
return 1;
}
return 0;
}

View File

@ -430,8 +430,13 @@ public class Main {
LOGGER.severe("COULD NOT DELETE OUTDATED FILES.RESTART REQUIRED");
int answer = UserIO.getInstance().requestConfirmDialog(0, JDL.L("jd.Main.removerestart.title", "Updater"), JDL.L("jd.Main.removerestart.message", "Could not remove outdated libraries. Restart recommended!"), null, JDL.L("jd.Main.removerestart.ok", "Restart now!"), JDL.L("jd.Main.removerestart.cancel", "Continue"));
if (UserIO.isOK(answer)) {
JDUtilities.restartJD();
JDUtilities.restartJD(true);
while (true) {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
}
}
}
}

View File

@ -34,7 +34,7 @@ public class RestartAction extends MenuAction {
public void actionPerformed(ActionEvent e) {
if (JDFlags.hasSomeFlags(UserIO.getInstance().requestConfirmDialog(0, JDL.L("sys.ask.rlyrestart", "Wollen Sie jDownloader wirklich neustarten?")), UserIO.RETURN_OK, UserIO.RETURN_DONT_SHOW_AGAIN)) {
JDUtilities.restartJD();
JDUtilities.restartJD(false);
}
}

View File

@ -266,7 +266,7 @@ public class ConfigPanel extends SwitchPanel {
int answer = UserIO.getInstance().requestConfirmDialog(0, JDL.L("jd.gui.swing.jdgui.settings.ConfigPanel.restartquestion.title", "Restart required!"), JDL.L("jd.gui.swing.jdgui.settings.ConfigPanel.restartquestion", "This option needs a JDownloader restart."), null, JDL.L("jd.gui.swing.jdgui.settings.ConfigPanel.restartquestion.ok", "Restart NOW!"), null);
if (JDFlags.hasSomeFlags(answer, UserIO.RETURN_DONT_SHOW_AGAIN | UserIO.RETURN_OK)) {
JDUtilities.restartJD();
JDUtilities.restartJD(false);
}
}
}

View File

@ -326,7 +326,7 @@ public class JDRemoteControl extends PluginOptional implements ControlListener {
JDLogger.exception(e);
}
JDUtilities.restartJD();
JDUtilities.restartJD(false);
}
}).start();

View File

@ -308,7 +308,7 @@ public class JDSimpleWebserverRequestHandler {
JDLogger.exception(e);
}
JDUtilities.restartJD();
JDUtilities.restartJD(false);
}
}).start();

View File

@ -49,12 +49,14 @@ public class Restarter {
try {
// Create a file handler that write log record to a file called
// my.log
FileHandler handler = new FileHandler("restarter.log", true);
FileHandler handler = new FileHandler("restarter.log", false);
// Add to the desired logger
logger = Logger.getLogger("org.jdownloader");
logger.addHandler(handler);
} catch (IOException e) {
}
try {
for (String arg : args) {

View File

@ -125,6 +125,7 @@ public class JDFileReg {
txt.setLineWrap(true);
txt.setBorder(null);
txt.setOpaque(false);
txt.putClientProperty("Synthetica.opaque", Boolean.FALSE);
new ContainerDialog(UserIO.NO_COUNTDOWN, JDL.L("gui.cnl.install.title", "Click'n'Load Installation"), c, null, null) {
/**

View File

@ -638,7 +638,7 @@ public class JDUtilities {
}
public static void restartJDandWait() {
restartJD();
restartJD(false);
while (true) {
try {
Thread.sleep(5000);
@ -647,7 +647,7 @@ public class JDUtilities {
}
}
public static void restartJD() {
public static void restartJD(final boolean tinybypass) {
new Thread(new Runnable() {
public void run() {
if (JDUtilities.getController() != null) JDUtilities.getController().prepareShutdown();
@ -695,7 +695,7 @@ public class JDUtilities {
System.arraycopy(JD_ARGUMENTS, 0, finalArgs, javaArgs.length, JD_ARGUMENTS.length);
ArrayList<File> restartfiles = JDIO.listFiles(JDUtilities.getResourceFile("update"));
if (restartfiles != null && restartfiles.size() > 0) {
if (restartfiles != null && restartfiles.size() > 0||tinybypass) {
if (OSDetector.isMac()) {
JDLogger.getLogger().info(JDUtilities.runCommand("java", new String[] { "-jar", "tools/tinyupdate.jar", "-restart" }, getResourceFile(".").getAbsolutePath(), 0));
} else {

View File

@ -104,7 +104,7 @@ public class Updater {
}
}
String[] rest = new String[] {/* "libs/svnkit.jar" */"info.txt","jd/img/default/flags","plugins/JDPremium.jar","tools/Windows/recycle.exe"
String[] rest = new String[] {/* "libs/svnkit.jar" */"info.txt","jd/img/default/flags","plugins/JDPremium.jar","tools/Windows/recycle.exe","jd/img/screenshots","jd/img/synthetica"
};
for (String path : rest) {

38
tools/recycle/recycle.cpp Normal file
View File

@ -0,0 +1,38 @@
#include <windows.h>
#include <shellapi.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <stdlib.h>
#include <ctype.h>
//Source for recycle.exe - doesn't have to be distributed with jd!
using namespace std;
int main (int argc, char *argv[])
{
if(argc!=2){
return 0;
};
strcat (argv[1],"\0");
SHFILEOPSTRUCTA fop;
// initialize all data required for the copy
fop.hwnd = NULL;
fop.wFunc = FO_DELETE;
fop.pFrom = argv[1]; //src is a char array should be valid but
fop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_ALLOWUNDO;
if(!SHFileOperation(&fop)) //performs copy only if path exist
{
return 1;
}
return 0;
}

BIN
tools/recycle/recycle.exe Normal file

Binary file not shown.