mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-27 02:40:51 +01:00
Construct proper packet in scheduler check
This commit is contained in:
parent
7d7f9825c5
commit
37cc602d2d
@ -1,10 +1,8 @@
|
|||||||
package gearth.ui.subforms.scheduler;
|
package gearth.ui.subforms.scheduler;
|
||||||
|
|
||||||
import com.tulskiy.keymaster.common.Provider;
|
import com.tulskiy.keymaster.common.Provider;
|
||||||
import gearth.extensions.parsers.HDirection;
|
|
||||||
import gearth.protocol.HConnection;
|
import gearth.protocol.HConnection;
|
||||||
import gearth.protocol.StateChangeListener;
|
import gearth.protocol.HPacketFormat;
|
||||||
import gearth.protocol.connection.HState;
|
|
||||||
import gearth.services.scheduler.Interval;
|
import gearth.services.scheduler.Interval;
|
||||||
import gearth.services.scheduler.Scheduler;
|
import gearth.services.scheduler.Scheduler;
|
||||||
import gearth.ui.translations.LanguageBundle;
|
import gearth.ui.translations.LanguageBundle;
|
||||||
@ -23,7 +21,6 @@ import javax.swing.*;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Jonas on 06/04/18.
|
* Created by Jonas on 06/04/18.
|
||||||
@ -114,15 +111,21 @@ public class SchedulerController extends SubForm {
|
|||||||
if (connection == null) return;
|
if (connection == null) return;
|
||||||
|
|
||||||
HMessage.Direction direction = rb_incoming.isSelected() ? HMessage.Direction.TOCLIENT : HMessage.Direction.TOSERVER;
|
HMessage.Direction direction = rb_incoming.isSelected() ? HMessage.Direction.TOCLIENT : HMessage.Direction.TOSERVER;
|
||||||
HPacket packet = new HPacket(txt_packet.getText());
|
HPacketFormat packetFormat = HPacketFormat.getFormat(connection.getClientType(), direction);
|
||||||
|
HPacket packet = packetFormat.createPacket(txt_packet.getText());
|
||||||
boolean isPacketOk = connection.canSendPacket(direction, packet);
|
boolean isPacketOk = connection.canSendPacket(direction, packet);
|
||||||
|
|
||||||
btn_addoredit.setDisable(!Interval.isValid(txt_delay.getText()) || !isPacketOk);
|
btn_addoredit.setDisable(!Interval.isValid(txt_delay.getText()) || !isPacketOk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void scheduleBtnClicked(ActionEvent actionEvent) {
|
public void scheduleBtnClicked(ActionEvent actionEvent) {
|
||||||
|
HConnection connection = getHConnection();
|
||||||
|
if (connection == null) return;
|
||||||
|
|
||||||
if (isBeingEdited == null) {
|
if (isBeingEdited == null) {
|
||||||
HPacket packet = new HPacket(txt_packet.getText());
|
HMessage.Direction direction = rb_incoming.isSelected() ? HMessage.Direction.TOCLIENT : HMessage.Direction.TOSERVER;
|
||||||
|
HPacketFormat packetFormat = HPacketFormat.getFormat(connection.getClientType(), direction);
|
||||||
|
HPacket packet = packetFormat.createPacket(txt_packet.getText());
|
||||||
if (packet.isCorrupted()) return;
|
if (packet.isCorrupted()) return;
|
||||||
|
|
||||||
InteractableScheduleItem newItem = new InteractableScheduleItem(
|
InteractableScheduleItem newItem = new InteractableScheduleItem(
|
||||||
|
2
pom.xml
2
pom.xml
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Version of the application. -->
|
<!-- Version of the application. -->
|
||||||
<revision>1.5.4-beta-1</revision>
|
<revision>1.5.4-beta-2</revision>
|
||||||
<!-- Version for https://github.com/sirjonasxx/G-ExtensionStore to keep compatibility with beta versions. -->
|
<!-- Version for https://github.com/sirjonasxx/G-ExtensionStore to keep compatibility with beta versions. -->
|
||||||
<storeVersion>1.5.3</storeVersion>
|
<storeVersion>1.5.3</storeVersion>
|
||||||
<!-- Default repository for version checking. -->
|
<!-- Default repository for version checking. -->
|
||||||
|
Loading…
Reference in New Issue
Block a user