Verschillende fouten met opstartende en afsluitende applicaties opgelost.
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -38,10 +38,6 @@ public abstract class WindowsApplication extends CMDApplication {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean active() {
|
|
||||||
return (handle = Windows.findWindow(name, null)) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deactivate() throws DeactivateException {
|
public void deactivate() throws DeactivateException {
|
||||||
try {
|
try {
|
||||||
VBScript.terminate(program);
|
VBScript.terminate(program);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import mimis.application.cmd.CMDApplication;
|
|||||||
import mimis.exception.worker.ActivateException;
|
import mimis.exception.worker.ActivateException;
|
||||||
import mimis.exception.worker.DeactivateException;
|
import mimis.exception.worker.DeactivateException;
|
||||||
import mimis.util.Native;
|
import mimis.util.Native;
|
||||||
|
import mimis.util.VBScript;
|
||||||
import mimis.value.Action;
|
import mimis.value.Action;
|
||||||
import mimis.value.Amount;
|
import mimis.value.Amount;
|
||||||
|
|
||||||
@@ -65,6 +66,11 @@ public class VLCApplication extends CMDApplication {
|
|||||||
super.stop();
|
super.stop();
|
||||||
volumeWorker.stop();
|
volumeWorker.stop();
|
||||||
seekWorker.stop();
|
seekWorker.stop();
|
||||||
|
try {
|
||||||
|
VBScript.terminate(program);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void begin(Action action) {
|
public void begin(Action action) {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class WiimoteDevice extends Device implements GestureListener {
|
|||||||
public WiimoteDevice() {
|
public WiimoteDevice() {
|
||||||
super(TITLE);
|
super(TITLE);
|
||||||
eventMapCycle = new WiimoteEventMapCycle();
|
eventMapCycle = new WiimoteEventMapCycle();
|
||||||
wiimoteDiscovery = new WiimoteDiscovery(this);
|
//wiimoteDiscovery = new WiimoteDiscovery(this);
|
||||||
gestureDevice = new GestureDevice();
|
gestureDevice = new GestureDevice();
|
||||||
gestureDevice.add(this);
|
gestureDevice.add(this);
|
||||||
gestureId = 0;
|
gestureId = 0;
|
||||||
@@ -53,20 +53,27 @@ public class WiimoteDevice extends Device implements GestureListener {
|
|||||||
|
|
||||||
/* Worker */
|
/* Worker */
|
||||||
public void activate() throws ActivateException {
|
public void activate() throws ActivateException {
|
||||||
connect();
|
//connect();
|
||||||
|
try {
|
||||||
|
wiimote = wiimoteService.getDevice(this);
|
||||||
|
ledWorker.activate();
|
||||||
|
} catch (DeviceNotFoundException e) {
|
||||||
|
log.error(e);
|
||||||
|
throw new ActivateException();
|
||||||
|
}
|
||||||
add(eventMapCycle.player);
|
add(eventMapCycle.player);
|
||||||
super.activate();
|
super.activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean active() {
|
/*public boolean active() {
|
||||||
if (wiimote != null) {
|
if (wiimote != null) {
|
||||||
if (!ledWorker.active()) {
|
/*if (!ledWorker.active()) {
|
||||||
try {
|
try {
|
||||||
ledWorker.activate();
|
ledWorker.activate();
|
||||||
} catch (ActivateException e) {
|
} catch (ActivateException e) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
}
|
}
|
||||||
}
|
}*
|
||||||
connected = false;
|
connected = false;
|
||||||
wiimote.getStatus();
|
wiimote.getStatus();
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
@@ -86,16 +93,16 @@ public class WiimoteDevice extends Device implements GestureListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return active;
|
return active;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
super.stop();
|
super.stop();
|
||||||
ledWorker.stop();
|
ledWorker.stop();
|
||||||
if (wiimote != null) {
|
/*if (wiimote != null) {
|
||||||
disconnect();
|
disconnect();
|
||||||
}
|
}
|
||||||
wiimoteService.exit();
|
wiimoteService.exit();*/
|
||||||
wiimoteDiscovery.stop();
|
//wiimoteDiscovery.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Events */
|
/* Events */
|
||||||
@@ -163,7 +170,7 @@ public class WiimoteDevice extends Device implements GestureListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void connected() {
|
/*public void connected() {
|
||||||
try {
|
try {
|
||||||
wiimote = wiimoteService.getDevice(this);
|
wiimote = wiimoteService.getDevice(this);
|
||||||
try {
|
try {
|
||||||
@@ -174,20 +181,20 @@ public class WiimoteDevice extends Device implements GestureListener {
|
|||||||
} catch (DeviceNotFoundException e) {
|
} catch (DeviceNotFoundException e) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public void disconnect() {
|
/*public void disconnect() {
|
||||||
wiimote.disconnect();
|
wiimote.disconnect();
|
||||||
wiimote = null;
|
wiimote = null;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public void disconnected() {
|
/*public void disconnected() {
|
||||||
try {
|
try {
|
||||||
wiimoteDiscovery.activate();
|
wiimoteDiscovery.activate();
|
||||||
} catch (ActivateException e) {
|
} catch (ActivateException e) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/* Listeners */
|
/* Listeners */
|
||||||
public void onButtonsEvent(WiimoteButtonsEvent event) {
|
public void onButtonsEvent(WiimoteButtonsEvent event) {
|
||||||
@@ -240,6 +247,7 @@ public class WiimoteDevice extends Device implements GestureListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void setLeds(int leds) {
|
protected void setLeds(int leds) {
|
||||||
|
if (wiimote != null) {
|
||||||
wiimote.setLeds(
|
wiimote.setLeds(
|
||||||
(leds & 1) > 0,
|
(leds & 1) > 0,
|
||||||
(leds & 2) > 0,
|
(leds & 2) > 0,
|
||||||
@@ -249,3 +257,4 @@ public class WiimoteDevice extends Device implements GestureListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ public class VBScript {
|
|||||||
public static boolean isRunning(String program) throws IOException {
|
public static boolean isRunning(String program) throws IOException {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
File file = File.createTempFile("vbsutils", ".vbs");
|
File file = File.createTempFile("vbsutils", ".vbs");
|
||||||
file.deleteOnExit();
|
|
||||||
FileWriter fileWriter = new FileWriter(file);
|
FileWriter fileWriter = new FileWriter(file);
|
||||||
fileWriter.write(String.format(
|
fileWriter.write(String.format(
|
||||||
"Set WshShell = WScript.CreateObject(\"WScript.Shell\")\n"
|
"Set WshShell = WScript.CreateObject(\"WScript.Shell\")\n"
|
||||||
@@ -29,6 +28,9 @@ public class VBScript {
|
|||||||
String line = input.readLine();
|
String line = input.readLine();
|
||||||
found = line != null && line.equals(program);
|
found = line != null && line.equals(program);
|
||||||
input.close();
|
input.close();
|
||||||
|
try {
|
||||||
|
process.waitFor();
|
||||||
|
} catch (InterruptedException e) {}
|
||||||
file.delete();
|
file.delete();
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user