mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-04-03 14:35:40 +02:00
Compare commits
11 Commits
CreateMave
...
featureAud
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
037dc8a05b | ||
|
|
476b4a7dd1 | ||
|
|
bd687dc50f | ||
|
|
7bce7be2ba | ||
|
|
3286a34a08 | ||
|
|
c2086a73b0 | ||
|
|
d57880d945 | ||
|
|
d79886d4c9 | ||
|
|
499b58965c | ||
|
|
7d9adeba1a | ||
|
|
fcc46b3c3b |
@@ -1 +1,2 @@
|
||||
do5sa
|
||||
##12390780900ß9'++++2e0NEY#####
|
||||
3
jdk.cmd
Normal file
3
jdk.cmd
Normal file
@@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
SET JAVA_HOME=C:\Program Files\Java\jdk-17
|
||||
SET PATH=%JAVA_HOME%\bin,%PATH%
|
||||
@@ -5,4 +5,19 @@ public class ApplicationConstants {
|
||||
* Name of the Application.
|
||||
*/
|
||||
public static final String APPLICATION_NAME = "praktiKST";
|
||||
|
||||
/**
|
||||
* Name of file to store preferences in.
|
||||
*/
|
||||
public static final double APPLICATION_CURRENTVERSIONNUMBER = 0.9;
|
||||
|
||||
public static final String VERSIONINFOURLFORUPDATES_KST4CONTEST = "https://do5amf.funkerportal.de/kst4ContestVersionInfo.xml";
|
||||
public static final String VERSIONINFDOWNLOADEDLOCALFILE = "kst4ContestVersionInfo.xml";
|
||||
|
||||
public static final String DISCSTRING_DISCONNECT_AND_CLOSE = "CLOSEALL";
|
||||
public static final String DISCSTRING_DISCONNECT_DUE_PAWWORDERROR = "JUSTDSICCAUSEPWWRONG";
|
||||
public static final String DISCSTRING_DISCONNECTONLY = "ONLYDISCONNECT";
|
||||
|
||||
public static final String DISCONNECT_RDR_POISONPILL = "POISONPILL_KILLTHREAD"; //whereever a (blocking) udp or tcp reader in an infinite loop gets this message, it will break this loop
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,9 @@ public class AirScoutPeriodicalAPReflectionInquirerTask extends TimerTask {
|
||||
String asWatchListStringSuffix = asWatchListString;
|
||||
|
||||
String host = "255.255.255.255";
|
||||
int port = 9872;
|
||||
// int port = 9872;
|
||||
int port = client.getChatPreferences().getAirScout_asCommunicationPort();
|
||||
// System.out.println("<<<<<<<<<<<<<<<<<<<<ASPERI: " + port);
|
||||
|
||||
// byte[] message = "ASSETPATH: \"KST\" \"AS\" 1440000,DO5AMF,JN49GL,OK1MZM,JN89IW ".getBytes(); Original, ging
|
||||
InetAddress address;
|
||||
|
||||
@@ -11,13 +11,13 @@ import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.value.ObservableStringValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import kst4contest.model.ChatCategory;
|
||||
import kst4contest.model.ChatMember;
|
||||
import kst4contest.model.ChatMessage;
|
||||
import kst4contest.model.ChatPreferences;
|
||||
import kst4contest.model.ClusterMessage;
|
||||
import kst4contest.ApplicationConstants;
|
||||
import kst4contest.model.*;
|
||||
import kst4contest.utils.PlayAudioUtils;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
@@ -41,6 +41,7 @@ public class ChatController {
|
||||
*/
|
||||
// private int category = ChatCategory.VUHF;
|
||||
|
||||
private UpdateInformation updateInformation;
|
||||
private ChatPreferences chatPreferences;
|
||||
|
||||
private ChatCategory category;
|
||||
@@ -57,6 +58,14 @@ public class ChatController {
|
||||
this.disconnectionPerformedByUser = disconnectionPerformedByUser;
|
||||
}
|
||||
|
||||
public UpdateInformation getUpdateInformation() {
|
||||
return updateInformation;
|
||||
}
|
||||
|
||||
public void setUpdateInformation(UpdateInformation updateInformation) {
|
||||
this.updateInformation = updateInformation;
|
||||
}
|
||||
|
||||
public String getChatState() {
|
||||
return chatState;
|
||||
}
|
||||
@@ -91,7 +100,8 @@ public class ChatController {
|
||||
|
||||
/**
|
||||
* Handles the disconnect of either the chat (Case DISCONNECTONLY) or the
|
||||
* complete application life including all threads (case CLOSEALL)
|
||||
* complete application life including all threads (case CLOSEALL)<br/><br/>
|
||||
* Look in ApplicationConstants for the DISCSTRINGS
|
||||
*
|
||||
* @param action: "CLOSEALL" or "DISCONNECTONLYCHAT", on application close event
|
||||
* (Settings Window closed), Disconnect on Disconnect-Button
|
||||
@@ -101,7 +111,56 @@ public class ChatController {
|
||||
|
||||
this.setDisconnectionPerformedByUser(true);
|
||||
|
||||
if (action.equals("CLOSEALL")) {
|
||||
try {
|
||||
/**
|
||||
* Kill UCX packetreader by sending poison pill to the reader thread
|
||||
*/
|
||||
DatagramSocket dsocket;
|
||||
|
||||
String host = "255.255.255.255";
|
||||
int port = chatPreferences.getLogsynch_ucxUDPWkdCallListenerPort();
|
||||
InetAddress address;
|
||||
|
||||
address = InetAddress.getByName("255.255.255.255");
|
||||
DatagramPacket packet = new DatagramPacket(ApplicationConstants.DISCONNECT_RDR_POISONPILL.getBytes(), ApplicationConstants.DISCONNECT_RDR_POISONPILL.length(), address, port);
|
||||
dsocket = new DatagramSocket();
|
||||
dsocket.setBroadcast(true);
|
||||
dsocket.send(packet);
|
||||
// dsocket.send(packet);
|
||||
dsocket.close();
|
||||
|
||||
readUDPbyUCXThread.interrupt();
|
||||
|
||||
} catch (Exception error) {
|
||||
System.out.println("Chatcrontroller, ERROR: unable to send poison pill to ucxThread");
|
||||
}
|
||||
|
||||
try {
|
||||
/**
|
||||
* Kill AS packetreader by sending poison pill to the reader thread
|
||||
*/
|
||||
DatagramSocket dsocket;
|
||||
|
||||
String host = "255.255.255.255";
|
||||
int port = chatPreferences.getAirScout_asCommunicationPort();
|
||||
InetAddress address;
|
||||
|
||||
address = InetAddress.getByName("255.255.255.255");
|
||||
DatagramPacket packet = new DatagramPacket(ApplicationConstants.DISCONNECT_RDR_POISONPILL.getBytes(), ApplicationConstants.DISCONNECT_RDR_POISONPILL.length(), address, port);
|
||||
dsocket = new DatagramSocket();
|
||||
dsocket.setBroadcast(true);
|
||||
dsocket.send(packet);
|
||||
dsocket.close();
|
||||
} catch (Exception error) {
|
||||
System.out.println("Chatcrontroller, ERROR: unable to send poison pill to ucxThread");
|
||||
}
|
||||
|
||||
|
||||
if (action.equals(ApplicationConstants.DISCSTRING_DISCONNECT_AND_CLOSE)) {
|
||||
|
||||
this.lst_chatMemberList.clear();;
|
||||
this.lst_clusterMemberList.clear();
|
||||
|
||||
this.setDisconnected(true);
|
||||
this.setConnectedAndLoggedIn(false);
|
||||
this.setConnectedAndNOTLoggedIn(false);
|
||||
@@ -119,9 +178,8 @@ public class ChatController {
|
||||
messageRXBus.add(killThreadPoisonPillMsg); //kills messageprocessor
|
||||
messageTXBus.add(killThreadPoisonPillMsg); //kills writethread
|
||||
|
||||
writeThread.interrupt();
|
||||
|
||||
readThread.interrupt();
|
||||
// writeThread.interrupt();
|
||||
// readThread.interrupt();
|
||||
|
||||
beaconTimer.purge();
|
||||
beaconTimer.cancel();
|
||||
@@ -159,11 +217,15 @@ public class ChatController {
|
||||
// TODO Auto-generated catch block
|
||||
e2.printStackTrace();
|
||||
}
|
||||
} else if (action.equals("JUSTDSICCAUSEPWWRONG")){
|
||||
} else if (action.equals(ApplicationConstants.DISCSTRING_DISCONNECTONLY)){
|
||||
|
||||
this.lst_chatMemberList.clear();;
|
||||
this.lst_clusterMemberList.clear();
|
||||
|
||||
|
||||
this.setDisconnected(true);
|
||||
this.setConnectedAndLoggedIn(false);
|
||||
this.setConnectedAndNOTLoggedIn(true);
|
||||
this.setConnectedAndNOTLoggedIn(false);
|
||||
// disconnect telnet and kill all sockets and connections
|
||||
|
||||
keepAliveTimer.cancel();
|
||||
@@ -179,7 +241,6 @@ public class ChatController {
|
||||
messageTXBus.add(killThreadPoisonPillMsg); //kills writethread
|
||||
|
||||
writeThread.interrupt();
|
||||
|
||||
readThread.interrupt();
|
||||
|
||||
beaconTimer.purge();
|
||||
@@ -192,24 +253,34 @@ public class ChatController {
|
||||
userActualizationtimer.purge();
|
||||
userActualizationtimer.cancel();
|
||||
|
||||
userActualizationtimer.purge();
|
||||
userActualizationtimer.cancel();
|
||||
|
||||
// consoleReader.interrupt();
|
||||
messageProcessor.interrupt();
|
||||
// messageProcessor.interrupt();
|
||||
|
||||
readUDPbyUCXThread.interrupt();
|
||||
readUDPbyUCXThread.interrupt(); //need poisonpill?
|
||||
airScoutUDPReaderThread.interrupt(); //need poisonpill?
|
||||
|
||||
airScoutUDPReaderThread.interrupt();
|
||||
// dbHandler.closeDBConnection();
|
||||
// this.dbHandler = null;
|
||||
|
||||
dbHandler.closeDBConnection();
|
||||
|
||||
try {
|
||||
|
||||
if (socket != null) {
|
||||
socket.close();
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (Exception e2) {
|
||||
// TODO Auto-generated catch block
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// private String userName = "DO5AMF";
|
||||
// private String password = "uxskezcj";
|
||||
private String userName;
|
||||
private String password;
|
||||
private String showedName;
|
||||
@@ -218,8 +289,7 @@ public class ChatController {
|
||||
private String chatState;
|
||||
|
||||
private String hostname = "109.90.0.130";
|
||||
private String praktiKSTVersion = "wtKST 3.1.4.6";
|
||||
// private String praktiKSTVersion = "praktiKST 1.0";
|
||||
private String praktiKSTVersion = "praktiKST 0.9b";
|
||||
private String praktiKSTVersionInfo = "2022-10 - 2022-12\ndeveloped by DO5AMF, Marc\nContact: praktimarc@gmail.com\nDonations via paypal are welcome";
|
||||
|
||||
private int port = 23001; // kst4contest.test 4 23001
|
||||
@@ -232,6 +302,12 @@ public class ChatController {
|
||||
private MessageBusManagementThread messageProcessor;
|
||||
private ReadUDPbyAirScoutMessageThread airScoutUDPReaderThread;
|
||||
|
||||
private PlayAudioUtils playAudioUtils = new PlayAudioUtils();
|
||||
|
||||
public PlayAudioUtils getPlayAudioUtils() {
|
||||
return playAudioUtils;
|
||||
}
|
||||
|
||||
private TimerTask userActualizationTask;
|
||||
|
||||
private TimerTask keepAliveMessageSenderTask;
|
||||
@@ -434,8 +510,8 @@ public class ChatController {
|
||||
}
|
||||
|
||||
public ChatController() {
|
||||
super();
|
||||
|
||||
super();
|
||||
category = new ChatCategory(2);
|
||||
ownChatMemberObject = new ChatMember();
|
||||
ownChatMemberObject.setCallSign(userName);
|
||||
@@ -444,7 +520,6 @@ public class ChatController {
|
||||
|
||||
// this.category = ChatCategory.VUHF;
|
||||
this.userName = ownChatMemberObject.getName();
|
||||
// this.password = "uxskezcj";
|
||||
this.hostname = "www.on4kst.info";
|
||||
this.port = port;
|
||||
}
|
||||
@@ -452,12 +527,20 @@ public class ChatController {
|
||||
/**
|
||||
* This constructor is used by the Main()-Class of the praktiKST javaFX-gui.
|
||||
*
|
||||
* @param setCategory
|
||||
*
|
||||
* @param setOwnChatMemberObject
|
||||
*/
|
||||
public ChatController(ChatMember setOwnChatMemberObject) {
|
||||
super();
|
||||
|
||||
UpdateChecker checkForUpdates = new UpdateChecker(this);
|
||||
|
||||
if (checkForUpdates.downloadLatestVersionInfoXML()) {
|
||||
updateInformation = checkForUpdates.parseUpdateXMLFile();
|
||||
};
|
||||
|
||||
dbHandler = new DBController();
|
||||
|
||||
chatPreferences = new ChatPreferences();
|
||||
chatPreferences.readPreferencesFromXmlFile(); // set the praktikst Prefs by file or default if file is corrupted
|
||||
|
||||
@@ -540,6 +623,12 @@ public class ChatController {
|
||||
|
||||
public void execute() throws InterruptedException, IOException {
|
||||
|
||||
// messageBus = new SimpleStringProperty("_____est connection");
|
||||
|
||||
// ObservableStringValue test = new SimpleStringProperty("test");
|
||||
|
||||
// eventBus = test;
|
||||
|
||||
chatController = this;
|
||||
|
||||
// This block constructs a sample message
|
||||
@@ -553,7 +642,9 @@ public class ChatController {
|
||||
// getLst_toAllMessageList().add(Test);
|
||||
|
||||
try {
|
||||
dbHandler = new DBController();
|
||||
setDisconnectionPerformedByUser(false);
|
||||
|
||||
// dbHandler = new DBController(); //TODO: old place to instantiuate the dbcontroller
|
||||
|
||||
messageRXBus = new LinkedBlockingQueue<ChatMessage>();
|
||||
messageTXBus = new LinkedBlockingQueue<ChatMessage>();
|
||||
@@ -573,7 +664,7 @@ public class ChatController {
|
||||
writeThread.setName("Writethread-telnetwriter");
|
||||
writeThread.start();
|
||||
|
||||
readUDPbyUCXThread = new ReadUDPbyUCXMessageThread(12060, this);
|
||||
readUDPbyUCXThread = new ReadUDPbyUCXMessageThread(chatPreferences.getLogsynch_ucxUDPWkdCallListenerPort(), this);
|
||||
readUDPbyUCXThread.setName("readUDPbyUCXThread");
|
||||
readUDPbyUCXThread.start();
|
||||
|
||||
@@ -581,7 +672,7 @@ public class ChatController {
|
||||
messageProcessor.setName("messagebusManagementThread");
|
||||
messageProcessor.start();
|
||||
|
||||
airScoutUDPReaderThread = new ReadUDPbyAirScoutMessageThread(9872, this, "AS", "KST");
|
||||
airScoutUDPReaderThread = new ReadUDPbyAirScoutMessageThread(chatPreferences.getAirScout_asCommunicationPort(), this, "AS", "KST");
|
||||
airScoutUDPReaderThread.setName("airscoutudpreaderThread");
|
||||
airScoutUDPReaderThread.start();
|
||||
|
||||
@@ -620,7 +711,7 @@ public class ChatController {
|
||||
*/
|
||||
// Timer ASQueryTimer;
|
||||
ASQueryTimer = new Timer();
|
||||
ASQueryTimer.schedule(new AirScoutPeriodicalAPReflectionInquirerTask(this), 10000, 5000);
|
||||
ASQueryTimer.schedule(new AirScoutPeriodicalAPReflectionInquirerTask(this), 10000, 12000);
|
||||
// 60000 * intervalInMinutes = IntervalInMillis
|
||||
|
||||
/**
|
||||
@@ -632,7 +723,7 @@ public class ChatController {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// System.out.println("[Chatcontroller, info: ] periodical socketcheck");
|
||||
System.out.println("[Chatcontroller, info: ] periodical socketcheck");
|
||||
|
||||
Thread.currentThread().setName("SocketcheckTimer");
|
||||
|
||||
@@ -645,13 +736,6 @@ public class ChatController {
|
||||
chatController.setConnectedAndLoggedIn(false);
|
||||
chatController.getLst_chatMemberList().clear();
|
||||
|
||||
// messageProcessor.interrupt();
|
||||
// chatController.getReadThread().interrupt();
|
||||
// chatController.getWriteThread().interrupt();
|
||||
|
||||
// keepAliveTimer.wait();
|
||||
|
||||
// chatController.getstat
|
||||
System.out.println("[Chatcontroller, Warning: ] Socket closed or disconnected");
|
||||
|
||||
ChatMessage killThreadPoisonPillMsg = new ChatMessage();
|
||||
|
||||
@@ -27,8 +27,7 @@ public class DBController {
|
||||
private static final DBController dbcontroller = new DBController();
|
||||
private static Connection connection;
|
||||
// private static final String DB_PATH = System.getProperty("praktiKST.db");
|
||||
private static final String DB_PATH = ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, DATABASE_FILE);
|
||||
|
||||
private static String DB_PATH = ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, DATABASE_FILE);
|
||||
|
||||
/*
|
||||
static {
|
||||
@@ -62,6 +61,9 @@ public class DBController {
|
||||
}
|
||||
|
||||
private void initDBConnection() {
|
||||
|
||||
System.out.println("DBH: initiate new db connection");
|
||||
|
||||
try {
|
||||
ApplicationFileUtils.copyResourceIfRequired(
|
||||
ApplicationConstants.APPLICATION_NAME,
|
||||
@@ -71,7 +73,17 @@ public class DBController {
|
||||
if (connection != null)
|
||||
return;
|
||||
System.out.println("Creating Connection to Database...");
|
||||
|
||||
DB_PATH = ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, DATABASE_FILE);
|
||||
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
|
||||
|
||||
//connection = DriverManager.getConnection("jdbc:sqlite:" + "C:\\Users\\prakt\\.praktiKST\\praktiKST.db");
|
||||
|
||||
|
||||
|
||||
|
||||
System.out.println("[DBH, Info]: Path = " + DB_PATH);
|
||||
|
||||
if (!connection.isClosed())
|
||||
System.out.println("...Connection established");
|
||||
} catch (SQLException e) {
|
||||
@@ -91,6 +103,8 @@ public class DBController {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
// private void handleDB() {
|
||||
|
||||
@@ -11,16 +11,19 @@ import java.util.regex.Pattern;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.collections.ObservableList;
|
||||
import kst4contest.ApplicationConstants;
|
||||
import kst4contest.model.AirPlaneReflectionInfo;
|
||||
import kst4contest.model.ChatMember;
|
||||
import kst4contest.model.ChatMessage;
|
||||
import kst4contest.model.ClusterMessage;
|
||||
import kst4contest.utils.PlayAudioUtils;
|
||||
import kst4contest.view.Kst4ContestApplication;
|
||||
|
||||
/**
|
||||
*
|
||||
* This thread is responsible for processing rx and tx messages, synchronize tx
|
||||
* and rx and saving the whole chat content in a textfile and write the text to
|
||||
* the stdio.
|
||||
* This thread is responsible for processing received messages.
|
||||
* It checks all messages from server for their functional contest, such as commands to build or change the userlist
|
||||
* or their settings, get clustermessages and sure the content of all chatmessages, which are delivered.
|
||||
*
|
||||
*/
|
||||
public class MessageBusManagementThread extends Thread {
|
||||
@@ -196,6 +199,7 @@ public class MessageBusManagementThread extends Thread {
|
||||
* Builds UserList and gets meta informations out of the chat, as far as it is
|
||||
* possible. \n This is the only place where the Chatmember-List will be written
|
||||
*
|
||||
* Old Method for port 23000, raw text interface without any comfort, no longer used
|
||||
* @param messageToProcess
|
||||
*/
|
||||
private void processRXMessage23000(ChatMessage messageToProcess) {
|
||||
@@ -362,7 +366,11 @@ public class MessageBusManagementThread extends Thread {
|
||||
|
||||
// this.client.getChatMemberTable().put(splittedMessageLine[2], newMember); //TODO: map -> List
|
||||
|
||||
//the own call will not be in the list
|
||||
if (!client.getChatPreferences().getLoginCallSign().equals(newMember.getCallSign())) {
|
||||
this.client.getLst_chatMemberList().add(newMember);
|
||||
}
|
||||
|
||||
|
||||
this.client.getDbHandler().storeChatMember(newMember);
|
||||
|
||||
@@ -380,6 +388,12 @@ public class MessageBusManagementThread extends Thread {
|
||||
if (splittedMessageLine[0].contains(USERENTEREDCHAT) || splittedMessageLine[0].contains(USERENTEREDCHAT2)) {
|
||||
// System.out.println("MSGBUS: User detected");
|
||||
|
||||
/**
|
||||
* The own callsign will not be hold in the userlist any more
|
||||
*/
|
||||
if (!client.getChatPreferences().getLoginCallSign().equals(splittedMessageLine[2])) {
|
||||
|
||||
|
||||
ChatMember newMember = new ChatMember();
|
||||
|
||||
newMember.setAirPlaneReflectInfo(new AirPlaneReflectionInfo());
|
||||
@@ -392,8 +406,9 @@ public class MessageBusManagementThread extends Thread {
|
||||
newMember = this.client.getDbHandler().fetchChatMemberWkdDataForOnlyOneCallsignFromDB(newMember);
|
||||
|
||||
this.client.getLst_chatMemberList().add(newMember);
|
||||
|
||||
this.client.getDbHandler().storeChatMember(newMember);
|
||||
}
|
||||
|
||||
|
||||
// this.client.getChatMemberTable().put(splittedMessageLine[2], newMember);
|
||||
|
||||
@@ -459,25 +474,30 @@ public class MessageBusManagementThread extends Thread {
|
||||
dummy.setCallSign("SERVER");
|
||||
dummy.setName("Sysop");
|
||||
newMessage.setSender(dummy);
|
||||
|
||||
} else {
|
||||
|
||||
ChatMember temp = new ChatMember();
|
||||
temp.setCallSign(splittedMessageLine[3]);
|
||||
ChatMember sender = new ChatMember();
|
||||
sender.setCallSign(splittedMessageLine[3]);
|
||||
|
||||
int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(), temp);
|
||||
int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(), sender);
|
||||
|
||||
if (index != -1) {
|
||||
|
||||
//user found in the chatmember list
|
||||
newMessage.setSender(this.client.getLst_chatMemberList().get(index)); // set sender to member of
|
||||
// b4 init list
|
||||
} else {
|
||||
|
||||
if (!temp.getCallSign().equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) {
|
||||
temp.setCallSign("[n/a]" + temp.getCallSign());
|
||||
//user not found in chatmember list
|
||||
if (!sender.getCallSign().equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) {
|
||||
sender.setCallSign("[n/a]" + sender.getCallSign());
|
||||
// if someone sent a message without being in the userlist (cause
|
||||
// on4kst missed implementing....), callsign will be marked
|
||||
} else {
|
||||
AirPlaneReflectionInfo preventNullpointerExc = new AirPlaneReflectionInfo();
|
||||
preventNullpointerExc.setAirPlanesReachableCntr(0);
|
||||
sender.setAirPlaneReflectInfo(preventNullpointerExc);
|
||||
newMessage.setSender(sender); //my own call is the sender
|
||||
}
|
||||
|
||||
newMessage.setSender(temp); // if someone sent a message without being in the userlist (cause
|
||||
// on4kst missed implementing....)
|
||||
}
|
||||
|
||||
// newMessage.setSender(this.client.getChatMemberTable().get(splittedMessageLine[3]));
|
||||
@@ -487,7 +507,7 @@ public class MessageBusManagementThread extends Thread {
|
||||
newMessage.setMessageText(splittedMessageLine[6]);
|
||||
|
||||
if (splittedMessageLine[7].equals("0")) {
|
||||
// message is not directed to anyone
|
||||
// message is not directed to anyone, move it to the cq messages
|
||||
ChatMember dummy = new ChatMember();
|
||||
dummy.setCallSign("ALL");
|
||||
newMessage.setReceiver(dummy);
|
||||
@@ -496,41 +516,85 @@ public class MessageBusManagementThread extends Thread {
|
||||
|
||||
} else {
|
||||
|
||||
ChatMember temp2 = new ChatMember();
|
||||
temp2.setCallSign(splittedMessageLine[7]);
|
||||
ChatMember receiver = new ChatMember();
|
||||
receiver.setCallSign(splittedMessageLine[7]);
|
||||
|
||||
int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(), temp2);
|
||||
int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(), receiver);
|
||||
|
||||
if (index != -1) {
|
||||
newMessage.setReceiver(this.client.getLst_chatMemberList().get(index));// -1: Member left Chat
|
||||
// before...
|
||||
} else {
|
||||
temp2.setCallSign(temp2.getCallSign() + "(left)");
|
||||
newMessage.setReceiver(temp2);
|
||||
|
||||
|
||||
if (receiver.getCallSign().equals(client.getChatPreferences().getLoginCallSign())) {
|
||||
/**
|
||||
* If mycallsign sent a message to the server, server will publish that message and
|
||||
* send it to all chatmember including me.
|
||||
* As mycall is not in the userlist, the message would not been displayed if I handle
|
||||
* it in the next case (marking left user, just for information). But I want an echo.
|
||||
*/
|
||||
|
||||
receiver.setCallSign(client.getChatPreferences().getLoginCallSign());
|
||||
newMessage.setReceiver(receiver);
|
||||
} else {
|
||||
//this are user which left chat but had been adressed by this message
|
||||
receiver.setCallSign(receiver.getCallSign() + "(left)");
|
||||
newMessage.setReceiver(receiver);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("message directed to: " + newMessage.getReceiver().getCallSign() + ". EQ?: " + this.client.getownChatMemberObject().getCallSign() + " sent by: " + newMessage.getSender().getCallSign().toUpperCase() + " -> EQ?: "+ this.client.getChatPreferences().getLoginCallSign().toUpperCase());
|
||||
// System.out.println("message directed to: " + newMessage.getReceiver().getCallSign() + ". EQ?: " + this.client.getownChatMemberObject().getCallSign() + " sent by: " + newMessage.getSender().getCallSign().toUpperCase() + " -> EQ?: "+ this.client.getChatPreferences().getLoginCallSign().toUpperCase());
|
||||
|
||||
try {
|
||||
/**
|
||||
* message is directed to me, will be put in the "to me" messagelist
|
||||
*/
|
||||
if (newMessage.getReceiver().getCallSign()
|
||||
.equals(this.client.getChatPreferences().getLoginCallSign())) {
|
||||
|
||||
this.client.getLst_toMeMessageList().add(0, newMessage);
|
||||
|
||||
if (this.client.getChatPreferences().isNotify_playSimpleSounds()) {
|
||||
this.client.getPlayAudioUtils().playNoiseLauncher('P');
|
||||
}
|
||||
if (this.client.getChatPreferences().isNotify_playCWCallsignsOnRxedPMs()) {
|
||||
this.client.getPlayAudioUtils().playCWLauncher(" " + " " + newMessage.getSender().getCallSign().toUpperCase());
|
||||
}
|
||||
if (this.client.getChatPreferences().isNotify_playVoiceCallsignsOnRxedPMs()) {
|
||||
this.client.getPlayAudioUtils().playVoiceLauncher( "?" + newMessage.getSender().getCallSign().toUpperCase());
|
||||
}
|
||||
|
||||
if (this.client.getChatPreferences().isNotify_playSimpleSounds()) {
|
||||
if (newMessage.getMessageText().toUpperCase().contains("//BELL")) {
|
||||
this.client.getPlayAudioUtils().playVoiceLauncher("!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
System.out.println("message directed to me: " + newMessage.getReceiver().getCallSign() + ".");
|
||||
|
||||
} else if (newMessage.getSender().getCallSign().toUpperCase() // if you sent the message, it will be sorted in to
|
||||
// the "to you message list"
|
||||
} else if (newMessage.getSender().getCallSign().toUpperCase()
|
||||
/**
|
||||
* message from me will appear in the PM window, too, with (>CALLSIGN) before
|
||||
*/
|
||||
.equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) {
|
||||
String originalMessage = newMessage.getMessageText();
|
||||
newMessage
|
||||
.setMessageText("(>" + newMessage.getReceiver().getCallSign() + ")" + originalMessage);
|
||||
this.client.getLst_toMeMessageList().add(0, newMessage); // TODO:check
|
||||
this.client.getLst_toMeMessageList().add(0, newMessage);
|
||||
// if you sent the message to another station, it will be sorted in to
|
||||
// the "to me message list" with modified messagetext, added rxers callsign
|
||||
|
||||
} else {
|
||||
this.client.getLst_toOtherMessageList().add(0, newMessage);
|
||||
|
||||
// System.out.println("MSGBS bgfx: tx call = " + newMessage.getSender().getCallSign() + " / rx call = " + newMessage.getReceiver().getCallSign());
|
||||
}
|
||||
} catch (NullPointerException referenceDeletedByUserLeftChatDuringMessageprocessing) {
|
||||
System.out.println("MSGBS bgfx, <<<catched error>>>: referenced user left the chat during messageprocessing: ");
|
||||
referenceDeletedByUserLeftChatDuringMessageprocessing.printStackTrace();
|
||||
}
|
||||
|
||||
// sdtout to me message-List
|
||||
|
||||
@@ -584,24 +648,13 @@ public class MessageBusManagementThread extends Thread {
|
||||
} else {
|
||||
/**
|
||||
* User is in the list...
|
||||
*
|
||||
*/
|
||||
this.client.getLst_chatMemberList().get(index).setFrequency(qrg);
|
||||
System.out.println("[MSGBUSMGT:] Frequency for " + splittedMessageLine[3] + " setted: "
|
||||
+ locatedFrequencies);
|
||||
|
||||
// this.client.getLst_chatMemberList().
|
||||
|
||||
// ChatMember dummy = new ChatMember();
|
||||
//
|
||||
// dummy.setAirPlaneReflectInfo(new AirPlaneReflectionInfo()); //TODO: check if this is neccessary
|
||||
// this.client.getLst_chatMemberList().add(dummy); // TODO: Bugfix for UI actualization, maybe we dont need that any more
|
||||
// this.client.getLst_chatMemberList().remove(dummy);
|
||||
// this.client.getLst_chatMemberList().sorted();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO: Next: get frequency infos out of name?
|
||||
@@ -793,9 +846,13 @@ public class MessageBusManagementThread extends Thread {
|
||||
int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(),
|
||||
stateChangeMember);
|
||||
|
||||
//-1 could be the case if mycall is processed
|
||||
if (index != -1) {
|
||||
this.client.getLst_chatMemberList().get(index).setName(stateChangeMember.getName());
|
||||
this.client.getLst_chatMemberList().get(index).setQra(stateChangeMember.getQra());
|
||||
this.client.getLst_chatMemberList().get(index).setState(stateChangeMember.getState());
|
||||
}
|
||||
|
||||
|
||||
// this.client.getChatMemberTable().get(stateChangeMember.getCallSign())
|
||||
// .setName(stateChangeMember.getName());
|
||||
@@ -846,6 +903,10 @@ public class MessageBusManagementThread extends Thread {
|
||||
client.getLst_toAllMessageList().add(pwErrorMsg);
|
||||
}
|
||||
|
||||
// Kst4ContestApplication.alertWindowEvent("Password was wrong. Pse check!");
|
||||
|
||||
client.disconnect(ApplicationConstants.DISCSTRING_DISCONNECTONLY);
|
||||
|
||||
// this.client.disconnect();
|
||||
}
|
||||
|
||||
@@ -938,8 +999,6 @@ public class MessageBusManagementThread extends Thread {
|
||||
|
||||
while (true) {
|
||||
|
||||
|
||||
|
||||
try {
|
||||
messageTextRaw = client.getMessageRXBus().take();
|
||||
|
||||
|
||||
@@ -92,47 +92,6 @@ public class ReadThread extends Thread {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// try {
|
||||
// sleep(3000);
|
||||
// } catch (InterruptedException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
// try {
|
||||
// System.out.println("RDTH: try new socket");
|
||||
// this.client.getSocket().close();
|
||||
// this.client.getSocket().close();
|
||||
// this.client.setSocket(new Socket(this.client.getHostname(), this.client.getPort()));
|
||||
// socket.connect(new InetSocketAddress(this.client.getHostname(), this.client.getPort()));
|
||||
// System.out.println("[Readthread, Warning:] new socket connected? -> " + socket.isConnected());
|
||||
|
||||
// input = socket.getInputStream();
|
||||
// reader = new BufferedReader(new InputStreamReader(input));
|
||||
//
|
||||
// this.sleep(5000);
|
||||
// } catch (IOException | InterruptedException e2) {
|
||||
// // TODO Auto-generated catch block
|
||||
// System.out.println("fucktah");
|
||||
// e2.printStackTrace();
|
||||
// }
|
||||
// try {
|
||||
// sleep(2000);
|
||||
// } catch (InterruptedException e1) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e1.printStackTrace();
|
||||
// }
|
||||
// try {
|
||||
// this.client.getSocket().close();
|
||||
// this.client.setSocket(new Socket(this.client.getHostname(), this.client.getPort()));
|
||||
// } catch (UnknownHostException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// } catch (IOException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Comparator;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import kst4contest.ApplicationConstants;
|
||||
import kst4contest.model.AirPlane;
|
||||
import kst4contest.model.AirPlaneReflectionInfo;
|
||||
import kst4contest.model.ChatMember;
|
||||
@@ -30,6 +31,8 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
|
||||
|
||||
public ReadUDPbyAirScoutMessageThread(int localPort, ChatController client, String ASIdentificator,
|
||||
String ChatClientIdentificator) {
|
||||
|
||||
|
||||
this.localPort = localPort;
|
||||
this.client = client;
|
||||
this.ASIdentificator = ASIdentificator;
|
||||
@@ -38,6 +41,7 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
|
||||
|
||||
@Override
|
||||
public void interrupt() {
|
||||
System.out.println("ReadUDP");
|
||||
super.interrupt();
|
||||
try {
|
||||
if (this.socket != null) {
|
||||
@@ -89,6 +93,12 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
|
||||
}
|
||||
|
||||
socket.receive(packet);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} catch (SocketTimeoutException e2) {
|
||||
// this will catch the repeating Sockettimeoutexception...nothing to do
|
||||
// e2.printStackTrace();
|
||||
@@ -104,10 +114,22 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
|
||||
String received = new String(packet.getData(), packet.getOffset(), packet.getLength());
|
||||
received = received.trim();
|
||||
|
||||
if (received.contains(ApplicationConstants.DISCONNECT_RDR_POISONPILL)) {
|
||||
System.out.println("ReadUdpByASMsgTh, Info: got poison, now dieing....");
|
||||
try {
|
||||
terminateConnection();
|
||||
} catch (Exception e) {
|
||||
System.out.println("ASUDPRDR: catched error " + e.getMessage());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (received.contains("ASSETPATH") || received.contains("ASWATCHLIST")) {
|
||||
// do nothing, that is your own message
|
||||
} else if (received.contains("ASNEAREST:")) {
|
||||
} else if (received.contains("ASNEAREST:")) { //answer by airscout
|
||||
processASUDPMessage(received);
|
||||
|
||||
// System.out.println("[ReadUSPASTh, info:] received AS String " + received);
|
||||
|
||||
AirPlaneReflectionInfo apReflectInfoForChatMember;
|
||||
@@ -260,9 +282,13 @@ public class ReadUDPbyAirScoutMessageThread extends Thread {
|
||||
return apInfo;
|
||||
}
|
||||
|
||||
public boolean terminateConnection() throws IOException {
|
||||
public boolean terminateConnection() {
|
||||
|
||||
try {
|
||||
this.socket.close();
|
||||
} catch (Exception e) {
|
||||
System.out.println("udpbyas: catched " + e.getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import kst4contest.ApplicationConstants;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
@@ -43,17 +44,19 @@ public class ReadUDPbyUCXMessageThread extends Thread {
|
||||
super.interrupt();
|
||||
try {
|
||||
if (this.socket != null) {
|
||||
|
||||
this.socket.close();
|
||||
System.out.println(">>>>>>>>>>>>>>ReadUdpbyUCS: closing socket");
|
||||
terminateConnection();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
System.out.println("UCXUDPRDR: catched error " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
|
||||
|
||||
|
||||
Thread.currentThread().setName("ReadUDPByUCXLogThread");
|
||||
|
||||
DatagramSocket socket = null;
|
||||
@@ -63,7 +66,7 @@ public class ReadUDPbyUCXMessageThread extends Thread {
|
||||
|
||||
try {
|
||||
socket = new DatagramSocket(12060);
|
||||
socket.setSoTimeout(11000); //TODO try for end properly
|
||||
socket.setSoTimeout(2000); //TODO try for end properly
|
||||
}
|
||||
|
||||
catch (SocketException e) {
|
||||
@@ -75,13 +78,11 @@ public class ReadUDPbyUCXMessageThread extends Thread {
|
||||
|
||||
boolean timeOutIndicator = false;
|
||||
|
||||
if (this.client.isDisconnectionPerformedByUser()) {
|
||||
break;//TODO: what if it´s not the finally closage but a band channel change?
|
||||
}
|
||||
// packet = new DatagramPacket(buf, buf.length); //TODO: Changed that due to memory leak, check if all works (seems like that)
|
||||
// DatagramPacket packet = new DatagramPacket(SRPDefinitions.BYTE_BUFFER_MAX_LENGTH); //TODO: Changed that due to memory leak, check if all works (seems like that)
|
||||
try {
|
||||
socket.receive(packet);
|
||||
|
||||
} catch (SocketTimeoutException e2) {
|
||||
|
||||
timeOutIndicator = true;
|
||||
@@ -91,6 +92,33 @@ public class ReadUDPbyUCXMessageThread extends Thread {
|
||||
catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (NullPointerException nE) {
|
||||
// TODO Auto-generated catch block
|
||||
nE.printStackTrace();
|
||||
System.out.println("ReadUdpByUCXTH: Socket not ready");
|
||||
|
||||
|
||||
|
||||
try {
|
||||
socket = new DatagramSocket(client.getChatPreferences().getLogsynch_ucxUDPWkdCallListenerPort());
|
||||
socket.setSoTimeout(2000);
|
||||
} catch (SocketException e) {
|
||||
System.out.println("[ReadUDPByUCSMsgTH, Error]: socket in use or something:");
|
||||
e.printStackTrace();
|
||||
|
||||
try {
|
||||
socket = new DatagramSocket(null);
|
||||
socket.setReuseAddress(true);
|
||||
socket.bind(new InetSocketAddress(client.getChatPreferences().getLogsynch_ucxUDPWkdCallListenerPort()));
|
||||
socket.receive(packet);
|
||||
socket.setSoTimeout(3000);
|
||||
} catch (Exception ex) {
|
||||
System.out.println("ReadUDPByUCXMsgTh: Could not solve that. Program Restart needed.");
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
InetAddress address = packet.getAddress();
|
||||
@@ -99,8 +127,19 @@ public class ReadUDPbyUCXMessageThread extends Thread {
|
||||
String received = new String(packet.getData(), packet.getOffset(), packet.getLength());
|
||||
received = received.trim();
|
||||
|
||||
// System.out.println("recvudpucx");
|
||||
|
||||
// System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<recv " + received);
|
||||
|
||||
if (received.contains(ApplicationConstants.DISCONNECT_RDR_POISONPILL)) {
|
||||
System.out.println("ReadUdpByUCX, Info: got poison, now dieing....");
|
||||
socket.close();
|
||||
timeOutIndicator = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.client.isDisconnectionPerformedByUser()) {
|
||||
break;//TODO: what if it´s not the finally closage but a band channel change?
|
||||
}
|
||||
|
||||
if (!timeOutIndicator) {
|
||||
processUCXUDPMessage(received);
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
*/
|
||||
package kst4contest.controller;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.value.ObservableStringValue;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
@@ -20,6 +23,8 @@ public class StartChat {
|
||||
|
||||
System.out.println("[Startchat:] Starting new Chat instance");
|
||||
|
||||
// ObservableStringValue messageBus = new SimpleStringProperty("");
|
||||
|
||||
ChatController client = new ChatController();
|
||||
client.execute();
|
||||
|
||||
|
||||
133
src/main/java/kst4contest/controller/UpdateChecker.java
Normal file
133
src/main/java/kst4contest/controller/UpdateChecker.java
Normal file
@@ -0,0 +1,133 @@
|
||||
package kst4contest.controller;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import kst4contest.ApplicationConstants;
|
||||
|
||||
import kst4contest.model.UpdateInformation;
|
||||
import kst4contest.utils.ApplicationFileUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
|
||||
public class UpdateChecker {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// new UpdateChecker(null).parseUpdateXMLFile();
|
||||
|
||||
if (new UpdateChecker(null).downloadLatestVersionInfoXML()) {
|
||||
// ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME,ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE,ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE);
|
||||
}
|
||||
new UpdateChecker(null).parseUpdateXMLFile();
|
||||
}
|
||||
|
||||
public UpdateChecker(ChatController chatController) {
|
||||
|
||||
|
||||
System.out.println("[Updatechecker: checking for updates...]");
|
||||
double currentVersionNumber = ApplicationConstants.APPLICATION_CURRENTVERSIONNUMBER;
|
||||
|
||||
}
|
||||
|
||||
String versionInfoDownloadedFromServerFileName = ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE);
|
||||
String versionInfoXMLURLAtServer = ApplicationConstants.VERSIONINFOURLFORUPDATES_KST4CONTEST;
|
||||
double currentVersion = ApplicationConstants.APPLICATION_CURRENTVERSIONNUMBER;
|
||||
//DOWNLOAD from URL, then parse, then do anything with it...
|
||||
|
||||
/**
|
||||
* Downloads the versioninfo-xml-file from a webserver to local. Returns true if download was successful, else false
|
||||
*
|
||||
* @return true if successful
|
||||
*/
|
||||
public boolean downloadLatestVersionInfoXML() {
|
||||
|
||||
try {
|
||||
|
||||
InputStream in = new URL(versionInfoXMLURLAtServer).openStream();
|
||||
Files.copy(in, Paths.get(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/"+ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE)), StandardCopyOption.REPLACE_EXISTING);
|
||||
|
||||
in.close();
|
||||
|
||||
// System.out.println(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/"+ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE));
|
||||
// ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME,ApplicationFileUtils.get,ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE);
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("ERROR DOWNLOADING!" + e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public UpdateInformation parseUpdateXMLFile() {
|
||||
|
||||
UpdateInformation updateInfos = new UpdateInformation();
|
||||
|
||||
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME,"/"+ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE,ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE);
|
||||
|
||||
// System.out.println("[Updatecker, Info]: restoring prefs from file " + versionInfoDownloadedFromServerFileName);
|
||||
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
try {
|
||||
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
} catch (ParserConfigurationException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
File xmlConfigFile = new File(versionInfoDownloadedFromServerFileName);
|
||||
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
Document doc = db.parse(xmlConfigFile);
|
||||
|
||||
/**
|
||||
* latestVersion on server
|
||||
*/
|
||||
NodeList list = doc.getElementsByTagName("latestVersion");
|
||||
if (list.getLength() != 0) {
|
||||
|
||||
for (int temp = 0; temp < list.getLength(); temp++) {
|
||||
|
||||
Node node = list.item(temp);
|
||||
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
|
||||
Element element = (Element) node;
|
||||
updateInfos.setLatestVersionNumberOnServer(Double.parseDouble(element.getElementsByTagName("versionNumber").item(0).getTextContent()));
|
||||
updateInfos.setAdminMessage(element.getElementsByTagName("adminMessage").item(0).getTextContent());
|
||||
updateInfos.setMajorChanges(element.getElementsByTagName("majorChanges").item(0)
|
||||
.getTextContent());
|
||||
updateInfos.setLatestVersionPathOnWebserver(element.getElementsByTagName("latestVersionPathOnWebserver").item(0).getTextContent());
|
||||
// System.out.println(updateInfos.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
return updateInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String toString = "";
|
||||
|
||||
toString += this.currentVersion;
|
||||
|
||||
return toString;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
package kst4contest.locatorUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Location class with methods allowing conversion to and from Maidenhead
|
||||
* locator (grid squares) based off of
|
||||
@@ -203,6 +208,28 @@ public class Location {
|
||||
return getDistanceKm(this, loc2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param locator1 6 letter location string
|
||||
* @param locator2 6 letter location string
|
||||
* @return great circle distance in kilometers
|
||||
*/
|
||||
public double getDistanceKmByTwoLocatorStrings(String locator1,String locator2 ) {
|
||||
Location loc1 = new Location(locator1);
|
||||
Location loc2 = new Location(locator2);
|
||||
|
||||
Locale locale = new Locale("en", "UK");
|
||||
String pattern = "###.##";
|
||||
|
||||
DecimalFormat decimalFormat = (DecimalFormat)
|
||||
NumberFormat.getNumberInstance(locale);
|
||||
decimalFormat.applyPattern(pattern);
|
||||
|
||||
String format = decimalFormat.format(loc1.getDistanceKm(loc2));
|
||||
|
||||
// return df.format(number);
|
||||
return Double.parseDouble(format);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param loc2
|
||||
* second location
|
||||
@@ -278,6 +305,19 @@ public class Location {
|
||||
return getBearing(this, loc2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return bearing in degrees
|
||||
*/
|
||||
public double getBearingOfTwoLocatorStrings(String locator1, String locator2) {
|
||||
|
||||
Location loc1 = new Location(locator1);
|
||||
Location loc2 = new Location(locator2);
|
||||
|
||||
return getBearing(loc1, loc2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param loc1
|
||||
* source location
|
||||
|
||||
@@ -46,6 +46,8 @@ public class ChatPreferences {
|
||||
*/
|
||||
public static final String PREFERENCE_RESOURCE = "/praktiKSTpreferences.xml";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor will set the default values (also for predefined texts
|
||||
* and shorts) automatically at initialization
|
||||
@@ -130,13 +132,16 @@ public class ChatPreferences {
|
||||
* Station preferences
|
||||
*/
|
||||
|
||||
boolean loginAFKState = false; //always start as here
|
||||
String loginCallSign = "do5amf";
|
||||
String loginPassword = "";
|
||||
String loginName = "Marc";
|
||||
String loginLocator = "jn49fk";
|
||||
|
||||
ChatCategory loginChatCategory = new ChatCategory(2);
|
||||
IntegerProperty actualQTF = new SimpleIntegerProperty(360); // will be updated by user at runtime!
|
||||
|
||||
|
||||
/**
|
||||
* Log Synch preferences
|
||||
*/
|
||||
@@ -164,6 +169,13 @@ public class ChatPreferences {
|
||||
* Notification prefs
|
||||
*/
|
||||
|
||||
//Audio section
|
||||
boolean notify_playSimpleSounds = true;
|
||||
boolean notify_playCWCallsignsOnRxedPMs = true;
|
||||
boolean notify_playVoiceCallsignsOnRxedPMs = true;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Shortcuts and Textsnippets prefs
|
||||
*/
|
||||
@@ -198,6 +210,17 @@ public class ChatPreferences {
|
||||
// MYQRG = mYQRG;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
public boolean isLoginAFKState() {
|
||||
return loginAFKState;
|
||||
}
|
||||
|
||||
public void setLoginAFKState(boolean loginAFKState) {
|
||||
this.loginAFKState = loginAFKState;
|
||||
}
|
||||
|
||||
public String getLoginCallSign() {
|
||||
return loginCallSign;
|
||||
}
|
||||
@@ -267,10 +290,33 @@ public class ChatPreferences {
|
||||
this.logsynch_storeWorkedCallSignsFileNameUDPMessageBackup = logsynch_storeWorkedCallSignsFileNameUDPMessageBackup;
|
||||
}
|
||||
|
||||
public boolean isNotify_playSimpleSounds() {
|
||||
return notify_playSimpleSounds;
|
||||
}
|
||||
|
||||
public boolean isNotify_playCWCallsignsOnRxedPMs() {
|
||||
return notify_playCWCallsignsOnRxedPMs;
|
||||
}
|
||||
|
||||
public boolean isNotify_playVoiceCallsignsOnRxedPMs() {
|
||||
return notify_playVoiceCallsignsOnRxedPMs;
|
||||
}
|
||||
|
||||
public void setNotify_playSimpleSounds(boolean notify_playSimpleSounds) {
|
||||
this.notify_playSimpleSounds = notify_playSimpleSounds;
|
||||
}
|
||||
|
||||
public void setNotify_playCWCallsignsOnRxedPMs(boolean notify_playCWCallsignsOnRxedPMs) {
|
||||
this.notify_playCWCallsignsOnRxedPMs = notify_playCWCallsignsOnRxedPMs;
|
||||
}
|
||||
|
||||
public void setNotify_playVoiceCallsignsOnRxedPMs(boolean notify_playVoiceCallsignsOnRxedPMs) {
|
||||
this.notify_playVoiceCallsignsOnRxedPMs = notify_playVoiceCallsignsOnRxedPMs;
|
||||
}
|
||||
|
||||
/**
|
||||
* actualQTF, int, QTF in degrees
|
||||
*
|
||||
* @param actualQTF, int, QTF in degrees
|
||||
*/
|
||||
|
||||
public StringProperty getMYQRG() {
|
||||
@@ -603,6 +649,27 @@ public class ChatPreferences {
|
||||
asQry_airScoutBandValue.setTextContent(this.getAirScout_asBandString());
|
||||
AirScoutQuerier.appendChild(asQry_airScoutBandValue);
|
||||
|
||||
|
||||
/**
|
||||
* Notifications
|
||||
*/
|
||||
|
||||
Element notifications = doc.createElement("notifications");
|
||||
rootElement.appendChild(notifications);
|
||||
|
||||
Element notify_SimpleAudioNotificationsEnabled = doc.createElement("notify_SimpleAudioNotificationsEnabled");
|
||||
notify_SimpleAudioNotificationsEnabled.setTextContent(this.isNotify_playSimpleSounds()+"");
|
||||
notifications.appendChild(notify_SimpleAudioNotificationsEnabled);
|
||||
|
||||
Element notify_CWCallSignAudioNotificationsEnabled = doc.createElement("notify_CWCallsignAudioNotificationsEnabled");
|
||||
notify_CWCallSignAudioNotificationsEnabled.setTextContent(this.isNotify_playCWCallsignsOnRxedPMs()+"");
|
||||
notifications.appendChild(notify_CWCallSignAudioNotificationsEnabled);
|
||||
|
||||
Element notify_VoiceCallSignAudioNotificationsEnabled = doc.createElement("notify_VoiceCallsignAudioNotificationsEnabled");
|
||||
notify_VoiceCallSignAudioNotificationsEnabled.setTextContent(this.isNotify_playVoiceCallsignsOnRxedPMs()+"");
|
||||
notifications.appendChild(notify_VoiceCallSignAudioNotificationsEnabled);
|
||||
|
||||
|
||||
/**
|
||||
* Shortcuts
|
||||
*/
|
||||
@@ -905,6 +972,56 @@ public class ChatPreferences {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Case notifications
|
||||
*/
|
||||
|
||||
list = doc.getElementsByTagName("notifications");
|
||||
if (list.getLength() != 0) {
|
||||
|
||||
for (int temp = 0; temp < list.getLength(); temp++) {
|
||||
|
||||
Node node = list.item(temp);
|
||||
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
|
||||
Element element = (Element) node;
|
||||
|
||||
String notify_simpleAudioNotificationsEnabled = element.getElementsByTagName("notify_SimpleAudioNotificationsEnabled").item(0)
|
||||
.getTextContent();
|
||||
|
||||
if (notify_simpleAudioNotificationsEnabled.equals("true")) {
|
||||
notify_playSimpleSounds = true;
|
||||
} else {
|
||||
notify_playSimpleSounds = false;
|
||||
}
|
||||
|
||||
String notify_cwAudioNotificationsEnabled = element.getElementsByTagName("notify_CWCallsignAudioNotificationsEnabled").item(0)
|
||||
.getTextContent();
|
||||
|
||||
if (notify_cwAudioNotificationsEnabled.equals("true")) {
|
||||
notify_playCWCallsignsOnRxedPMs = true;
|
||||
} else {
|
||||
notify_playCWCallsignsOnRxedPMs = false;
|
||||
}
|
||||
|
||||
String notify_voiceAudioNotificationsEnabled = element.getElementsByTagName("notify_VoiceCallsignAudioNotificationsEnabled").item(0)
|
||||
.getTextContent();
|
||||
|
||||
if (notify_voiceAudioNotificationsEnabled.equals("true")) {
|
||||
notify_playVoiceCallsignsOnRxedPMs = true;
|
||||
} else {
|
||||
notify_playVoiceCallsignsOnRxedPMs = false;
|
||||
}
|
||||
|
||||
System.out.println(
|
||||
"[ChatPreferences, info]: Set the audionotifications simple: " + notify_playSimpleSounds + ", CW: " + notify_playCWCallsignsOnRxedPMs + ", Voice: " + notify_playVoiceCallsignsOnRxedPMs);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Case AirScout querier
|
||||
*/
|
||||
|
||||
67
src/main/java/kst4contest/model/UpdateInformation.java
Normal file
67
src/main/java/kst4contest/model/UpdateInformation.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package kst4contest.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class UpdateInformation {
|
||||
double latestVersionNumberOnServer;
|
||||
String adminMessage, majorChanges,latestVersionPathOnWebserver;
|
||||
ArrayList<String> needUpdateResourcesSinceLastVersion;
|
||||
ArrayList<String[]> featureRequest;
|
||||
ArrayList<String[]> bugRequests;
|
||||
|
||||
public double getLatestVersionNumberOnServer() {
|
||||
return latestVersionNumberOnServer;
|
||||
}
|
||||
|
||||
public void setLatestVersionNumberOnServer(double latestVersionNumberOnServer) {
|
||||
this.latestVersionNumberOnServer = latestVersionNumberOnServer;
|
||||
}
|
||||
|
||||
public String getAdminMessage() {
|
||||
return adminMessage;
|
||||
}
|
||||
|
||||
public void setAdminMessage(String adminMessage) {
|
||||
this.adminMessage = adminMessage;
|
||||
}
|
||||
|
||||
public String getMajorChanges() {
|
||||
return majorChanges;
|
||||
}
|
||||
|
||||
public void setMajorChanges(String majorChanges) {
|
||||
this.majorChanges = majorChanges;
|
||||
}
|
||||
|
||||
public String getLatestVersionPathOnWebserver() {
|
||||
return latestVersionPathOnWebserver;
|
||||
}
|
||||
|
||||
public void setLatestVersionPathOnWebserver(String latestVersionPathOnWebserver) {
|
||||
this.latestVersionPathOnWebserver = latestVersionPathOnWebserver;
|
||||
}
|
||||
|
||||
public ArrayList<String> getNeedUpdateResourcesSinceLastVersion() {
|
||||
return needUpdateResourcesSinceLastVersion;
|
||||
}
|
||||
|
||||
public void setNeedUpdateResourcesSinceLastVersion(ArrayList<String> needUpdateResourcesSinceLastVersion) {
|
||||
this.needUpdateResourcesSinceLastVersion = needUpdateResourcesSinceLastVersion;
|
||||
}
|
||||
|
||||
public ArrayList<String[]> getFeatureRequest() {
|
||||
return featureRequest;
|
||||
}
|
||||
|
||||
public void setFeatureRequest(ArrayList<String[]> featureRequest) {
|
||||
this.featureRequest = featureRequest;
|
||||
}
|
||||
|
||||
public ArrayList<String[]> getBugRequests() {
|
||||
return bugRequests;
|
||||
}
|
||||
|
||||
public void setBugRequests(ArrayList<String[]> bugRequests) {
|
||||
this.bugRequests = bugRequests;
|
||||
}
|
||||
}
|
||||
478
src/main/java/kst4contest/utils/PlayAudioUtils.java
Normal file
478
src/main/java/kst4contest/utils/PlayAudioUtils.java
Normal file
@@ -0,0 +1,478 @@
|
||||
package kst4contest.utils;
|
||||
|
||||
import javafx.scene.media.Media;
|
||||
import javafx.scene.media.MediaPlayer;
|
||||
import kst4contest.ApplicationConstants;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
|
||||
/**
|
||||
* This part of the client drives the sounds. Its a singleton instance. All audio outs are directed to this instance.<br>
|
||||
* <br>
|
||||
* */
|
||||
public class PlayAudioUtils {
|
||||
|
||||
/**
|
||||
* Default constructor initializes the sound files and copies it to the project home folder
|
||||
*/
|
||||
public PlayAudioUtils() {
|
||||
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISESTARTUP.mp3", "NOISESTARTUP.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISECQWINDOW.mp3", "NOISECQWINDOW.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISEPMWINDOW.mp3", "NOISEPMWINDOW.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISEERROR.mp3", "NOISEERROR.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISENOTIFY.mp3", "NOISENOTIFY.mp3");
|
||||
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRA.mp3", "LTTRA.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRB.mp3", "LTTRB.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRC.mp3", "LTTRC.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRD.mp3", "LTTRD.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRE.mp3", "LTTRE.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRF.mp3", "LTTRF.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRG.mp3", "LTTRG.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRH.mp3", "LTTRH.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRI.mp3", "LTTRI.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRJ.mp3", "LTTRJ.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRK.mp3", "LTTRK.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRL.mp3", "LTTRL.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRM.mp3", "LTTRM.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRN.mp3", "LTTRN.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRO.mp3", "LTTRO.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRP.mp3", "LTTRP.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRQ.mp3", "LTTRQ.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRR.mp3", "LTTRR.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRS.mp3", "LTTRS.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRT.mp3", "LTTRT.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRU.mp3", "LTTRU.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRV.mp3", "LTTRV.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRW.mp3", "LTTRW.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRX.mp3", "LTTRX.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRY.mp3", "LTTRY.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRZ.mp3", "LTTRZ.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR0.mp3", "LTTR0.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR1.mp3", "LTTR1.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR2.mp3", "LTTR2.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR3.mp3", "LTTR3.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR4.mp3", "LTTR4.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR5.mp3", "LTTR5.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR6.mp3", "LTTR6.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR7.mp3", "LTTR7.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR8.mp3", "LTTR8.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTR9.mp3", "LTTR9.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRSTROKE.mp3", "LTTRSTROKE.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRSPACE.mp3", "LTTRSPACE.mp3");
|
||||
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEA.mp3", "VOICEA.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEB.mp3", "VOICEB.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEC.mp3", "VOICEC.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICED.mp3", "VOICED.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEE.mp3", "VOICEE.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEF.mp3", "VOICEF.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEG.mp3", "VOICEG.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEH.mp3", "VOICEH.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEI.mp3", "VOICEI.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEJ.mp3", "VOICEJ.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEK.mp3", "VOICEK.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEL.mp3", "VOICEL.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEM.mp3", "VOICEM.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEN.mp3", "VOICEN.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEO.mp3", "VOICEO.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEP.mp3", "VOICEP.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEQ.mp3", "VOICEQ.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICER.mp3", "VOICER.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICES.mp3", "VOICES.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICET.mp3", "VOICET.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEU.mp3", "VOICEU.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEV.mp3", "VOICEV.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEW.mp3", "VOICEW.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEX.mp3", "VOICEX.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEY.mp3", "VOICEY.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEZ.mp3", "VOICEZ.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE0.mp3", "VOICE0.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE1.mp3", "VOICE1.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE2.mp3", "VOICE2.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE3.mp3", "VOICE3.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE4.mp3", "VOICE4.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE5.mp3", "VOICE5.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE6.mp3", "VOICE6.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE7.mp3", "VOICE7.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE8.mp3", "VOICE8.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE9.mp3", "VOICE9.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICESTROKE.mp3", "VOICESTROKE.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEBELL.mp3", "VOICEBELL.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEYOUGOTMAIL.mp3", "VOICEYOUGOTMAIL.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICEHELLO.mp3", "VOICEHELLO.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICE73.mp3", "VOICE73.mp3");
|
||||
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/VOICESTROKEPORTABLE.mp3", "VOICESTROKEPORTABLE.mp3");
|
||||
|
||||
|
||||
}
|
||||
|
||||
private Queue<Media> musicList = new LinkedList<Media>();
|
||||
private MediaPlayer mediaPlayer ;
|
||||
|
||||
/**
|
||||
* Plays notification sounds out of the windws 95 box by given action character<br/>
|
||||
*<br/>
|
||||
*
|
||||
* case '!': Startup<br/>
|
||||
* case 'C': CQ Window new entry<br/>
|
||||
* case 'P': PM Window new entry<br/>
|
||||
* case 'E': Error occured<br/>
|
||||
* case 'N': other notification sounds<br/>
|
||||
*
|
||||
* @param actionChar
|
||||
*/
|
||||
public void playNoiseLauncher(char actionChar) {
|
||||
|
||||
|
||||
|
||||
// ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/NOISESTARTUP.mp3");
|
||||
|
||||
|
||||
switch (actionChar){
|
||||
case '!':
|
||||
musicList.add(new Media(new File (ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/NOISESTARTUP.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'C':
|
||||
musicList.add(new Media(new File (ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/NOISECQWINDOW.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'P':
|
||||
musicList.add(new Media(new File (ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/NOISEPMWINDOW.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'E':
|
||||
musicList.add(new Media(new File (ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/NOISEERROR.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'N':
|
||||
musicList.add(new Media(new File (ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/NOISENOTIFY.mp3")).toURI().toString()));
|
||||
break;
|
||||
// case 'M':
|
||||
// musicList.add(new Media(new File ("VOICE.mp3").toURI().toString()));
|
||||
// break;
|
||||
|
||||
default:
|
||||
System.out.println("[KST4ContestApp, warning, letter not defined!]");
|
||||
|
||||
}
|
||||
playMusic();
|
||||
// mediaPlayer.dispose();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Plays all chars of a given String-parameter as CW Sound out of the speaker.
|
||||
* As a workaround for delay problems at the beginning of playing, there are added 2x pause chars to the string.
|
||||
*
|
||||
* @param playThisChars
|
||||
*/
|
||||
public void playCWLauncher(String playThisChars) {
|
||||
|
||||
char[] playThisInCW = playThisChars.toUpperCase().toCharArray();
|
||||
|
||||
|
||||
for (char letterToPlay: playThisInCW){
|
||||
switch (letterToPlay){
|
||||
case 'A':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRA.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'B':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRB.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'C':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRC.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'D':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRD.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'E':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRE.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'F':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRF.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'G':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRG.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'H':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRH.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'I':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRI.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'J':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRJ.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'K':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRK.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'L':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRL.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'M':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRM.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'N':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRN.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'O':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRO.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'P':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRP.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'Q':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRQ.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'R':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRR.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'S':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRS.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'T':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRT.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'U':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRU.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'V':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRV.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'W':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRW.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'X':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRX.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'Y':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRY.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'Z':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRZ.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '1':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR1.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '2':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR2.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '3':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR3.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '4':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR4.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '5':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR5.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '6':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR6.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '7':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR7.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '8':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR8.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '9':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR9.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '0':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTR0.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '/':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRSTROKE.mp3")).toURI().toString()));
|
||||
break;
|
||||
case ' ':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/LTTRSPACE.mp3")).toURI().toString()));
|
||||
break;
|
||||
default:
|
||||
System.out.println("[KST4ContestApp, warning, letter not defined:] cwLetters = " + Arrays.toString(playThisInCW));
|
||||
}
|
||||
}
|
||||
playMusic();
|
||||
// mediaPlayer.dispose();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Plays a voice file for each char in the string (only EN alphabetic and numbers) except some specials: <br/><br/>
|
||||
* <b>Note that the audio settings (ChatPreferences) must be switched on in order to make the sounds playing.</b><br/><br/>
|
||||
* case '!': BELL<br/>
|
||||
* case '?': YOUGOTMAIL<br/>
|
||||
* case '#': HELLO<br/>
|
||||
* case '*': 73 bye<br/>
|
||||
* case '$': STROKEPORTABLE<br/>
|
||||
* @param playThisChars
|
||||
*/
|
||||
public void playVoiceLauncher(String playThisChars) {
|
||||
|
||||
char[] spellThisWithVoice = playThisChars.toUpperCase().toCharArray();
|
||||
|
||||
for (char letterToPlay: spellThisWithVoice){
|
||||
switch (letterToPlay){
|
||||
case '!':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEBELL.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '?':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEYOUGOTMAIL.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '#':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEHELLO.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '*':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE73.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '$':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICESTROKEPORTABLE.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'A':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEA.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'B':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEB.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'C':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEC.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'D':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICED.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'E':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEE.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'F':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEF.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'G':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEG.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'H':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEH.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'I':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEI.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'J':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEJ.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'K':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEK.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'L':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEL.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'M':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEM.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'N':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEN.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'O':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEO.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'P':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEP.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'Q':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEQ.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'R':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICER.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'S':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICES.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'T':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICET.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'U':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEU.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'V':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEV.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'W':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEW.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'X':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEX.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'Y':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEY.mp3")).toURI().toString()));
|
||||
break;
|
||||
case 'Z':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICEZ.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '1':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE1.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '2':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE2.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '3':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE3.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '4':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE4.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '5':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE5.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '6':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE6.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '7':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE7.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '8':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE8.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '9':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE9.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '0':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICE0.mp3")).toURI().toString()));
|
||||
break;
|
||||
case '/':
|
||||
musicList.add(new Media(new File(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/VOICESTROKE.mp3")).toURI().toString()));
|
||||
break;
|
||||
// case ' ':
|
||||
// musicList.add(new Media(new File ("VOICESPACE.mp3").toURI().toString()));
|
||||
// break;
|
||||
default:
|
||||
System.out.println("[KST4ContestApp, warning, letter not defined:] cwLetters = " + Arrays.toString(spellThisWithVoice));
|
||||
}
|
||||
}
|
||||
playMusic();
|
||||
// mediaPlayer.dispose();
|
||||
|
||||
}
|
||||
private void playMusic() {
|
||||
|
||||
// System.out.println("Kst4ContestApplication.playMusic");
|
||||
if(musicList.peek() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mediaPlayer = new MediaPlayer(musicList.poll());
|
||||
mediaPlayer.setRate(1.0);
|
||||
|
||||
mediaPlayer.setOnReady(() -> {
|
||||
mediaPlayer.play();
|
||||
mediaPlayer.setOnEndOfMedia(() -> {
|
||||
// mediaPlayer.dispose();
|
||||
playMusic();
|
||||
if (musicList.isEmpty()) {
|
||||
// mediaPlayer.dispose();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
19
src/main/java/kst4contest/utils/TestAudioPlayerUtils.java
Normal file
19
src/main/java/kst4contest/utils/TestAudioPlayerUtils.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package kst4contest.utils;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
import kst4contest.utils.PlayAudioUtils;
|
||||
|
||||
public class TestAudioPlayerUtils extends Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) throws Exception {
|
||||
|
||||
PlayAudioUtils testAudio = new PlayAudioUtils();
|
||||
testAudio.playCWLauncher("DO5AMF");
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
10
src/main/java/module-info.java
Normal file
10
src/main/java/module-info.java
Normal file
@@ -0,0 +1,10 @@
|
||||
module praktiKST {
|
||||
requires javafx.controls;
|
||||
requires jdk.xml.dom;
|
||||
requires java.sql;
|
||||
requires javafx.media;
|
||||
exports kst4contest.controller;
|
||||
exports kst4contest.locatorUtils;
|
||||
exports kst4contest.model;
|
||||
exports kst4contest.view;
|
||||
}
|
||||
BIN
src/main/resources/LTTR0.mp3
Normal file
BIN
src/main/resources/LTTR0.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR1.mp3
Normal file
BIN
src/main/resources/LTTR1.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR2.mp3
Normal file
BIN
src/main/resources/LTTR2.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR3.mp3
Normal file
BIN
src/main/resources/LTTR3.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR4.mp3
Normal file
BIN
src/main/resources/LTTR4.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR5.mp3
Normal file
BIN
src/main/resources/LTTR5.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR6.mp3
Normal file
BIN
src/main/resources/LTTR6.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR7.mp3
Normal file
BIN
src/main/resources/LTTR7.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR8.mp3
Normal file
BIN
src/main/resources/LTTR8.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTR9.mp3
Normal file
BIN
src/main/resources/LTTR9.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRA.mp3
Normal file
BIN
src/main/resources/LTTRA.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRB.mp3
Normal file
BIN
src/main/resources/LTTRB.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRC.mp3
Normal file
BIN
src/main/resources/LTTRC.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRD.mp3
Normal file
BIN
src/main/resources/LTTRD.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRE.mp3
Normal file
BIN
src/main/resources/LTTRE.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRF.mp3
Normal file
BIN
src/main/resources/LTTRF.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRG.mp3
Normal file
BIN
src/main/resources/LTTRG.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRH.mp3
Normal file
BIN
src/main/resources/LTTRH.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRI.mp3
Normal file
BIN
src/main/resources/LTTRI.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRJ.mp3
Normal file
BIN
src/main/resources/LTTRJ.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRK.mp3
Normal file
BIN
src/main/resources/LTTRK.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRL.mp3
Normal file
BIN
src/main/resources/LTTRL.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRM.mp3
Normal file
BIN
src/main/resources/LTTRM.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRMINUS.mp3
Normal file
BIN
src/main/resources/LTTRMINUS.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRN.mp3
Normal file
BIN
src/main/resources/LTTRN.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRO.mp3
Normal file
BIN
src/main/resources/LTTRO.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRP.mp3
Normal file
BIN
src/main/resources/LTTRP.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRPOINT.mp3
Normal file
BIN
src/main/resources/LTTRPOINT.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRQ.mp3
Normal file
BIN
src/main/resources/LTTRQ.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRQUESTMARK.mp3
Normal file
BIN
src/main/resources/LTTRQUESTMARK.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRR.mp3
Normal file
BIN
src/main/resources/LTTRR.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRS.mp3
Normal file
BIN
src/main/resources/LTTRS.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRSPACE.mp3
Normal file
BIN
src/main/resources/LTTRSPACE.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRSTROKE.mp3
Normal file
BIN
src/main/resources/LTTRSTROKE.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRT.mp3
Normal file
BIN
src/main/resources/LTTRT.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRU.mp3
Normal file
BIN
src/main/resources/LTTRU.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRV.mp3
Normal file
BIN
src/main/resources/LTTRV.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRW.mp3
Normal file
BIN
src/main/resources/LTTRW.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRX.mp3
Normal file
BIN
src/main/resources/LTTRX.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRY.mp3
Normal file
BIN
src/main/resources/LTTRY.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/LTTRZ.mp3
Normal file
BIN
src/main/resources/LTTRZ.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/NOISECQWINDOW.mp3
Normal file
BIN
src/main/resources/NOISECQWINDOW.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/NOISEERROR.mp3
Normal file
BIN
src/main/resources/NOISEERROR.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/NOISENOTIFY.mp3
Normal file
BIN
src/main/resources/NOISENOTIFY.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/NOISEPMWINDOW.mp3
Normal file
BIN
src/main/resources/NOISEPMWINDOW.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/NOISESTARTUP.mp3
Normal file
BIN
src/main/resources/NOISESTARTUP.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE0.mp3
Normal file
BIN
src/main/resources/VOICE0.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE1.mp3
Normal file
BIN
src/main/resources/VOICE1.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE2.mp3
Normal file
BIN
src/main/resources/VOICE2.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE3.mp3
Normal file
BIN
src/main/resources/VOICE3.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE4.mp3
Normal file
BIN
src/main/resources/VOICE4.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE5.mp3
Normal file
BIN
src/main/resources/VOICE5.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE6.mp3
Normal file
BIN
src/main/resources/VOICE6.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE7.mp3
Normal file
BIN
src/main/resources/VOICE7.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE73.mp3
Normal file
BIN
src/main/resources/VOICE73.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE8.mp3
Normal file
BIN
src/main/resources/VOICE8.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICE9.mp3
Normal file
BIN
src/main/resources/VOICE9.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEA.mp3
Normal file
BIN
src/main/resources/VOICEA.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEB.mp3
Normal file
BIN
src/main/resources/VOICEB.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEBELL.mp3
Normal file
BIN
src/main/resources/VOICEBELL.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEC.mp3
Normal file
BIN
src/main/resources/VOICEC.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICED.mp3
Normal file
BIN
src/main/resources/VOICED.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEE.mp3
Normal file
BIN
src/main/resources/VOICEE.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEF.mp3
Normal file
BIN
src/main/resources/VOICEF.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEG.mp3
Normal file
BIN
src/main/resources/VOICEG.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEH.mp3
Normal file
BIN
src/main/resources/VOICEH.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEHELLO.mp3
Normal file
BIN
src/main/resources/VOICEHELLO.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEI.mp3
Normal file
BIN
src/main/resources/VOICEI.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEJ.mp3
Normal file
BIN
src/main/resources/VOICEJ.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEK.mp3
Normal file
BIN
src/main/resources/VOICEK.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEL.mp3
Normal file
BIN
src/main/resources/VOICEL.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEM.mp3
Normal file
BIN
src/main/resources/VOICEM.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEMEEPMEEP.mp3
Normal file
BIN
src/main/resources/VOICEMEEPMEEP.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEN.mp3
Normal file
BIN
src/main/resources/VOICEN.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEO.mp3
Normal file
BIN
src/main/resources/VOICEO.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEP.mp3
Normal file
BIN
src/main/resources/VOICEP.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICEQ.mp3
Normal file
BIN
src/main/resources/VOICEQ.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICER.mp3
Normal file
BIN
src/main/resources/VOICER.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICES.mp3
Normal file
BIN
src/main/resources/VOICES.mp3
Normal file
Binary file not shown.
BIN
src/main/resources/VOICESTROKE.mp3
Normal file
BIN
src/main/resources/VOICESTROKE.mp3
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user