• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

FinalCrypt - The No¹ One-Time Pad Encryption


Commit MetaInfo

Revisión97d301ce20d4ed7ea6f669e25e5542b599545a38 (tree)
Tiempo2021-01-03 02:00:41
Autorron <ronuitzaandam@gmai...>
Commiterron

Log Message

Date: 2021-01-02 Version: 6.6.0

A typewriter was added to help command-line tutors
The typewriter prints to screen like a human types

We learn better when we see a moving mouse pointer
We also learn better by seeing typed command-lines

This typewriter can be used for any scripting demo

Please don't look away FinalCrypt needs your help
Please help by sharing FinalCrypt on Social Media

Cambiar Resumen

Diferencia incremental

--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,16 @@
1+Date: 2021-01-02 Version: 6.6.0
2+
3+A typewriter was added to help command-line tutors
4+The typewriter prints to screen like a human types
5+
6+We learn better when we see a moving mouse pointer
7+We also learn better by seeing typed command-lines
8+
9+This typewriter can be used for any scripting demo
10+
11+Please don't look away FinalCrypt needs your help
12+Please help by sharing FinalCrypt on Social Media
13+
114 Date: 2020-11-14 Version: 6.5.0
215
316 Upgraded the Java Runtime Engine to version 1.8.0-271
@@ -10,9 +23,6 @@ Added nice splash image to FinalCrypt GUI startup
1023 Improved Support Email Messages with Email Button
1124 Updated a number of deprecated social media links
1225
13-Please don't look away FinalCrypt needs your help
14-Please help by sharing FinalCrypt on Social Media
15-
1626 Date: 2020-11-02 Version: 6.4.2
1727
1828 Improved support added to Graphical User Interface
--- a/manpage.txt
+++ b/manpage.txt
@@ -2,7 +2,7 @@ Usage: java -cp finalcrypt.jar rdj/CLUI <Mode> [options] <Parameters>
22
33 Examples:
44
5- java -cp finalcrypt.jar rdj/CLUI --examples Print commandline examples.
5+ java -cp finalcrypt.jar rdj/CLUI --examples Print commandline examples.
66
77 java -cp finalcrypt.jar rdj/CLUI --encrypt --test -k "key_dir" -t "target_dir" -t "target_file" # Test Encrypt (Auto Key Mode)
88 java -cp finalcrypt.jar rdj/CLUI --decrypt --test -k "key_dir" -t "target_dir" -t "target_file" # Test Decrypt (Auto Key Mode)
@@ -15,51 +15,53 @@ Examples:
1515
1616 Mode:
1717
18- <--scan> -k "key_dir" -t "target" Print scan results and quit.
19- <--encrypt> -k "key_dir" -t "target" Encrypt Targets.
20- <--decrypt> -k "key_dir" -t "target" Decrypt Targets.
21- <--create-keydev> -k "key_file" -t "target" Create Key Device (only unix).
22- <--create-keyfile> -K "key_file" -S "Size (bytes)" Create OTP Key File.
23- <--clone-keydev> -k "source_device" -t "target_device" Clone Key Device (only unix).
24- [--print-gpt] -t "target_device" Print GUID Partition Table.
25- [--delete-gpt] -t "target_device" Delete GUID Partition Table (DATA LOSS!).
18+ <--scan> -k "key_dir" -t "target" Print scan results and quit.
19+ <--encrypt> -k "key_dir" -t "target" Encrypt Targets.
20+ <--decrypt> -k "key_dir" -t "target" Decrypt Targets.
21+ <--create-keydev> -k "key_file" -t "target" Create Key Device (only unix).
22+ <--create-keyfile> -K "key_file" -S "Size (bytes)" Create OTP Key File.
23+ <--clone-keydev> -k "source_device" -t "target_device" Clone Key Device (only unix).
24+ <--typewriter> Print to screen like a typewriter.
25+ [--print-gpt] -t "target_device" Print GUID Partition Table.
26+ [--print-gpt] -t "target_device" Print GUID Partition Table.
27+ [--delete-gpt] -t "target_device" Delete GUID Partition Table (DATA LOSS!).
2628
2729 Options:
2830
29- [-h] [--help] Print help page.
30- [--password] -p 'password' Optional password parameter http://www.finalcrypt.org/faq.php#t22
31- [--password-prompt] -pp Optional password prompt http://www.finalcrypt.org/faq.php#t22
32- [--key-chksum] -k "key_file" Calculate key checksum.
33- [--no-key-size] Allow key-size less than the default minimum of 140 bytes.
34- [-d] [--debug] Enables debugging mode.
35- [-v] [--verbose] Enables verbose mode.
36- [--print] Print all bytes binary, hexdec & char (slows encryption severely).
37- [-l] [--symlink] Include symlinks (can cause double encryption! Not recommended!).
38- [--disable-MAC] Disable MAC - (not compatible with MAC encrypted files!)
39- [--version] Print FinalCrypt version.
40- [--license] Print FinalCrypt license.
41- [--check-update] Check for online updates.
42- [-s size] Changes default I/O buffer size (size = KiB) (default 1024 KiB).
43- [-S size] OTP Key File Size (size = bytes). See --create-keyfile
31+ [-h] [--help] Print help page.
32+ [--password] -p 'password' Optional password parameter http://www.finalcrypt.org/faq.php#t22
33+ [--password-prompt] -pp Optional password prompt http://www.finalcrypt.org/faq.php#t22
34+ [--key-chksum] -k "key_file" Calculate key checksum.
35+ [--no-key-size] Allow key-size less than the default minimum of 140 bytes.
36+ [-d] [--debug] Enables debugging mode.
37+ [-v] [--verbose] Enables verbose mode.
38+ [--print] Print all bytes binary, hexdec & char (slows encryption severely).
39+ [-l] [--symlink] Include symlinks (can cause double encryption! Not recommended!).
40+ [--disable-MAC] Disable MAC - (not compatible with MAC encrypted files!)
41+ [--version] Print FinalCrypt version.
42+ [--license] Print FinalCrypt license.
43+ [--check-update] Check for online updates.
44+ [-s size] Changes default I/O buffer size (size = KiB) (default 1024 KiB).
45+ [-S size] OTP Key File Size (size = bytes). See --create-keyfile
4446
4547 Test Options:
4648
47- [--test] Test run without executing (also prints statistics at the end).
48- [--test "answer"] Same but then with non interactive answer (c,1-13) included.
49- [-pd] [--password-dictionary] "dict_file" Brute force test plain text passwords from dictionary file.
49+ [--test] Test run without executing (also prints statistics at the end).
50+ [--test "answer"] Same but then with non interactive answer (c,1-13) included.
51+ [-pd] [--password-dictionary] "dict_file" Brute force test plain text passwords from dictionary file.
5052
5153 Filtering Options:
5254
53- [-w 'wildcard'] File wildcard INCLUDE filter. Uses: "Globbing Patterns Syntax".
54- [-W 'wildcard'] File wildcard EXCLUDE filter. Uses: "Globbing Patterns Syntax".
55- [-r 'regex'] File regular expression filter. Advanced filename filter!
55+ [-w 'wildcard'] File wildcard INCLUDE filter. Uses: "Globbing Patterns Syntax".
56+ [-W 'wildcard'] File wildcard EXCLUDE filter. Uses: "Globbing Patterns Syntax".
57+ [-r 'regex'] File regular expression filter. Advanced filename filter!
5658
5759 Parameters:
5860
59- <-k "keydir"> The directory that holds your keys. Keep SECRET!
61+ <-k "keydir"> The directory that holds your keys. Keep SECRET!
6062
61- <-t / -b> Target items to encrypt. Individual (-t) by batch (-b).
62- <[-t "file/dir"]> Target items (files or directories) you want to encrypt (recursive).
63- <[-b "batchfile"]> Batchfile with targetfiles you want to encrypt (only files).
63+ <-t / -b> Target items to encrypt. Individual (-t) by batch (-b).
64+ <[-t "file/dir"]> Target items (files or directories) you want to encrypt (recursive).
65+ <[-b "batchfile"]> Batchfile with targetfiles you want to encrypt (only files).
6466
65-FinalCrypt 6.5.0 - Author: Ron de Jong <info@finalcrypt.org> - CC BY-NC-ND 4.0: License 2017-2020
\ No newline at end of file
67+FinalCrypt 6.6.0 - Author: Ron de Jong <info@finalcrypt.org> - CC BY-NC-ND 4.0: License 2017-2021
\ No newline at end of file
--- a/manpage_examples.txt
+++ b/manpage_examples.txt
@@ -76,4 +76,18 @@ Key Device Examples (Linux):
7676 java -cp finalcrypt.jar rdj/CLUI --encrypt -k /dev/sdc1 -t myfile
7777 java -cp finalcrypt.jar rdj/CLUI --decrypt -k /dev/sdc1 -t myfile
7878
79-FinalCrypt 6.5.0 - Author: Ron de Jong <info@finalcrypt.org> - Copyright: © 2017-2020
\ No newline at end of file
79+Typewriter Examples (Print to screen like a typewriter):
80+
81+ Usage: java -cp finalcrypt.jar rdj/TypeWriter -t "text to write" [-s sound-nr|"file"] [-min delay_ms] [-max delay_ms]
82+
83+ java -cp finalcrypt.jar rdj/Audio --list # List available sounds
84+
85+ java -cp finalcrypt.jar rdj/TypeWriter -t "type at steady pace" -min 100
86+ java -cp finalcrypt.jar rdj/TypeWriter -t "type at random pace" -min 20 -max 100
87+ java -cp finalcrypt.jar rdj/TypeWriter -t "" -min 1000
88+ java -cp finalcrypt.jar rdj/TypeWriter -t "\n" -min 1000
89+
90+ java -cp finalcrypt.jar rdj/TypeWriter -t "built-in sound" -s 8 -min 20 -max 100
91+ java -cp finalcrypt.jar rdj/TypeWriter -t "ext sound file" -s file.wav -min 20 -max 100
92+
93+FinalCrypt 6.6.0 - Author: Ron de Jong <info@finalcrypt.org> - CC BY-NC-ND 4.0: License 2017-2021
\ No newline at end of file
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -8,7 +8,7 @@ application.homepage=http://www.finalcrypt.org/
88 application.splash=
99 application.title=FinalCrypt
1010 application.vendor=FinalCrypt
11-application.implementation.version=6.5.0
11+application.implementation.version=6.6.0
1212 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=false
1313 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=4
1414 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=4
--- a/src/rdj/Audio.java
+++ b/src/rdj/Audio.java
@@ -51,10 +51,11 @@ public class Audio
5151 public static final String SND_SELECT = "/rdj/audio/sounds/select";
5252 public static final String SND_SELECTINVALID = "/rdj/audio/sounds/select_invalid";
5353 public static final String SND_SELECTKEY = "/rdj/audio/sounds/select_key";
54+ public static final String SND_SHUTDOWN = "/rdj/audio/sounds/shutdown";
5455 public static final String SND_SOUND_DISABLED = "/rdj/audio/sounds/sound_disabled";
5556 public static final String SND_SOUND_ENABLED = "/rdj/audio/sounds/sound_enabled";
56- public static final String SND_SHUTDOWN = "/rdj/audio/sounds/shutdown";
57- public static final String SND_STARTUP = "/rdj/audio/sounds/startup";
57+// public static final String SND_STARTUP = "/rdj/audio/sounds/startup";
58+ public static final String SND_TYPEWRITE = "/rdj/audio/sounds/typewriter";
5859
5960 public static final String VOI_CLONE_KEY_DEVICE = "/rdj/audio/voice/clone_key_device";
6061 public static final String VOI_CONFIRM_PASS_WITH_ENTER = "/rdj/audio/voice/confirm_password_with_enter";
@@ -77,4 +78,42 @@ public class Audio
7778
7879 public static boolean sound_Is_Enabled = true;
7980 public static boolean voice_Is_Enabled = true;
81+
82+ public static final String[] soundArray = {SND_ALARM,SND_ALERT,SND_BUTTON,SND_DECRYPTFILES,SND_ENCRYPTFILES,SND_ERROR,SND_INPUT_FAIL,SND_INPUT_OK,SND_KEYPRESS,SND_MESSAGE,SND_OFF,SND_ON,SND_OPEN,SND_READY,SND_SELECT,SND_SELECTINVALID,SND_SELECTKEY,SND_SOUND_DISABLED,SND_SOUND_ENABLED,SND_SHUTDOWN,SND_TYPEWRITE};
83+
84+ public static String getSound(int sound) { if ((sound >= 0) && (sound < soundArray.length)) { return soundArray[sound]; } else { return SND_TYPEWRITE; } }
85+ public static String getSounds()
86+ {
87+ String returnString = "\r\n";
88+ for (int x=0; x<soundArray.length;x++)
89+ {
90+ returnString += x + ". " + soundArray[x] + "\r\n";
91+ }
92+ return returnString;
93+ }
94+
95+ public static void main(String[] args)
96+ {
97+ if (args.length == 0) { usage("Error: no parameter", true); }
98+ else if (args.length == 1)
99+ {
100+ if ( args[0].equalsIgnoreCase("--list") ) { System.out.println(getSounds()); }
101+ else { usage("Error: invalid parameter: \"" + args[0] + "\"", true); }
102+ }
103+ else { new TypeWriter().usage("Too many parameters", true); }
104+ }
105+
106+ protected static void usage(String errorMessage, boolean error)
107+ {
108+ if ( errorMessage.length() > 0 )
109+ {
110+ System.out.println("\r\n");
111+ System.out.println(errorMessage + "\r\n");
112+ }
113+
114+ System.out.println("\r\n");
115+ System.out.println("Usage: java -cp finalcrypt.jar rdj/Audio --list # List available sounds\r\n");
116+ System.out.println("\r\n");
117+ System.exit(error ? 1 : 0);
118+ }
80119 }
--- /dev/null
+++ b/src/rdj/AudioPlayer.java
@@ -0,0 +1,179 @@
1+/*
2+ * CC BY-NC-ND 4.0 2017 Ron de Jong (ron@finalcrypt.org)
3+ *
4+ * This is free software; you can redistribute it
5+ * under the terms of the Creative Commons License
6+ * Creative Commons License: (CC BY-NC-ND 4.0) as published by
7+ * https://creativecommons.org/licenses/by-nc-nd/4.0/ either
8+ * version 4.0 of the License, or (at your option) any later version.
9+ *
10+ * This software is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
14+ * International Public License for more details.
15+ *
16+ * You should have received a copy called: "LICENSE" of the
17+ * Creative Commons Public License along with this software;
18+ */
19+
20+package rdj;
21+
22+import java.io.*;
23+import java.net.*;
24+import javafx.scene.media.*;
25+import javax.sound.sampled.*;
26+
27+public class AudioPlayer extends Audio
28+{
29+ public AudioClip audioClip;
30+ public AudioClip audioClipVoice;
31+
32+ private AudioInputStream audioInputStreamSounds;
33+ private AudioInputStream audioInputStreamVoice;
34+ private Clip clipSounds;
35+ private Clip clipVoice;
36+
37+ private boolean isInt(String text) { try { Integer.parseInt(text); return true;} catch (NumberFormatException e) { return false; } }
38+
39+ synchronized public void play(UI ui, String audio, int audio_codec)
40+ {
41+ Media media;
42+ if (!isInt(audio))
43+ {
44+ switch (audio_codec)
45+ {
46+ case WAV: media = new Media(this.getClass().getResource(audio + ".wav").toExternalForm()); break;
47+ case OGG: media = new Media(this.getClass().getResource(audio + ".ogg").toExternalForm()); break;
48+ case AIFF: media = new Media(this.getClass().getResource(audio + ".aiff").toExternalForm()); break;
49+ case MP3: media = new Media(this.getClass().getResource(audio + ".mp3").toExternalForm()); break;
50+ default: media = new Media(this.getClass().getResource(audio + ".wav").toExternalForm()); break;
51+ }
52+
53+ if (
54+ ((media.getSource().contains("/sounds/")) && ((sound_Is_Enabled)))
55+ || ((media.getSource().contains("/voice/")) && ((voice_Is_Enabled)))
56+ )
57+ {
58+ playAudioClip(ui, media, audio_codec); // Plays fast, but crashes often on Linux (libld.so native player issue)
59+ }
60+ }
61+ }
62+
63+ synchronized public void playAudioClipFile(UI ui, String fileParam) // just for external files
64+ {
65+ Thread playAudioClipFileThread = new Thread(() ->
66+ {
67+ File file = new File(fileParam);
68+ Media media = null;
69+ try { media = new Media(file.toURI().toURL().toString()); } catch (MalformedURLException ex) { ui.log("Error: MalformedURLException: " + ex.getMessage() + "\r\n", true, true, true, true, false); }
70+ audioClip = new AudioClip(media.getSource());
71+ audioClip.play();
72+ });
73+ playAudioClipFileThread.setName("playAudioClipFileThread");
74+ playAudioClipFileThread.setDaemon(true);
75+ playAudioClipFileThread.start();
76+ }
77+
78+ synchronized public void playAudioClip(UI ui, Media media, int audio_codec) // javafx.scene.media.AudioClip
79+ {
80+ if (media != null)
81+ {
82+ if ( (media.getSource().contains("/sounds/")) ) // new sound added to any other audio playing
83+ {
84+ if (sound_Is_Enabled)
85+ {
86+ Thread playAudioClipSounds = new Thread(() ->
87+ {
88+ if (sound_Is_Enabled) { audioClip = new AudioClip(media.getSource()); audioClip.play(); /*(" " + play.isPlaying() + "\r\n");*/ }
89+ });
90+ playAudioClipSounds.setName("playAudioClipSounds");
91+ playAudioClipSounds.setDaemon(true);
92+ playAudioClipSounds.start();
93+ }
94+ }
95+ else if ( media.getSource().contains("/voice/") )
96+ {
97+ if (voice_Is_Enabled)
98+ {
99+ if ((audioClip != null) && ( audioClip.isPlaying() )) { audioClip.stop(); } // new voice stopping currently playing voice
100+
101+ Thread playJavaFXVoiceThread = new Thread(() ->
102+ {
103+ if ( (audioClipVoice != null) && ( audioClipVoice.isPlaying() )) { audioClipVoice.stop(); }
104+ audioClipVoice = new AudioClip(media.getSource()); audioClipVoice.play(); /*test(" " + play.isPlaying() + "\r\n");*/
105+ });
106+ playJavaFXVoiceThread.setName("playJavaFXVoiceThread");
107+ playJavaFXVoiceThread.setDaemon(true);
108+ playJavaFXVoiceThread.start();
109+ }
110+ }
111+ else { ui.log("Alert: " + AudioPlayer.class.getSimpleName() + ".play(" + media.getSource() + ") not recognized!\r\n", true, true, true, true, false); }
112+ }
113+ }
114+
115+ synchronized public void playJavaX(UI ui, Media media, int audio_codec) // javax.sound.sampled.AudioSystem - Stops playing spontaniously on all OSes
116+ {
117+ if (media != null)
118+ {
119+ if (media.getSource().contains("/sounds/")) // Just to keep playing ClipSounds parallel over ClipVoice
120+ {
121+ if (sound_Is_Enabled)
122+ {
123+ try { audioInputStreamSounds = AudioSystem.getAudioInputStream(new URL(media.getSource())); }
124+ catch (UnsupportedAudioFileException ex) { ui.log("Error: UnsupportedAudioFileException " + AudioPlayer.class.getSimpleName() + ".play(..) AudioSystem.getAudioInputStream(" + media.getSource() + " " + ex.getMessage() + " \r\n", true, true, true, true, false); }
125+ catch (IOException ex) { ui.log("Error: IOException " + AudioPlayer.class.getSimpleName() + ".play(..) AudioSystem.getAudioInputStream(" + media.getSource() + " " + ex.getMessage() + " \r\n", true, true, true, true, false); }
126+
127+ clipSounds = null; try { clipSounds = AudioSystem.getClip(); } catch (LineUnavailableException ex)
128+ { ui.log("Error: LineUnavailableException " + AudioPlayer.class.getSimpleName() + ".play(..).AudioSystem.getClip() " + ex.getMessage() + " \r\n", true, true, true, true, false); }
129+
130+ try { clipSounds.open(audioInputStreamSounds); }
131+ catch (LineUnavailableException ex) { clipSounds.close(); clipSounds = null; ui.log("Error: LineUnavailableException " + AudioPlayer.class.getSimpleName() + ".play(..).clipSounds.open(" + media.getSource() + ") " + ex.getMessage() + " \r\n", true, true, true, false, false); }
132+ catch (IOException ex) { clipSounds.close(); clipSounds = null; ui.log("Error: IOException " + AudioPlayer.class.getSimpleName() + ".play(..).clipSounds.open(" + media.getSource() + ") " + ex.getMessage() + " \r\n", true, true, true, false, false); }
133+
134+ if ( clipSounds != null )
135+ {
136+ clipSounds.start();
137+ try { audioInputStreamSounds.close(); } catch (IOException ex) { ui.log("Error: IOException " + AudioPlayer.class.getSimpleName() + ".play(..).audioInputStreamSounds.close() " + ex.getMessage() + " \r\n", true, true, true, false, false); }
138+ }
139+ else
140+ {
141+ try { audioInputStreamSounds.close(); } catch (IOException ex) { ui.log("Error: IOException " + AudioPlayer.class.getSimpleName() + ".play(..).audioInputStreamSounds.close() " + ex.getMessage() + " \r\n", true, true, true, false, false); }
142+ }
143+ // test(" " + clipSounds.isOpen() + "\r\n");
144+ }
145+ }
146+ else if ( media.getSource().contains("/voice/") )
147+ {
148+ if (voice_Is_Enabled)
149+ {
150+ if ((clipVoice != null) && ( clipVoice.isOpen() )) // new voice stopping currently playing voice
151+ {
152+ clipVoice.stop(); try { audioInputStreamVoice.close(); } catch (IOException ex) { ui.log("Error: IOException audioIn.close() " + ex.getMessage() + " \r\n", true, true, true, true, false); }
153+ }
154+ try { audioInputStreamVoice = AudioSystem.getAudioInputStream(new URL(media.getSource())); }
155+ catch (UnsupportedAudioFileException ex) { ui.log("Error: UnsupportedAudioFileException play(..) AudioSystem.getAudioInputStream(" + media.getSource() + " " + ex.getMessage() + " \r\n", true, true, true, true, false); }
156+ catch (IOException ex) { ui.log("Error: IOException " + AudioPlayer.class.getSimpleName() + ".play(..) AudioSystem.getAudioInputStream(" + media.getSource() + " " + ex.getMessage() + " \r\n", true, true, true, true, false); }
157+
158+ clipVoice = null; try { clipVoice = AudioSystem.getClip(); } catch (LineUnavailableException ex) { ui.log("Error: LineUnavailableException " + AudioPlayer.class.getSimpleName() + ".play(..).AudioSystem.getClip() " + ex.getMessage() + " \r\n", true, true, true, true, false); }
159+
160+ try { clipVoice.open(audioInputStreamVoice); }
161+ catch (LineUnavailableException ex) { clipVoice.close(); clipVoice = null; ui.log("Error: LineUnavailableException " + AudioPlayer.class.getSimpleName() + ".play(..).clipVoice.open(" + media.getSource() + ") " + ex.getMessage() + " \r\n", true, true, true, false, false); }
162+ catch (IOException ex) { clipVoice.close(); clipVoice = null; ui.log("Error: IOException " + AudioPlayer.class.getSimpleName() + ".play(..).clipVoice.open(" + media.getSource() + ") " + ex.getMessage() + " \r\n", true, true, true, false, false); }
163+
164+ if ( clipVoice != null )
165+ {
166+ clipVoice.start();
167+ try { audioInputStreamVoice.close(); } catch (IOException ex) { ui.log("Error: IOException " + AudioPlayer.class.getSimpleName() + ".play(..).audioInputStreamVoice.close() " + ex.getMessage() + " \r\n", true, true, true, false, false); }
168+ }
169+ else
170+ {
171+ try { audioInputStreamVoice.close(); } catch (IOException ex) { ui.log("Error: IOException " + AudioPlayer.class.getSimpleName() + ".play(..).audioInputStreamVoice.close() " + ex.getMessage() + " \r\n", true, true, true, false, false); }
172+ }
173+ // test(" " + clipVoice.isOpen() + "\r\n");
174+ }
175+ }
176+ else { ui.log("Alert: " + AudioPlayer.class.getSimpleName() + ".play(" + media.getSource() + ") not recognized!\r\n", true, true, true, true, false); }
177+ }
178+ }
179+}
--- a/src/rdj/CLUI.java
+++ b/src/rdj/CLUI.java
@@ -169,6 +169,7 @@ public class CLUI implements UI
169169 // Options
170170 if (( args[paramCnt].equals("-h")) || ( args[paramCnt].equals("--help") )) { usage(false); }
171171 else if ( args[paramCnt].equals("--examples")) { examples(); }
172+ else if ( args[paramCnt].equals("--typewriter")) { typewriter(args); }
172173 else if ( args[paramCnt].equals("--disable-MAC")) { finalCrypt.disabledMAC = true; FCPath.KEY_SIZE_MIN = 1; encryptModeNeeded = true; }
173174 else if ( args[paramCnt].equals("--scan")) { scan=true; }
174175 else if ( args[paramCnt].equals("--encrypt")) { if ((!encrypt)&&(!decrypt)&&(!createManualKeyDev)&&(!clonekeydev)&&(!printgpt)&&(!deletegpt)) { encrypt = true; kfsetneeded = true; tfsetneeded = true; } }
@@ -819,6 +820,8 @@ public class CLUI implements UI
819820 log(" <--create-keydev> -k \"key_file\" -t \"target\" Create Key Device (only unix).\r\n", false, true, false, false, false);
820821 log(" <--create-keyfile> -K \"key_file\" -S \"Size (bytes)\" Create OTP Key File.\r\n", false, true, false, false, false);
821822 log(" <--clone-keydev> -k \"source_device\" -t \"target_device\" Clone Key Device (only unix).\r\n", false, true, false, false, false);
823+ log(" <--typewriter> Print to screen like a typewriter.\r\n", false, true, false, false, false);
824+ log(" [--print-gpt] -t \"target_device\" Print GUID Partition Table.\r\n", false, true, false, false, false);
822825 log(" [--print-gpt] -t \"target_device\" Print GUID Partition Table.\r\n", false, true, false, false, false);
823826 log(" [--delete-gpt] -t \"target_device\" Delete GUID Partition Table (DATA LOSS!).\r\n", false, true, false, false, false);
824827 log("\r\n", false, true, false, false, false);
@@ -950,10 +953,33 @@ public class CLUI implements UI
950953 log(" java -cp finalcrypt.jar rdj/CLUI --encrypt -k /dev/sdc1 -t myfile\r\n", false, true, false, false, false);
951954 log(" java -cp finalcrypt.jar rdj/CLUI --decrypt -k /dev/sdc1 -t myfile\r\n", false, true, false, false, false);
952955 log("\r\n", false, true, false, false, false);
956+ log("Typewriter Examples (Print to screen like a typewriter):\r\n", false, true, false, false, false);
957+ log("\r\n", false, true, false, false, false);
958+ log(" Usage: java -cp finalcrypt.jar rdj/TypeWriter -t \"text to write\" [-s sound-nr|\"file\"] [-min delay_ms] [-max delay_ms]\r\n", false, true, false, false, false);
959+ log("\r\n", false, true, false, false, false);
960+ log(" java -cp finalcrypt.jar rdj/Audio --list # List available sounds\r\n", false, true, false, false, false);
961+ log("\r\n", false, true, false, false, false);
962+ log(" java -cp finalcrypt.jar rdj/TypeWriter -t \"type at steady pace\" -min 100\r\n", false, true, false, false, false);
963+ log(" java -cp finalcrypt.jar rdj/TypeWriter -t \"type at random pace\" -min 20 -max 100\r\n", false, true, false, false, false);
964+ log(" java -cp finalcrypt.jar rdj/TypeWriter -t \"\" -min 1000\r\n", false, true, false, false, false);
965+ log(" java -cp finalcrypt.jar rdj/TypeWriter -t \"\\n\" -min 1000\r\n", false, true, false, false, false);
966+ log("\r\n", false, true, false, false, false);
967+ log(" java -cp finalcrypt.jar rdj/TypeWriter -t \"built-in sound\" -s 8 -min 20 -max 100\r\n", false, true, false, false, false);
968+ log(" java -cp finalcrypt.jar rdj/TypeWriter -t \"ext sound file\" -s file.wav -min 20 -max 100\r\n", false, true, false, false, false);
969+ log("\r\n", false, true, false, false, false);
953970 log(Version.getProductName() + " " + version.checkLocalVersion(this) + " - Author: " + Version.getAuthor() + " <" + Version.getEmail() + "> - CC BY-NC-ND 4.0: " + Version.getLicenseDescription() + "\r\n\r\n", false, true, false, false, false);
954971 System.exit(0);
955972 }
956973
974+ private static String reformat(String text) { return text.replace("\\t", "\t").replace("\\b", "\b").replace("\\n", "\n").replace("\\r", "\r").replace("\\f", "\f"); }
975+ private void typewriter(String[] args)
976+ {
977+ String[] newargs = new String[args.length-1];
978+ for (int x=1; x<args.length;x++) { newargs[x-1] = args[x]; }
979+ new TypeWriter(newargs);
980+ System.exit(0);
981+ }
982+
957983 @Override public void processGraph(int value) { }
958984
959985 @Override
@@ -1220,4 +1246,4 @@ class ConsoleEraser extends Thread
12201246 private boolean running = true;
12211247 public void run() { while (running) { System.err.print("\b "); try { Thread.currentThread().sleep(1); } catch(InterruptedException err) { break; } } }
12221248 public synchronized void halt() { running = false; }
1223-}
\ No newline at end of file
1249+}
--- a/src/rdj/CreateOTPKey.java
+++ b/src/rdj/CreateOTPKey.java
@@ -170,7 +170,7 @@ public class CreateOTPKey extends Application implements Initializable
170170 if ( filenameTextField.getText().matches(regex) ) { filenameTextField.setText(filenameTextField.getText().replaceAll(regex, "")); }
171171 else
172172 {
173- new Sound().play(guifx, Audio.SND_KEYPRESS,Audio.AUDIO_CODEC);
173+ new AudioPlayer().play(guifx, Audio.SND_KEYPRESS,Audio.AUDIO_CODEC);
174174 filenameTextField.setText(filenameTextField.getText().replaceAll(regex, ""));
175175 }
176176
@@ -250,8 +250,8 @@ public class CreateOTPKey extends Application implements Initializable
250250
251251 @FXML private void increaseButtonOnAction(ActionEvent event) { changeSize(1); }
252252 @FXML private void decreaseButtonOnAction(ActionEvent event) { changeSize(-1); }
253- @FXML private void increaseButtonOnMousePressed(MouseEvent event) { new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC); changeSizeRepeaterOn(1); }
254- @FXML private void decreaseButtonOnMousePressed(MouseEvent event) { new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC); changeSizeRepeaterOn(-1); }
253+ @FXML private void increaseButtonOnMousePressed(MouseEvent event) { new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC); changeSizeRepeaterOn(1); }
254+ @FXML private void decreaseButtonOnMousePressed(MouseEvent event) { new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC); changeSizeRepeaterOn(-1); }
255255 @FXML private void increaseButtonOnMouseReleased(MouseEvent event) { changeSizeRepeaterOff(); }
256256 @FXML private void decreaseButtonOnMouseReleased(MouseEvent event) { changeSizeRepeaterOff(); }
257257
@@ -308,7 +308,7 @@ public class CreateOTPKey extends Application implements Initializable
308308 @FXML
309309 private void createButtonAction(ActionEvent event)
310310 {
311- new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
311+ new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
312312 filenameTextField.setDisable(true);
313313 filesizeLabel.setDisable(true);
314314 filesizeTextField.setDisable(true);
@@ -376,7 +376,7 @@ public class CreateOTPKey extends Application implements Initializable
376376 }; updateProgressTaskTimer = new java.util.Timer(); updateProgressTaskTimer.schedule(updateProgressTask, 0L, 200L);
377377
378378
379- new Sound().play(guifx, Audio.SND_ENCRYPTFILES,Audio.AUDIO_CODEC);
379+ new AudioPlayer().play(guifx, Audio.SND_ENCRYPTFILES,Audio.AUDIO_CODEC);
380380
381381 write1loop: while ( (totalTranfered < filesizeInBytes) && (! inputEnded ))
382382 {
@@ -439,13 +439,13 @@ public class CreateOTPKey extends Application implements Initializable
439439 @FXML
440440 private void cancelButtonAction(ActionEvent event)
441441 {
442- new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
442+ new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
443443 Platform.runLater(new Runnable(){ @Override public void run()
444444 {
445445 if (repeaterTimeline != null) { repeaterTimeline.stop(); statusLabel1.setText("Canceled"); } else { statusLabel1.setText("Closing"); }
446446 statusLabel1.setVisible(true);
447447
448- new Sound().play(guifx, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);
448+ new AudioPlayer().play(guifx, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);
449449
450450 repeaterTimeline = new Timeline(new KeyFrame( Duration.millis(100), ae -> closeWindow() ));
451451 repeaterTimeline.setCycleCount(1);
@@ -458,7 +458,7 @@ public class CreateOTPKey extends Application implements Initializable
458458 {
459459 Platform.runLater(new Runnable(){ @Override public void run()
460460 {
461- new Sound().play(guifx, Audio.SND_SHUTDOWN,Audio.AUDIO_CODEC);
461+ new AudioPlayer().play(guifx, Audio.SND_SHUTDOWN,Audio.AUDIO_CODEC);
462462 guifx.updateFileChoosers(true, false, true, true, false, true); // Basically FileChoosers ComponentAlteration as guifx.updateFileChoosers(true, true); hanged sometimes.
463463 Stage stage = (Stage) cancelButton.getScene().getWindow(); stage.close();
464464 }});
@@ -480,8 +480,8 @@ public class CreateOTPKey extends Application implements Initializable
480480 {
481481 Platform.runLater(new Runnable(){ @Override public void run()
482482 {
483- new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
484- new Sound().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
483+ new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
484+ new AudioPlayer().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
485485 Thread complianceURLThread;
486486 complianceURLThread = new Thread(() ->
487487 {
@@ -501,8 +501,8 @@ public class CreateOTPKey extends Application implements Initializable
501501 {
502502 Platform.runLater(new Runnable(){ @Override public void run()
503503 {
504- new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
505- new Sound().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
504+ new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
505+ new AudioPlayer().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
506506 Thread otpRulesURLThread;
507507 otpRulesURLThread = new Thread(() ->
508508 {
--- a/src/rdj/GUIFX.java
+++ b/src/rdj/GUIFX.java
@@ -869,7 +869,7 @@ public class GUIFX extends Application implements UI, Initializable
869869 {
870870 Platform.runLater(() ->
871871 {
872- if ( Audio.sound_Is_Enabled ) { new Sound().play(this, Audio.SND_SHUTDOWN,Audio.AUDIO_CODEC); }
872+ if ( Audio.sound_Is_Enabled ) { new AudioPlayer().play(this, Audio.SND_SHUTDOWN,Audio.AUDIO_CODEC); }
873873
874874 // Shared
875875 String val = prefs.get("Shared", "Unknown");
@@ -1416,7 +1416,7 @@ public class GUIFX extends Application implements UI, Initializable
14161416 sysmonFadeTransition.setInterpolator(Interpolator.EASE_OUT);
14171417 sysmonFadeTransition.setOnFinished((ActionEvent enableKeyButtonEvent) ->
14181418 {
1419- new Sound().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
1419+ new AudioPlayer().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
14201420
14211421 userloadPercTest = 100.0d; userMemPercTest = 100.0d; throughputPercTest = 100d; // IO_THROUGHPUT_CEILING;
14221422 Timeline systemMonitorTestTimeline = new Timeline(new KeyFrame( Duration.millis(100), ae ->
@@ -1429,7 +1429,7 @@ public class GUIFX extends Application implements UI, Initializable
14291429 {
14301430 update_System_Monitor_Enabled = true;
14311431 });
1432- new Sound().play(this, Audio.SND_SELECTKEY,Audio.AUDIO_CODEC);
1432+ new AudioPlayer().play(this, Audio.SND_SELECTKEY,Audio.AUDIO_CODEC);
14331433 systemMonitorTestTimeline.play();
14341434
14351435 regrabFCFocusOnOSX(500);
@@ -1536,29 +1536,29 @@ public class GUIFX extends Application implements UI, Initializable
15361536 {
15371537 if (Voice.sound_Is_Enabled) // turn sound off
15381538 {
1539- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
1540- new Sound().play(this, Audio.SND_SOUND_DISABLED,Audio.AUDIO_CODEC);
1539+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
1540+ new AudioPlayer().play(this, Audio.SND_SOUND_DISABLED,Audio.AUDIO_CODEC);
15411541 setSound(false); prefs.put("Sound", "Disabled"); flushPrefs(prefs);
15421542 }
15431543 else // turn sound on
15441544 {
15451545 setSound(true); prefs.put("Sound", "Enabled"); flushPrefs(prefs);
1546- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
1547- new Sound().play(this, Audio.SND_SOUND_ENABLED,Audio.AUDIO_CODEC);
1546+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
1547+ new AudioPlayer().play(this, Audio.SND_SOUND_ENABLED,Audio.AUDIO_CODEC);
15481548 }
15491549 }
15501550 else if (( event.getX() >= 130 ) && (event.getX() <= 145)) // Voice
15511551 {
15521552 if (Voice.voice_Is_Enabled) // turn voice off
15531553 {
1554- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
1554+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
15551555 Voice.play(this, Audio.VOI_VOICE_DISABLED,Audio.AUDIO_CODEC);
15561556 setVoice(false); prefs.put("Voice", "Disabled"); flushPrefs(prefs);
15571557 }
15581558 else // turn voice on
15591559 {
15601560 setVoice(true); prefs.put("Voice", "Enabled"); flushPrefs(prefs);
1561- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
1561+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
15621562 Voice.play(this, Audio.VOI_VOICE_ENABLED,Audio.AUDIO_CODEC);
15631563 }
15641564 }
@@ -1814,7 +1814,7 @@ public class GUIFX extends Application implements UI, Initializable
18141814
18151815 public Alert introAlert(AlertType type, String title, String headerText, String message, String optOutMessage, Consumer<Boolean> optOutAction, ButtonType... buttonTypes)
18161816 {
1817- new Sound().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
1817+ new AudioPlayer().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
18181818 Alert alert = new Alert(type);
18191819 alert.getDialogPane().applyCss();
18201820 Node graphic = alert.getDialogPane().getGraphic();
@@ -1918,7 +1918,7 @@ public class GUIFX extends Application implements UI, Initializable
19181918
19191919 private void alertCurrentVersionIsUp2Date()
19201920 {
1921- new Sound().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
1921+ new AudioPlayer().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
19221922 Alert alert = new Alert(AlertType.INFORMATION);
19231923
19241924 DialogPane dialogPane = alert.getDialogPane();
@@ -1933,12 +1933,12 @@ public class GUIFX extends Application implements UI, Initializable
19331933 alert.setContentText(content);
19341934 alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
19351935 alert.showAndWait();
1936- if (alert.getResult() == ButtonType.OK) { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
1936+ if (alert.getResult() == ButtonType.OK) { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
19371937 }
19381938
19391939 private void alertCurrentVersionCanBeUpdated()
19401940 {
1941- new Sound().play(this, Audio.SND_ALERT,Audio.AUDIO_CODEC);
1941+ new AudioPlayer().play(this, Audio.SND_ALERT,Audio.AUDIO_CODEC);
19421942 String alertString = Version.getProductName() + " v" + version.getLocalOverallVersionString() + " " + canbeupdatedtoversion + ": " + version.getLatestOnlineOverallVersionString() + "\r\n\r\n";
19431943 if (! version.getLatestReleaseString().isEmpty()) { alertString += version.getLatestReleaseString() + "\r\n"; }
19441944 alertString += wouldYouLikeToDownload + " (" + Version.getProductName() + " v" + version.getLatestOnlineOverallVersionString() + ") ?\r\n";
@@ -1954,14 +1954,14 @@ public class GUIFX extends Application implements UI, Initializable
19541954 alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
19551955 alert.showAndWait();
19561956
1957- if (alert.getResult() == ButtonType.YES) { new Sound().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC); Version.openWebSite(this, Version.DOWNLOADPAGEURLSTRINGARRAY, "GET"); } else { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
1957+ if (alert.getResult() == ButtonType.YES) { new AudioPlayer().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC); Version.openWebSite(this, Version.DOWNLOADPAGEURLSTRINGARRAY, "GET"); } else { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
19581958 }
19591959
19601960 private void alertCurrentVersionIsDevelopement()
19611961 {
19621962 // Platform.runLater(() ->
19631963 // {
1964- new Sound().play(this, Audio.SND_ALERT,Audio.AUDIO_CODEC);
1964+ new AudioPlayer().play(this, Audio.SND_ALERT,Audio.AUDIO_CODEC);
19651965
19661966 String alertString = "";
19671967 Alert alert = new Alert(Alert.AlertType.CONFIRMATION, alertString, ButtonType.YES, ButtonType.NO);
@@ -1984,13 +1984,13 @@ public class GUIFX extends Application implements UI, Initializable
19841984 alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
19851985 alert.showAndWait();
19861986
1987- if (alert.getResult() == ButtonType.YES) { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); Version.openWebSite(this, Version.DOWNLOADPAGEURLSTRINGARRAY, "GET"); } else { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
1987+ if (alert.getResult() == ButtonType.YES) { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); Version.openWebSite(this, Version.DOWNLOADPAGEURLSTRINGARRAY, "GET"); } else { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
19881988 // });
19891989 }
19901990
19911991 private void alertlatestVersionUnknown()
19921992 {
1993- new Sound().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
1993+ new AudioPlayer().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
19941994 Alert alert = new Alert(AlertType.ERROR);
19951995
19961996 DialogPane dialogPane = alert.getDialogPane();
@@ -2003,12 +2003,12 @@ public class GUIFX extends Application implements UI, Initializable
20032003 alert.setContentText(version.getUpdateStatus() + "\r\n" + network_connection_issues_perhaps + "\r\n");
20042004 alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
20052005 alert.showAndWait();
2006- if (alert.getResult() == ButtonType.OK) { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
2006+ if (alert.getResult() == ButtonType.OK) { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
20072007 }
20082008
20092009 private void latestAlertMessage()
20102010 {
2011- new Sound().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
2011+ new AudioPlayer().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
20122012 Alert alert = new Alert(AlertType.INFORMATION);
20132013
20142014 // Style the Alert
@@ -2022,12 +2022,12 @@ public class GUIFX extends Application implements UI, Initializable
20222022 alert.setContentText(version.getLatestAlertString());
20232023 alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
20242024 alert.showAndWait();
2025- if (alert.getResult() == ButtonType.OK) { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
2025+ if (alert.getResult() == ButtonType.OK) { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
20262026 }
20272027
20282028 private void currentAlertMessage()
20292029 {
2030- new Sound().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
2030+ new AudioPlayer().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
20312031 Alert alert = new Alert(AlertType.INFORMATION);
20322032
20332033 // Style the Alert
@@ -2042,7 +2042,7 @@ public class GUIFX extends Application implements UI, Initializable
20422042 alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
20432043 alert.showAndWait();
20442044
2045- if (alert.getResult() == ButtonType.OK) { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
2045+ if (alert.getResult() == ButtonType.OK) { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
20462046 }
20472047
20482048 // Custom FileChooserDelete Listener methods
@@ -2053,8 +2053,8 @@ public class GUIFX extends Application implements UI, Initializable
20532053 {
20542054 Platform.runLater(() ->
20552055 {
2056- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
2057- new Sound().play(this, Audio.SND_ALERT,Audio.AUDIO_CODEC);
2056+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
2057+ new AudioPlayer().play(this, Audio.SND_ALERT,Audio.AUDIO_CODEC);
20582058 String itemword = "";
20592059 if ( tgtFileChooser.getSelectedFiles().length == 1 ) { itemword = item; }
20602060 else if ( tgtFileChooser.getSelectedFiles().length > 1 ) { itemword = items; }
@@ -2070,7 +2070,7 @@ public class GUIFX extends Application implements UI, Initializable
20702070 {
20712071 if (tgtFileChooser.getSelectedFiles().length > 0)
20722072 {
2073- new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC);
2073+ new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC);
20742074 // play(SND_INPUT_OK, AUDIO_CODEC);
20752075 ArrayList<Path> pathList = finalCrypt.getPathList(tgtFileChooser.getSelectedFiles());
20762076 // boolean delete = true;
@@ -2084,7 +2084,7 @@ public class GUIFX extends Application implements UI, Initializable
20842084 updateFileChoosers(true, false, true, true, false, true); // targetFileDeleteButtonActionPerformed()
20852085 }
20862086 }
2087- } else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); }
2087+ } else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); }
20882088 });
20892089 }
20902090
@@ -2096,8 +2096,8 @@ public class GUIFX extends Application implements UI, Initializable
20962096 {
20972097 Platform.runLater(() ->
20982098 {
2099- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
2100- new Sound().play(this, Audio.SND_ALERT,Audio.AUDIO_CODEC);
2099+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
2100+ new AudioPlayer().play(this, Audio.SND_ALERT,Audio.AUDIO_CODEC);
21012101 String itemword = "";
21022102 if ( keyFileChooser.getSelectedFiles().length == 1 ) { itemword = item; }
21032103 else if ( keyFileChooser.getSelectedFiles().length > 1 ) { itemword = items; }
@@ -2112,7 +2112,7 @@ public class GUIFX extends Application implements UI, Initializable
21122112 {
21132113 if (keyFileChooser.getSelectedFiles().length > 0)
21142114 {
2115- new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC);
2115+ new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC);
21162116 ArrayList<Path> pathList = finalCrypt.getPathList(keyFileChooser.getSelectedFiles());
21172117 // boolean delete = true;
21182118 boolean returnpathlist = false;
@@ -2129,8 +2129,8 @@ public class GUIFX extends Application implements UI, Initializable
21292129 }
21302130 } else
21312131 {
2132- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
2133- new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);
2132+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
2133+ new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);
21342134 }
21352135 });
21362136 }
@@ -2222,7 +2222,7 @@ public class GUIFX extends Application implements UI, Initializable
22222222 {
22232223 Thread openThread = new Thread(() ->
22242224 {
2225- new Sound().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC);
2225+ new AudioPlayer().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC);
22262226 try { Desktop.getDesktop().open(targetFCPath.path.toFile()); } catch (IOException ex) { log("Error: Desktop.getDesktop().open(file); " + ex.getMessage() + "\r\n", true, true, true, true, false); }
22272227 });
22282228 openThread.setName("openThread");
@@ -2273,7 +2273,7 @@ public class GUIFX extends Application implements UI, Initializable
22732273 GUIFX guifx = this;
22742274 Thread openThread = new Thread(() ->
22752275 {
2276- new Sound().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
2276+ new AudioPlayer().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
22772277 try { Desktop.getDesktop().open(keyFCPath.path.toFile()); } catch (IOException ex) { log("Error: Desktop.getDesktop().open(keyFileChooser.getSelectedFile()); " + ex.getMessage() + "\r\n", true, true, true, true, false); }
22782278 });
22792279 openThread.setName("openThread");
@@ -2303,7 +2303,7 @@ public class GUIFX extends Application implements UI, Initializable
23032303 {
23042304 if ((!processRunning ) && (evt.getPropertyName().equals("SelectedFilesChangedProperty")))
23052305 {
2306- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
2306+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
23072307 tgtFileChooserPropertyCheck(true);
23082308 }
23092309 else if (evt.getPropertyName().equals("directoryChanged"))
@@ -2329,7 +2329,7 @@ public class GUIFX extends Application implements UI, Initializable
23292329 // test("Prop: " + evt.getPropertyName() + "\r\n");
23302330 if ((!processRunning ) && (evt.getPropertyName().equals("SelectedFilesChangedProperty")))
23312331 {
2332- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
2332+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
23332333 keyFileChooserPropertyCheck(false);
23342334 }
23352335 else if (evt.getPropertyName().equals("directoryChanged"))
@@ -2424,7 +2424,7 @@ public class GUIFX extends Application implements UI, Initializable
24242424
24252425 if ((targetPathList != null) && (targetPathList.size() > 0)) { filesProgressBar.setVisible(true); filesProgressBar.setProgress(ProgressBar.INDETERMINATE_PROGRESS); }
24262426
2427- new Sound().play(this, Audio.SND_READY,Audio.AUDIO_CODEC);
2427+ new AudioPlayer().play(this, Audio.SND_READY,Audio.AUDIO_CODEC);
24282428
24292429 ugMessage = new Message(scanning_files, 64, false, false, false, false, Voice.VOI_SCANNING_FILES, 0);
24302430 userGuidanceMessage(ugMessage);
@@ -2453,7 +2453,7 @@ public class GUIFX extends Application implements UI, Initializable
24532453 }
24542454 else
24552455 {
2456- new Sound().play(this, Audio.SND_SELECTINVALID,Audio.AUDIO_CODEC);
2456+ new AudioPlayer().play(this, Audio.SND_SELECTINVALID,Audio.AUDIO_CODEC);
24572457 ugMessage = new Message(select_key_dir, 64, false, false, true, false, Voice.VOI_SELECT_KEY_DIRECTORY, 0);
24582458 userGuidanceMessage(ugMessage);
24592459 }
@@ -2558,7 +2558,7 @@ public class GUIFX extends Application implements UI, Initializable
25582558 else if (keyFCPath.type == FCPath.DIRECTORY) { keyitem = directory; }
25592559 else { keyitem = FCPath.getTypeString(keyFCPath.type); }
25602560
2561- new Sound().play(this, Audio.SND_SELECTKEY,Audio.AUDIO_CODEC);
2561+ new AudioPlayer().play(this, Audio.SND_SELECTKEY,Audio.AUDIO_CODEC);
25622562 keyHeaderLabel.setTextFill(Color.GREENYELLOW); keyHeaderLabel.setText(key + " " + keyitem);
25632563 keyNameLabel.setTextFill(Color.GREENYELLOW); keyNameLabel.setText(keyFCPath.path.toAbsolutePath().toString()); keyNameLabelTooltip.setText(keyFCPath.path.toAbsolutePath().toString());
25642564 checksumLabel.setTextFill(Color.WHITESMOKE); checksumHeader.setText(""); checksumLabel.setText("");
@@ -2609,7 +2609,7 @@ public class GUIFX extends Application implements UI, Initializable
26092609 else if (keyFCPath.type == FCPath.DIRECTORY) { keyitem = directory; }
26102610 else { keyitem = FCPath.getTypeString(keyFCPath.type); }
26112611
2612- new Sound().play(this, Audio.SND_SELECTINVALID,Audio.AUDIO_CODEC);
2612+ new AudioPlayer().play(this, Audio.SND_SELECTINVALID,Audio.AUDIO_CODEC);
26132613 keyHeaderLabel.setTextFill(Color.ORANGE); keyHeaderLabel.setText(key + " " + keyitem);
26142614 keyNameLabel.setTextFill(Color.ORANGE); keyNameLabel.setText(keyFCPath.path.toAbsolutePath().toString()); keyNameLabelTooltip.setText(keyFCPath.path.toAbsolutePath().toString());
26152615 if (keyFCPath.type != FCPath.FILE) { keyHeaderLabel.setTextFill(Color.ORANGERED); }
@@ -2686,7 +2686,7 @@ public class GUIFX extends Application implements UI, Initializable
26862686 else if (keyFCPath.type == FCPath.DIRECTORY) { keyitem = directory; }
26872687 else { keyitem = FCPath.getTypeString(keyFCPath.type); }
26882688
2689- new Sound().play(this, Audio.SND_SELECTINVALID,Audio.AUDIO_CODEC);
2689+ new AudioPlayer().play(this, Audio.SND_SELECTINVALID,Audio.AUDIO_CODEC);
26902690 keyHeaderLabel.setTextFill(Color.ORANGE); keyHeaderLabel.setText(key + " " + keyitem);
26912691 keyNameLabel.setTextFill(Color.ORANGE); keyNameLabel.setText(keyFCPath.path.toAbsolutePath().toString()); keyNameLabelTooltip.setText(keyFCPath.path.toAbsolutePath().toString());
26922692 if (keyFCPath.type != FCPath.FILE) { keyHeaderLabel.setTextFill(Color.ORANGERED); }
@@ -2757,7 +2757,7 @@ public class GUIFX extends Application implements UI, Initializable
27572757 String hashString = getHexString(hashBytes,2);
27582758 Platform.runLater(() ->
27592759 {
2760- new Sound().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC);
2760+ new AudioPlayer().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC);
27612761 checksumLabel.setTextFill(Color.GREENYELLOW);
27622762 checksumHeader.setText(checksum + " (" + FinalCrypt.HASH_ALGORITHM_NAME + ")"); checksumLabel.setText(hashString);
27632763 if ( checksumTooltip != null ) { checksumTooltip.setText(hashString + "\r\n\r\n" + calculate_checksum_tooltip); }
@@ -2781,14 +2781,14 @@ public class GUIFX extends Application implements UI, Initializable
27812781
27822782 @FXML private void checksumLabelOnMouseClicked(MouseEvent event)
27832783 {
2784- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
2784+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
27852785 Platform.runLater(() ->
27862786 {
27872787 if ( event.getButton() == MouseButton.PRIMARY )
27882788 {
27892789 if ((keyFCPath != null) && (keyFCPath.isValidKey))
27902790 {
2791- new Sound().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC);
2791+ new AudioPlayer().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC);
27922792 checksumLabel.setTextFill(Color.WHITESMOKE);
27932793 checksumHeader.setText("Checksum (" + FinalCrypt.HASH_ALGORITHM_NAME + ")"); checksumLabel.setText("Calculating..."); checksumTooltip.setText("");
27942794 Platform.runLater(() -> { calculateChecksum(); });
@@ -2798,7 +2798,7 @@ public class GUIFX extends Application implements UI, Initializable
27982798 {
27992799 if ((keyFCPath != null) && (keyFCPath.isValidKey))
28002800 {
2801- new Sound().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC);
2801+ new AudioPlayer().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC);
28022802 Thread blinkThread = new Thread(() ->
28032803 {
28042804 Paint oldColor = checksumLabel.getTextFill();
@@ -3000,7 +3000,7 @@ public class GUIFX extends Application implements UI, Initializable
30003000 // Encryptable Files
30013001 if (targetFCPathList.encryptableFiles > 0) // Encryptables
30023002 {
3003- new Sound().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC);
3003+ new AudioPlayer().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC);
30043004 encryptableList = filter(targetFCPathList,(FCPath fcPath) -> fcPath.isEncryptable);
30053005 encryptButton.setDisable(false);
30063006
@@ -3032,7 +3032,7 @@ public class GUIFX extends Application implements UI, Initializable
30323032 // Decryptable Files
30333033 if ((targetFCPathList.decryptableFiles > 0) && ( ! finalCrypt.disabledMAC) ) // Prevents destruction! Non-MAC Mode encrypting MAC encrypted files (in stead of default decryption)
30343034 {
3035- new Sound().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC);
3035+ new AudioPlayer().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC);
30363036 decryptableList = filter(targetFCPathList,(FCPath fcPath) -> fcPath.isDecryptable);
30373037 decryptButton.setDisable(false);
30383038 // pauseToggleButton.setDisable(true); stopButton.setDisable(true);
@@ -3106,7 +3106,7 @@ public class GUIFX extends Application implements UI, Initializable
31063106 {
31073107 if ((targetFCPathList.encryptedFiles > 0) && (targetFCPathList.decryptableFiles == 0))
31083108 {
3109- if (targetFCPathList.encryptedFiles > 0) { new Sound().play(this, Audio.SND_SELECTINVALID,Audio.AUDIO_CODEC); ugMessage = new Message(wrong_key_pass, 48, false, false, true, false, Voice.VOI_WRONG_KEY_OR_PASSWORD, 0); userGuidanceMessage(ugMessage); }
3109+ if (targetFCPathList.encryptedFiles > 0) { new AudioPlayer().play(this, Audio.SND_SELECTINVALID,Audio.AUDIO_CODEC); ugMessage = new Message(wrong_key_pass, 48, false, false, true, false, Voice.VOI_WRONG_KEY_OR_PASSWORD, 0); userGuidanceMessage(ugMessage); }
31103110 }
31113111 else
31123112 {
@@ -3331,7 +3331,7 @@ public class GUIFX extends Application implements UI, Initializable
33313331 {
33323332 Platform.runLater(() ->
33333333 {
3334- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
3334+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
33353335 Thread encryptThread = new Thread(new Runnable()
33363336 {
33373337 private DeviceManager deviceManager;
@@ -3395,7 +3395,7 @@ public class GUIFX extends Application implements UI, Initializable
33953395 {
33963396 Platform.runLater(() ->
33973397 {
3398- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
3398+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
33993399 Thread encryptThread = new Thread(new Runnable()
34003400 {
34013401 private DeviceManager deviceManager;
@@ -3451,13 +3451,13 @@ public class GUIFX extends Application implements UI, Initializable
34513451 finalCrypt.encryptSelection(targetSourceFCPathList, filteredTargetSourceFCPathList, keyFCPath, false, pwd, pwdBytes, open);
34523452 }
34533453
3454- @FXML private void keyLabelOnMouseClicked(MouseEvent event) { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); createOTPKeyFile(); }
3455- private void keyButtonOnAction(ActionEvent event) { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); createOTPKeyFile(); }
3454+ @FXML private void keyLabelOnMouseClicked(MouseEvent event) { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); createOTPKeyFile(); }
3455+ private void keyButtonOnAction(ActionEvent event) { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); createOTPKeyFile(); }
34563456
34573457 synchronized private void createOTPKeyFile()
34583458 {
34593459 // Needs Threading to early split off from the UI Event Dispatch Thread
3460- new Sound().play(this, Audio.SND_ALERT,Audio.AUDIO_CODEC);
3460+ new AudioPlayer().play(this, Audio.SND_ALERT,Audio.AUDIO_CODEC);
34613461 String alertString = "";
34623462 Alert alert = new Alert(Alert.AlertType.CONFIRMATION, alertString, ButtonType.YES, ButtonType.NO);
34633463
@@ -3479,7 +3479,7 @@ public class GUIFX extends Application implements UI, Initializable
34793479
34803480 if (alert.getResult() == ButtonType.YES)
34813481 {
3482- new Sound().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC);
3482+ new AudioPlayer().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC);
34833483 final GUIFX guifx = this;
34843484 final UI ui = this;
34853485
@@ -3505,7 +3505,7 @@ public class GUIFX extends Application implements UI, Initializable
35053505
35063506 Platform.runLater(() ->
35073507 {
3508- new Sound().play(ui, Sound.SND_OPEN,Audio.AUDIO_CODEC);
3508+ new AudioPlayer().play(ui, AudioPlayer.SND_OPEN,Audio.AUDIO_CODEC);
35093509 createOTPKeyStage = new Stage();
35103510 createOTPKey = new CreateOTPKey();
35113511
@@ -3558,7 +3558,7 @@ public class GUIFX extends Application implements UI, Initializable
35583558 // encryptThread.setDaemon(true);
35593559 // encryptThread.start();
35603560 }
3561- else { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
3561+ else { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
35623562 }
35633563
35643564 synchronized private void openSupport(String caller, Locale selectedLocale, boolean exitAppOnClose)
@@ -3579,7 +3579,7 @@ public class GUIFX extends Application implements UI, Initializable
35793579 {
35803580 // test("Caller: " + caller + " exitAppOnClose " + exitAppOnClose + "\r\n");
35813581
3582- new Sound().play(ui, Sound.SND_OPEN,Audio.AUDIO_CODEC);
3582+ new AudioPlayer().play(ui, AudioPlayer.SND_OPEN,Audio.AUDIO_CODEC);
35833583 supportStage = new Stage();
35843584 support = new Support();
35853585
@@ -3631,10 +3631,10 @@ public class GUIFX extends Application implements UI, Initializable
36313631
36323632 switch (processRunningMode)
36333633 {
3634- case ENCRYPT_MODE: new Sound().play(this, Audio.SND_ENCRYPTFILES,Audio.AUDIO_CODEC); ugMessage = new Message(encrypting_files, 64, false, false, false, false, Voice.VOI_ENCRYPTING_FILES, 0); userGuidanceMessage(ugMessage); break;
3635- case DECRYPT_MODE: new Sound().play(this, Audio.SND_DECRYPTFILES,Audio.AUDIO_CODEC); ugMessage = new Message(decrypting_files, 64, false, false, false, false, Voice.VOI_DECRYPTING_FILES, 0); userGuidanceMessage(ugMessage); break;
3636- case CREATE_KEYDEV_MODE: new Sound().play(this, Audio.SND_ENCRYPTFILES,Audio.AUDIO_CODEC); ugMessage = new Message(create_keydev, 64, false, false, false, false, Voice.VOI_CREATE_KEY_DEVICE, 0); userGuidanceMessage(ugMessage); break;
3637- case CLONE_KEYDEV_MODE: new Sound().play(this, Audio.SND_ENCRYPTFILES,Audio.AUDIO_CODEC); ugMessage = new Message(clone_keydev, 64, false, false, false, false, Voice.VOI_CLONE_KEY_DEVICE, 0); userGuidanceMessage(ugMessage); break;
3634+ case ENCRYPT_MODE: new AudioPlayer().play(this, Audio.SND_ENCRYPTFILES,Audio.AUDIO_CODEC); ugMessage = new Message(encrypting_files, 64, false, false, false, false, Voice.VOI_ENCRYPTING_FILES, 0); userGuidanceMessage(ugMessage); break;
3635+ case DECRYPT_MODE: new AudioPlayer().play(this, Audio.SND_DECRYPTFILES,Audio.AUDIO_CODEC); ugMessage = new Message(decrypting_files, 64, false, false, false, false, Voice.VOI_DECRYPTING_FILES, 0); userGuidanceMessage(ugMessage); break;
3636+ case CREATE_KEYDEV_MODE: new AudioPlayer().play(this, Audio.SND_ENCRYPTFILES,Audio.AUDIO_CODEC); ugMessage = new Message(create_keydev, 64, false, false, false, false, Voice.VOI_CREATE_KEY_DEVICE, 0); userGuidanceMessage(ugMessage); break;
3637+ case CLONE_KEYDEV_MODE: new AudioPlayer().play(this, Audio.SND_ENCRYPTFILES,Audio.AUDIO_CODEC); ugMessage = new Message(clone_keydev, 64, false, false, false, false, Voice.VOI_CLONE_KEY_DEVICE, 0); userGuidanceMessage(ugMessage); break;
36383638 default: break;
36393639 }
36403640
@@ -3893,7 +3893,7 @@ public class GUIFX extends Application implements UI, Initializable
38933893 FCPath openFCPath = (FCPath) fcPathIterator.next();
38943894 Path newPath = Paths.get(openFCPath.path.toAbsolutePath().toString().substring(0, openFCPath.path.toAbsolutePath().toString().lastIndexOf('.')));
38953895
3896- new Sound().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC);
3896+ new AudioPlayer().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC);
38973897 try { Desktop.getDesktop().open(newPath.toFile()); }
38983898 catch (IOException ex) { log("Error: Desktop.getDesktop().open(" + newPath.toFile().getAbsolutePath().toString() + "); " + ex.getMessage() + "\r\n", true, true, true, true, false); }
38993899
@@ -3914,7 +3914,7 @@ public class GUIFX extends Application implements UI, Initializable
39143914 openThread.setDaemon(true);
39153915 openThread.start();
39163916
3917- new Sound().play(this, Audio.SND_SHUTDOWN,Audio.AUDIO_CODEC);
3917+ new AudioPlayer().play(this, Audio.SND_SHUTDOWN,Audio.AUDIO_CODEC);
39183918
39193919 if (System.getProperty("os.name").toLowerCase().indexOf("mac") == -1) // Again due to Mac OSX
39203920 {
@@ -4006,7 +4006,7 @@ public class GUIFX extends Application implements UI, Initializable
40064006 @FXML
40074007 private void keyInfoLabelClicked(MouseEvent event)
40084008 {
4009- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4009+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
40104010 Alert alert = new Alert(AlertType.INFORMATION);
40114011
40124012 // Style the Alert
@@ -4020,16 +4020,16 @@ public class GUIFX extends Application implements UI, Initializable
40204020 String infotext = new String();
40214021 infotext = keyInfoContent;
40224022 alert.setContentText(infotext);
4023- new Sound().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
4023+ new AudioPlayer().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
40244024 alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
40254025 alert.showAndWait();
4026- if (alert.getResult() == ButtonType.OK) { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
4026+ if (alert.getResult() == ButtonType.OK) { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
40274027 }
40284028
40294029 @FXML
40304030 private void targetInfoLabelClicked(MouseEvent event)
40314031 {
4032- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4032+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
40334033 Alert alert = new Alert(AlertType.INFORMATION);
40344034
40354035 // Style the Alert
@@ -4043,10 +4043,10 @@ public class GUIFX extends Application implements UI, Initializable
40434043 String infotext = new String();
40444044 infotext = targetInfoContent;
40454045 alert.setContentText(infotext);
4046- new Sound().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
4046+ new AudioPlayer().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC);
40474047 alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
40484048 alert.showAndWait();
4049- if (alert.getResult() == ButtonType.OK) { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
4049+ if (alert.getResult() == ButtonType.OK) { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
40504050 }
40514051
40524052 // private void pauseToggleButtonAction(ActionEvent event) { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); pause(); }
@@ -4064,7 +4064,7 @@ public class GUIFX extends Application implements UI, Initializable
40644064 {
40654065 if ( processPausing )
40664066 {
4067- new Sound().play(this, Audio.SND_SHUTDOWN,Audio.AUDIO_CODEC);
4067+ new AudioPlayer().play(this, Audio.SND_SHUTDOWN,Audio.AUDIO_CODEC);
40684068 if (processRunningMode == ENCRYPT_MODE) { encryptButton.setStyle(" -fx-text-fill: orange; "); }
40694069 else if (processRunningMode == DECRYPT_MODE) { decryptButton.setStyle(" -fx-text-fill: orange; "); }
40704070 PAUSE_TIMELINE.play();
@@ -4074,7 +4074,7 @@ public class GUIFX extends Application implements UI, Initializable
40744074 {
40754075 if (!unPauseToStop)
40764076 {
4077- if (processRunningMode == ENCRYPT_MODE) { new Sound().play(this, Audio.SND_ENCRYPTFILES,Audio.AUDIO_CODEC); } else { new Sound().play(this, Audio.SND_DECRYPTFILES,Audio.AUDIO_CODEC); }
4077+ if (processRunningMode == ENCRYPT_MODE) { new AudioPlayer().play(this, Audio.SND_ENCRYPTFILES,Audio.AUDIO_CODEC); } else { new AudioPlayer().play(this, Audio.SND_DECRYPTFILES,Audio.AUDIO_CODEC); }
40784078 }
40794079 PAUSE_TIMELINE.stop();
40804080 if (processRunningMode == ENCRYPT_MODE) { encryptButton.setText(getPauseDescription()); encryptButton.setStyle(" -fx-text-fill: white; "); }
@@ -4104,14 +4104,14 @@ public class GUIFX extends Application implements UI, Initializable
41044104 // UI
41054105 Platform.runLater(() ->
41064106 {
4107- new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC);
4107+ new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC);
41084108 });
41094109 }
41104110 }
41114111
41124112 @FXML private void authorLabelOnMouseClicked(MouseEvent event)
41134113 {
4114- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4114+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
41154115 // new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); /*checkUpdate();*/
41164116 Thread openAuthorThread; openAuthorThread = new Thread(() ->
41174117 {
@@ -4129,7 +4129,7 @@ public class GUIFX extends Application implements UI, Initializable
41294129
41304130 private void checkUpdateButtonOnAction(ActionEvent event)
41314131 {
4132- Platform.runLater(() -> { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); });
4132+ Platform.runLater(() -> { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); });
41334133 Platform.runLater(() -> { checkUpdate( true ); });
41344134 }
41354135
@@ -4150,145 +4150,145 @@ public class GUIFX extends Application implements UI, Initializable
41504150 }
41514151 }
41524152
4153- @FXML private void logTabSelectionChanged(Event event) { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
4153+ @FXML private void logTabSelectionChanged(Event event) { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); }
41544154
41554155 // Headers
41564156 // ==================================================================================================================================================================
41574157
41584158 private void emptyFilesHeaderLabelOnMouseClicked(MouseEvent event)
41594159 {
4160- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4161- if ( (emptyList != null) && (emptyList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("Empty Files:\r\n\r\n", false, true, true, false, false);
4160+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4161+ if ( (emptyList != null) && (emptyList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("Empty Files:\r\n\r\n", false, true, true, false, false);
41624162 // for (Iterator it = emptyList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } log("\r\n", false, true, false, false, false); }
41634163 emptyList.forEach((fcPath) -> { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); });
41644164 log("\r\n", false, true, false, false, false); }
4165- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); }
4165+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); }
41664166 }
41674167
41684168 private void symlinkFilesHeaderLabelOnMouseClicked(MouseEvent event)
41694169 {
4170- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4171- if ( (symlinkList != null) && (symlinkList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("Symlinks:\r\n\r\n", false, true, true, false, false);
4170+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4171+ if ( (symlinkList != null) && (symlinkList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("Symlinks:\r\n\r\n", false, true, true, false, false);
41724172 // for (Iterator it = symlinkList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } log("\r\n", false, true, false, false, false); }
41734173 symlinkList.forEach((fcPath) -> { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); });
41744174 log("\r\n", false, true, false, false, false); }
4175- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); }
4175+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); }
41764176 }
41774177
41784178 @FXML
41794179 private void unreadableFilesHeaderLabelOnMouseClicked(MouseEvent event)
41804180 {
4181- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4181+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
41824182 if ( (unreadableList != null) && (unreadableList.size() > 0) )
41834183 {
4184- /*tab.getSelectionModel().select(1);*/ new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); log("Set Read Attributes:\r\n\r\n", false, true, true, false, false);
4184+ /*tab.getSelectionModel().select(1);*/ new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); log("Set Read Attributes:\r\n\r\n", false, true, true, false, false);
41854185 // for (Iterator it = unreadableList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); setAttribute(fcPath, true, false); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } log("\r\n", false, true, false, false, false);
41864186 unreadableList.stream().map((fcPath) -> { setAttribute(fcPath, true, false); return fcPath; }).forEachOrdered((fcPath) -> { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); });
41874187 log("\r\n", false, true, false, false, false);
41884188 targetFCPathList = new FCPathList<FCPath>(); updateDashboard(targetFCPathList);
41894189 Platform.runLater(() -> { encryptButton.setDisable(true); decryptButton.setDisable(true); });
41904190 }
4191- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); }
4191+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); }
41924192 }
41934193
41944194 @FXML
41954195 private void unwritableFilesHeaderLabelOnMouseClicked(MouseEvent event)
41964196 {
4197- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4197+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
41984198 if ( (unwritableList != null) && (unwritableList.size() > 0) )
41994199 {
4200- /*tab.getSelectionModel().select(1);*/ new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); log("Set Write Attributes:\r\n\r\n", false, true, true, false, false);
4200+ /*tab.getSelectionModel().select(1);*/ new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); log("Set Write Attributes:\r\n\r\n", false, true, true, false, false);
42014201 // for (Iterator it = unwritableList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); setAttribute(fcPath, true, true); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } log("\r\n", false, true, true, false, false);
42024202 unwritableList.stream().map((fcPath) -> { setAttribute(fcPath, true, true); return fcPath; }).forEachOrdered((fcPath) -> { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); });
42034203 log("\r\n", false, true, true, false, false);
42044204 targetFCPathList = new FCPathList<FCPath>(); updateDashboard(targetFCPathList);
42054205 Platform.runLater(() -> { encryptButton.setDisable(true); decryptButton.setDisable(true); });
42064206 }
4207- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); }
4207+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); }
42084208 }
42094209
42104210 private void hiddenFilesHeaderLabelOnMouseClicked(MouseEvent event)
42114211 {
4212- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4213- if ( (hiddenList != null) && (hiddenList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nHidden Files:\r\n\r\n", false, true, true, false, false);
4212+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4213+ if ( (hiddenList != null) && (hiddenList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nHidden Files:\r\n\r\n", false, true, true, false, false);
42144214 // for (Iterator it = hiddenList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
42154215 for (FCPath fcPath : hiddenList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
42164216 log("\r\n", false, true, true, false, false); }
4217- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4217+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
42184218 }
42194219
42204220 @FXML
42214221 private void emptyFilesLabelOnMouseClicked(MouseEvent event)
42224222 {
4223- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4224- if ( (emptyList != null) && (emptyList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nEmpty Files:\r\n\r\n", false, true, true, false, false);
4223+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4224+ if ( (emptyList != null) && (emptyList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nEmpty Files:\r\n\r\n", false, true, true, false, false);
42254225 // for (Iterator it = emptyList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
42264226 for (FCPath fcPath : emptyList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
42274227 log("\r\n", false, true, true, false, false); }
4228- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4228+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
42294229 }
42304230
42314231 @FXML
42324232 private void symlinkFilesLabelOnMouseClicked(MouseEvent event)
42334233 {
4234- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4235- if ( (symlinkList != null) && (symlinkList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nSymlinks:\r\n\r\n", false, true, true, false, false);
4234+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4235+ if ( (symlinkList != null) && (symlinkList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nSymlinks:\r\n\r\n", false, true, true, false, false);
42364236 // for (Iterator it = symlinkList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
42374237 for (FCPath fcPath : symlinkList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
42384238 log("\r\n", false, true, true, false, false); }
4239- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4239+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
42404240 }
42414241
42424242 @FXML
42434243 private void unreadableFilesLabelOnMouseClicked(MouseEvent event)
42444244 {
4245- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4246- if ( (unreadableList != null) && (unreadableList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nUnreadable Files:\r\n\r\n", false, true, true, false, false);
4245+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4246+ if ( (unreadableList != null) && (unreadableList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nUnreadable Files:\r\n\r\n", false, true, true, false, false);
42474247 // for (Iterator it = unreadableList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
42484248 for (FCPath fcPath : unreadableList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
42494249 log("\r\n", false, true, true, false, false); }
4250- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4250+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
42514251 }
42524252
42534253 @FXML
42544254 private void unwritableFilesLabelOnMouseClicked(MouseEvent event)
42554255 {
4256- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4257- if ( (unwritableList != null) && (unwritableList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("Unwritable Files:\r\n\r\n", false, true, true, false, false);
4256+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4257+ if ( (unwritableList != null) && (unwritableList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("Unwritable Files:\r\n\r\n", false, true, true, false, false);
42584258 // for (Iterator it = unwritableList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
42594259 for (FCPath fcPath : unwritableList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
42604260 log("\r\n", false, true, true, false, false); }
4261- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4261+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
42624262 }
42634263
42644264 @FXML
42654265 private void hiddenFilesLabelOnMouseClicked(MouseEvent event)
42664266 {
4267- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4268- if ( (hiddenList != null) && (hiddenList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("Hidden Files:\r\n\r\n", false, true, true, false, false);
4267+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4268+ if ( (hiddenList != null) && (hiddenList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("Hidden Files:\r\n\r\n", false, true, true, false, false);
42694269 // for (Iterator it = hiddenList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
42704270 for (FCPath fcPath : hiddenList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
42714271 log("\r\n", false, true, true, false, false); }
4272- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4272+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
42734273 }
42744274
42754275 @FXML
42764276 private void encryptableLabelOnMouseClicked(MouseEvent event)
42774277 {
4278- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4279- if ( (encryptableList != null) && (encryptableList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nEncryptable Files:\r\n\r\n", false, true, true, false, false);
4278+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4279+ if ( (encryptableList != null) && (encryptableList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nEncryptable Files:\r\n\r\n", false, true, true, false, false);
42804280 // for (Iterator it = encryptableList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
42814281 for (FCPath fcPath : encryptableList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
42824282 log("\r\n", false, true, true, false, false); }
4283- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4283+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
42844284 }
42854285
42864286 @FXML private void keyWriteLabelOnMouseClicked(MouseEvent event)
42874287 {
4288- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4288+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
42894289 if ( (writeAutoKeyList != null) && (writeAutoKeyList.size() > 0) )
42904290 {
4291- new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nWrite Auto Key Files:\r\n\r\n", false, true, true, false, false);
4291+ new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nWrite Auto Key Files:\r\n\r\n", false, true, true, false, false);
42924292 // for (Iterator it = writeAutoKeyList.iterator(); it.hasNext();)
42934293 // {
42944294 // FCPath fcPath = (FCPath) it.next();
@@ -4302,15 +4302,15 @@ public class GUIFX extends Application implements UI, Initializable
43024302 }
43034303 log("\r\n", false, true, true, false, false);
43044304 }
4305- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4305+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
43064306 }
43074307
43084308 @FXML private void keyReadLabelOnMouseClicked(MouseEvent event)
43094309 {
4310- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4310+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
43114311 if ( (readAutoKeyList != null) && (readAutoKeyList.size() > 0) )
43124312 {
4313- new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nMatching Auto Key Files:\r\n\r\n", false, true, true, false, false);
4313+ new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nMatching Auto Key Files:\r\n\r\n", false, true, true, false, false);
43144314 // for (Iterator it = readAutoKeyList.iterator(); it.hasNext();)
43154315 // {
43164316 // FCPath fcPath = (FCPath) it.next();
@@ -4328,15 +4328,15 @@ public class GUIFX extends Application implements UI, Initializable
43284328 }
43294329 log("\r\n", false, true, true, false, false);
43304330 }
4331- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4331+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
43324332 }
43334333
43344334 @FXML private void keyMissingLabelOnMouseClicked(MouseEvent event)
43354335 {
4336- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4336+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
43374337 if ( (missingAutoKeyList != null) && (missingAutoKeyList.size() > 0) )
43384338 {
4339- new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nMissing Auto Key Files:\r\n\r\n", false, true, true, false, false);
4339+ new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nMissing Auto Key Files:\r\n\r\n", false, true, true, false, false);
43404340 // for (Iterator it = readAutoKeyList.iterator(); it.hasNext();)
43414341 // {
43424342 // FCPath fcPath = (FCPath) it.next();
@@ -4354,98 +4354,98 @@ public class GUIFX extends Application implements UI, Initializable
43544354 }
43554355 log("\r\n", false, true, true, false, false);
43564356 }
4357- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4357+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
43584358 }
43594359
43604360 @FXML private void decryptableLabelOnMouseClicked(MouseEvent event)
43614361 {
4362- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4363- if ( (decryptableList != null) && (decryptableList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nDecryptable Files:\r\n\r\n", false, true, true, false, false);
4362+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4363+ if ( (decryptableList != null) && (decryptableList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nDecryptable Files:\r\n\r\n", false, true, true, false, false);
43644364 // for (Iterator it = decryptableList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
43654365 for (FCPath fcPath : decryptableList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
43664366 log("\r\n", false, true, true, false, false); }
4367- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4367+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
43684368 }
43694369
43704370 @FXML
43714371 private void decryptedLabelOnMouseClicked(MouseEvent event)
43724372 {
4373- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4374- if ( (decryptedList != null) && (decryptedList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nDecrypted Files:\r\n\r\n", false, true, true, false, false);
4373+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4374+ if ( (decryptedList != null) && (decryptedList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nDecrypted Files:\r\n\r\n", false, true, true, false, false);
43754375 // for (Iterator it = decryptedList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
43764376 for (FCPath fcPath : decryptedList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
43774377 log("\r\n", false, true, true, false, false); }
4378- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4378+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
43794379 }
43804380
43814381 @FXML
43824382 private void encryptedLabelOnMouseClicked(MouseEvent event)
43834383 {
4384- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4385- if ( (encryptedList != null) && (encryptedList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nEncrypted Files:\r\n\r\n", false, true, true, false, false);
4384+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4385+ if ( (encryptedList != null) && (encryptedList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nEncrypted Files:\r\n\r\n", false, true, true, false, false);
43864386 // for (Iterator it = encryptedList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
43874387 for (FCPath fcPath : encryptedList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
43884388 log("\r\n", false, true, true, false, false); }
4389- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4389+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
43904390 }
43914391
43924392 private void newEncryptedLabelOnMouseClicked(MouseEvent event)
43934393 {
4394- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4395- if ( (newEncryptedList != null) && (newEncryptedList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nNew Encrypted Files:\r\n\r\n", false, true, true, false, false);
4394+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4395+ if ( (newEncryptedList != null) && (newEncryptedList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nNew Encrypted Files:\r\n\r\n", false, true, true, false, false);
43964396 // for (Iterator it = newEncryptedList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
43974397 for (FCPath fcPath : newEncryptedList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
43984398 log("\r\n", false, true, true, false, false); }
4399- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4399+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
44004400 }
44014401
44024402 @FXML
44034403 private void unencryptableLabelOnMouseClicked(MouseEvent event)
44044404 {
4405- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4406- if ( (unencryptableList != null) && (unencryptableList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nUnencryptable Files:\r\n\r\n", false, true, true, false, false);
4405+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4406+ if ( (unencryptableList != null) && (unencryptableList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nUnencryptable Files:\r\n\r\n", false, true, true, false, false);
44074407 // for (Iterator it = unencryptableList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
44084408 for (FCPath fcPath : unencryptableList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
44094409 log("\r\n", false, true, true, false, false); }
4410- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4410+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
44114411 }
44124412
44134413 private void newDecryptedLabelOnMouseClicked(MouseEvent event)
44144414 {
4415- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4416- if ( (newDecryptedList != null) && (newDecryptedList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nNew Decrypted Files:\r\n\r\n", false, true, true, false, false);
4415+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4416+ if ( (newDecryptedList != null) && (newDecryptedList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nNew Decrypted Files:\r\n\r\n", false, true, true, false, false);
44174417 // for (Iterator it = newDecryptedList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } log("\r\n", false, true, true, false, false); }
44184418 for (FCPath fcPath : newDecryptedList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
44194419 log("\r\n", false, true, true, false, false); }
4420- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4420+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
44214421 }
44224422
44234423 @FXML
44244424 private void undecryptableLabelOnMouseClicked(MouseEvent event)
44254425 {
4426- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4427- if ( (undecryptableList != null) && (undecryptableList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nUndecryptable Files:\r\n\r\n", false, true, true, false, false);
4426+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4427+ if ( (undecryptableList != null) && (undecryptableList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nUndecryptable Files:\r\n\r\n", false, true, true, false, false);
44284428 // for (Iterator it = undecryptableList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
44294429 for (FCPath fcPath : undecryptableList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
44304430 log("\r\n", false, true, true, false, false); }
4431- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4431+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
44324432 }
44334433
44344434 @FXML
44354435 private void invalidFilesLabelOnMouseClicked(MouseEvent event)
44364436 {
4437- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4438- if ( (invalidFilesList != null) && (invalidFilesList.size() > 0) ) { new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nInvalid Files:\r\n\r\n", false, true, true, false, false);
4437+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4438+ if ( (invalidFilesList != null) && (invalidFilesList.size() > 0) ) { new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("\r\nInvalid Files:\r\n\r\n", false, true, true, false, false);
44394439 // for (Iterator it = invalidFilesList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
44404440 for (FCPath fcPath : invalidFilesList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }
44414441 log("\r\n", false, true, true, false, false); }
4442- else { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
4442+ else { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC);}
44434443 }
44444444
44454445 private void supportButtonOnAction(ActionEvent event)
44464446 {
4447- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4448- new Sound().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC);
4447+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4448+ new AudioPlayer().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC);
44494449 openSupport("supportButtonOnAction",selectedLocale, false);
44504450 }
44514451
@@ -4614,7 +4614,7 @@ public class GUIFX extends Application implements UI, Initializable
46144614 public void status(String message) { Platform.runLater(() -> { statusLabel.setText(message.replace("\r\n", "")); }); }
46154615 public void log(String message) { Platform.runLater(() -> { lineCounter++; logTextArea.appendText(message); if (lineCounter > 1000) { logTextArea.setText(message); lineCounter = 0; } }); }
46164616 public void logfile(String message) { Platform.runLater(() -> { try { Files.write(configuration.getLogFilePath(), message.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.APPEND); } catch (IOException ex) { log("Files.write(" + configuration.getLogFilePath() + ")..));", true, true, false, false, false); } }); }
4617- public void errfile(String message) { Platform.runLater(() -> { new Sound().play(this, Audio.SND_ERROR,Audio.AUDIO_CODEC); try { Files.write(configuration.getErrFilePath(), message.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.APPEND); } catch (IOException ex) { log("Files.write(" + configuration.getErrFilePath() + ")..));", true, true, false, false, false); } }); }
4617+ public void errfile(String message) { Platform.runLater(() -> { new AudioPlayer().play(this, Audio.SND_ERROR,Audio.AUDIO_CODEC); try { Files.write(configuration.getErrFilePath(), message.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.APPEND); } catch (IOException ex) { log("Files.write(" + configuration.getErrFilePath() + ")..));", true, true, false, false, false); } }); }
46184618 public void print(String message,boolean err) { if ( ! err ) { System.out.print(message); } else { System.err.print(message); } }
46194619
46204620 public static void main(String[] args) { launch(args); }
@@ -4628,15 +4628,15 @@ public class GUIFX extends Application implements UI, Initializable
46284628 selectLanguage.setVisible(false);
46294629 if (Voice.sound_Is_Enabled) // turn sound off
46304630 {
4631- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4632- new Sound().play(this, Audio.SND_SOUND_DISABLED,Audio.AUDIO_CODEC);
4631+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4632+ new AudioPlayer().play(this, Audio.SND_SOUND_DISABLED,Audio.AUDIO_CODEC);
46334633 setSound(false); prefs.put("Sound", "Disabled"); flushPrefs(prefs);
46344634 }
46354635 else // turn sound on
46364636 {
46374637 setSound(true); prefs.put("Sound", "Enabled"); flushPrefs(prefs);
4638- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4639- new Sound().play(this, Audio.SND_SOUND_ENABLED,Audio.AUDIO_CODEC);
4638+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4639+ new AudioPlayer().play(this, Audio.SND_SOUND_ENABLED,Audio.AUDIO_CODEC);
46404640 }
46414641 }
46424642 else if ((event.getX() > ((userGuidanceLabel.getWidth() / 2) + 45)) && (event.getX() < ((userGuidanceLabel.getWidth() / 2) + 75)) && (event.getY() >= 110) && (event.getY() <= 125)) // V
@@ -4644,14 +4644,14 @@ public class GUIFX extends Application implements UI, Initializable
46444644 selectLanguage.setVisible(false);
46454645 if (Voice.voice_Is_Enabled) // turn voice off
46464646 {
4647- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4647+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
46484648 Voice.play(this, Audio.VOI_VOICE_DISABLED,Audio.AUDIO_CODEC);
46494649 setVoice(false); prefs.put("Voice", "Disabled"); flushPrefs(prefs);
46504650 }
46514651 else // turn voice on
46524652 {
46534653 setVoice(true); prefs.put("Voice", "Enabled"); flushPrefs(prefs);
4654- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4654+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
46554655 Voice.play(this, Audio.VOI_VOICE_ENABLED,Audio.AUDIO_CODEC);
46564656 }
46574657 }
@@ -4662,16 +4662,16 @@ public class GUIFX extends Application implements UI, Initializable
46624662 selectLanguage.getSelectionModel().select(getLanguageName((LanguageList<Language>) languagesList, selectedLanguageCode));
46634663 selectLanguage.scrollTo(getLanguageName((LanguageList<Language>) languagesList, selectedLanguageCode));
46644664 selectLanguage.requestFocus();
4665- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4665+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
46664666 }
46674667 else // Animation
46684668 {
4669- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4669+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
46704670 if (selectLanguage.isVisible()) { selectLanguage.setVisible(false); }
46714671 else
46724672 {
46734673 animation_Is_Enabled = ! animation_Is_Enabled;
4674- if (animation_Is_Enabled) { prefs.put("Animated", "Enabled"); flushPrefs(prefs); new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); load_High_MS_Passed = 0.0; load_Low_MS_Passed = LOAD_LOW_MS_TIMEOUT; } else { prefs.put("Animated", "Disabled"); new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); }
4674+ if (animation_Is_Enabled) { prefs.put("Animated", "Enabled"); flushPrefs(prefs); new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); load_High_MS_Passed = 0.0; load_Low_MS_Passed = LOAD_LOW_MS_TIMEOUT; } else { prefs.put("Animated", "Disabled"); new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); }
46754675 }
46764676 }
46774677 });
@@ -4692,14 +4692,14 @@ public class GUIFX extends Application implements UI, Initializable
46924692 if ( selectLanguage.getSelectionModel().getSelectedItem().equals(name) )
46934693 {
46944694 // test("Matched: " + selectLanguage.getSelectionModel().getSelectedItem().toString() + "\r\n");
4695- if ( this.getClass().getResource("/rdj/language/translation_" + language.iso639_2B + ".properties") != null ) { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); switchLanguage(language.iso639_2B); langOK = true; break outerloop; }
4696- else if ( this.getClass().getResource("/rdj/language/translation_" + language.iso639_2T + ".properties") != null ) { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); switchLanguage(language.iso639_2T); langOK = true; break outerloop; }
4697- else if ( this.getClass().getResource("/rdj/language/translation_" + language.iso639_1 + ".properties") != null ) { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); switchLanguage(language.iso639_1); langOK = true; break outerloop; }
4695+ if ( this.getClass().getResource("/rdj/language/translation_" + language.iso639_2B + ".properties") != null ) { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); switchLanguage(language.iso639_2B); langOK = true; break outerloop; }
4696+ else if ( this.getClass().getResource("/rdj/language/translation_" + language.iso639_2T + ".properties") != null ) { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); switchLanguage(language.iso639_2T); langOK = true; break outerloop; }
4697+ else if ( this.getClass().getResource("/rdj/language/translation_" + language.iso639_1 + ".properties") != null ) { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); switchLanguage(language.iso639_1); langOK = true; break outerloop; }
46984698 }
46994699 }
47004700 }
47014701 }
4702- if (! langOK) { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); switchLanguage("eng"); langOK = true; } // Falling back to english
4702+ if (! langOK) { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); switchLanguage("eng"); langOK = true; } // Falling back to english
47034703 });
47044704 }
47054705
@@ -4709,7 +4709,7 @@ public class GUIFX extends Application implements UI, Initializable
47094709 {
47104710 if (event.getText().matches("[a-zA-Z]"))
47114711 {
4712- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4712+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
47134713 for (String name: getInstalledLanguageNamesList((LanguageList<Language>) languagesList, false))
47144714 {
47154715 // test("name: " + name + " char: " + event.getText().toLowerCase() + " name0: " + name.substring(0, 1).toLowerCase() + "\r\n");
@@ -4723,7 +4723,7 @@ public class GUIFX extends Application implements UI, Initializable
47234723 }
47244724 else if ((event.getCode() == KeyCode.ESCAPE))
47254725 {
4726- new Sound().play(this, Audio.SND_KEYPRESS,Audio.AUDIO_CODEC);
4726+ new AudioPlayer().play(this, Audio.SND_KEYPRESS,Audio.AUDIO_CODEC);
47274727 selectLanguage.setVisible(false);
47284728 }
47294729 else if (
@@ -4732,7 +4732,7 @@ public class GUIFX extends Application implements UI, Initializable
47324732 || (event.getCode() == KeyCode.HOME) || (event.getCode() == KeyCode.END)
47334733 )
47344734 {
4735- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4735+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
47364736 }
47374737 else if (event.getCode() == KeyCode.ENTER)
47384738 {
@@ -4746,14 +4746,14 @@ public class GUIFX extends Application implements UI, Initializable
47464746 {
47474747 if ( selectLanguage.getSelectionModel().getSelectedItem().equals(name) )
47484748 {
4749- if ( this.getClass().getResource("/rdj/language/translation_" + language.iso639_2B + ".properties") != null ) { new Sound().play(this, Audio.SND_KEYPRESS,Audio.AUDIO_CODEC); switchLanguage(language.iso639_2B); langOK = true; break outerloop; }
4750- else if ( this.getClass().getResource("/rdj/language/translation_" + language.iso639_2T + ".properties") != null ) { new Sound().play(this, Audio.SND_KEYPRESS,Audio.AUDIO_CODEC); switchLanguage(language.iso639_2T); langOK = true; break outerloop; }
4751- else if ( this.getClass().getResource("/rdj/language/translation_" + language.iso639_1 + ".properties") != null ) { new Sound().play(this, Audio.SND_KEYPRESS,Audio.AUDIO_CODEC); switchLanguage(language.iso639_1); langOK = true; break outerloop; }
4749+ if ( this.getClass().getResource("/rdj/language/translation_" + language.iso639_2B + ".properties") != null ) { new AudioPlayer().play(this, Audio.SND_KEYPRESS,Audio.AUDIO_CODEC); switchLanguage(language.iso639_2B); langOK = true; break outerloop; }
4750+ else if ( this.getClass().getResource("/rdj/language/translation_" + language.iso639_2T + ".properties") != null ) { new AudioPlayer().play(this, Audio.SND_KEYPRESS,Audio.AUDIO_CODEC); switchLanguage(language.iso639_2T); langOK = true; break outerloop; }
4751+ else if ( this.getClass().getResource("/rdj/language/translation_" + language.iso639_1 + ".properties") != null ) { new AudioPlayer().play(this, Audio.SND_KEYPRESS,Audio.AUDIO_CODEC); switchLanguage(language.iso639_1); langOK = true; break outerloop; }
47524752 }
47534753 }
47544754 }
47554755 }
4756- if (! langOK) { new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); switchLanguage("eng"); langOK = true; } // Falling back to english
4756+ if (! langOK) { new AudioPlayer().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); switchLanguage("eng"); langOK = true; } // Falling back to english
47574757 }
47584758 });
47594759 }
@@ -4786,7 +4786,7 @@ public class GUIFX extends Application implements UI, Initializable
47864786
47874787 @FXML private void pwdFieldOnMouseClicked(MouseEvent event)
47884788 {
4789- new Sound().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC);
4789+ new AudioPlayer().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC);
47904790 ugMessage = new Message(password_enter, 48, false, false, true, false, Voice.VOI_CONFIRM_PASS_WITH_ENTER, 0);
47914791 userGuidanceMessage(ugMessage);
47924792 setFont(pwdField);setFont(pwdtxtField);
@@ -4797,7 +4797,7 @@ public class GUIFX extends Application implements UI, Initializable
47974797 // log("Pass: " + pwdField.getText() + " length: " + pwdField.getText().length() + event.getCode(), true, true, true, false, false);
47984798 if (event.getCode() == KeyCode.ENTER)
47994799 {
4800- new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC);
4800+ new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC);
48014801 passwordHeaderLabel.setText(password_set);
48024802 settingPassword = false;
48034803 tgtFileChooserPropertyCheck(true);
@@ -4818,7 +4818,7 @@ public class GUIFX extends Application implements UI, Initializable
48184818
48194819 @FXML private void pwdtxtFieldOnMouseClicked(MouseEvent event)
48204820 {
4821- new Sound().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC);
4821+ new AudioPlayer().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC);
48224822 ugMessage = new Message(password_enter, 48, false, false, true, false, Voice.VOI_CONFIRM_PASS_WITH_ENTER, 0); userGuidanceMessage(ugMessage);
48234823 setFont(pwdField);setFont(pwdtxtField);
48244824 }
@@ -4827,7 +4827,7 @@ public class GUIFX extends Application implements UI, Initializable
48274827 {
48284828 if (event.getCode() == KeyCode.ENTER)
48294829 {
4830- new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC);
4830+ new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC);
48314831 passwordHeaderLabel.setText(password_set);
48324832 settingPassword = false;
48334833 tgtFileChooserPropertyCheck(true);
@@ -4875,8 +4875,8 @@ public class GUIFX extends Application implements UI, Initializable
48754875 @FXML private void logsLabelOnMouseExited(MouseEvent event) { Platform.runLater(() -> { logsLabel.setTextFill(Color.GREY); }); }
48764876 @FXML private void logsLabelOnMouseClicked(MouseEvent event)
48774877 {
4878- new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4879- new Sound().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
4878+ new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4879+ new AudioPlayer().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
48804880 Thread shareThread; shareThread = new Thread(() ->
48814881 {
48824882 Version.openLogDir(guifx);
@@ -4888,14 +4888,14 @@ public class GUIFX extends Application implements UI, Initializable
48884888
48894889 @FXML private void supportLabelOnMouseClicked(MouseEvent event)
48904890 {
4891- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4892- new Sound().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC);
4891+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
4892+ new AudioPlayer().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC);
48934893 openSupport("supportButtonOnAction",selectedLocale, false);
48944894 }
48954895
48964896 @FXML private void updateLabelOnMouseClicked(MouseEvent event)
48974897 {
4898- Platform.runLater(() -> { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); });
4898+ Platform.runLater(() -> { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); });
48994899 Platform.runLater(() -> { checkUpdate( true ); });
49004900 }
49014901
@@ -4927,7 +4927,7 @@ public class GUIFX extends Application implements UI, Initializable
49274927 @FXML
49284928 private void commandLabelOnMouseClicked(MouseEvent event)
49294929 {
4930- new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("Command-line (DOS Prompt / Terminal) command:\r\n\r\n", false, true, false, false, false);
4930+ new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); tab.getSelectionModel().select(1); log("Command-line (DOS Prompt / Terminal) command:\r\n\r\n", false, true, false, false, false);
49314931 log(Command.getCommandLine(!encryptButton.isDisabled(), !decryptButton.isDisabled()) + "\r\n", false, true, false, false, false);
49324932 }
49334933 }
\ No newline at end of file
--- a/src/rdj/Sound.java
+++ /dev/null
@@ -1,210 +0,0 @@
1-/*
2- * CC BY-NC-ND 4.0 2017 Ron de Jong (ron@finalcrypt.org)
3- *
4- * This is free software; you can redistribute it
5- * under the terms of the Creative Commons License
6- * Creative Commons License: (CC BY-NC-ND 4.0) as published by
7- * https://creativecommons.org/licenses/by-nc-nd/4.0/ either
8- * version 4.0 of the License, or (at your option) any later version.
9- *
10- * This software is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13- * Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
14- * International Public License for more details.
15- *
16- * You should have received a copy called: "LICENSE" of the
17- * Creative Commons Public License along with this software;
18- */
19-
20-package rdj;
21-
22-import java.io.*;
23-import java.net.*;
24-import javafx.application.*;
25-import javafx.scene.media.*;
26-import javax.sound.sampled.*;
27-
28-public class Sound extends Audio
29-{
30- public AudioClip audioClipSounds;
31- public AudioClip audioClipVoice;
32-
33- private AudioInputStream audioInputStreamSounds;
34- private AudioInputStream audioInputStreamVoice;
35- private Clip clipSounds;
36- private Clip clipVoice;
37-
38- synchronized public void play(UI ui, String audio, int audio_codec)
39- {
40- Media media;
41- switch (audio_codec)
42- {
43- case WAV: media = new Media(this.getClass().getResource(audio + ".wav").toExternalForm()); break;
44- case OGG: media = new Media(this.getClass().getResource(audio + ".ogg").toExternalForm()); break;
45- case AIFF: media = new Media(this.getClass().getResource(audio + ".aiff").toExternalForm()); break;
46- case MP3: media = new Media(this.getClass().getResource(audio + ".mp3").toExternalForm()); break;
47- default: media = new Media(this.getClass().getResource(audio + ".wav").toExternalForm()); break;
48- }
49-
50- if (
51- ((media.getSource().contains("sounds")) && ((sound_Is_Enabled)))
52- || ((media.getSource().contains("voice")) && ((voice_Is_Enabled)))
53- )
54- {
55-// playJavaX(ui, media, audio_codec); // Stops playing spontaniously on all OSes
56- playJavaFX(ui, media, audio_codec); // Plays fast, but crashes often on Linux (libld.so native player issue)
57- }
58- }
59-
60- synchronized public void playJavaX(UI ui, Media media, int audio_codec) // javax.sound.sampled.AudioSystem
61- {
62-// Thread playThread = new Thread(() ->
63-// {
64- if (media != null)
65- {
66- if (media.getSource().contains("sounds")) // Just to keep playing ClipSounds parallel over ClipVoice
67- {
68- if (sound_Is_Enabled)
69- {
70- try { audioInputStreamSounds = AudioSystem.getAudioInputStream(new URL(media.getSource())); }
71- catch (UnsupportedAudioFileException ex) { ui.log("Error: UnsupportedAudioFileException " + Sound.class.getSimpleName() + ".play(..) AudioSystem.getAudioInputStream(" + media.getSource() + " " + ex.getMessage() + " \r\n", true, true, true, true, false); }
72- catch (IOException ex) { ui.log("Error: IOException " + Sound.class.getSimpleName() + ".play(..) AudioSystem.getAudioInputStream(" + media.getSource() + " " + ex.getMessage() + " \r\n", true, true, true, true, false); }
73-
74- clipSounds = null; try { clipSounds = AudioSystem.getClip(); } catch (LineUnavailableException ex)
75- { ui.log("Error: LineUnavailableException " + Sound.class.getSimpleName() + ".play(..).AudioSystem.getClip() " + ex.getMessage() + " \r\n", true, true, true, true, false); }
76-
77- try { clipSounds.open(audioInputStreamSounds); }
78- catch (LineUnavailableException ex) { clipSounds.close(); clipSounds = null; ui.log("Error: LineUnavailableException " + Sound.class.getSimpleName() + ".play(..).clipSounds.open(" + media.getSource() + ") " + ex.getMessage() + " \r\n", true, true, true, false, false); }
79- catch (IOException ex) { clipSounds.close(); clipSounds = null; ui.log("Error: IOException " + Sound.class.getSimpleName() + ".play(..).clipSounds.open(" + media.getSource() + ") " + ex.getMessage() + " \r\n", true, true, true, false, false); }
80-
81- if ( clipSounds != null )
82- {
83- clipSounds.start();
84- try { audioInputStreamSounds.close(); } catch (IOException ex) { ui.log("Error: IOException " + Sound.class.getSimpleName() + ".play(..).audioInputStreamSounds.close() " + ex.getMessage() + " \r\n", true, true, true, false, false); }
85- }
86- else
87- {
88- try { audioInputStreamSounds.close(); } catch (IOException ex) { ui.log("Error: IOException " + Sound.class.getSimpleName() + ".play(..).audioInputStreamSounds.close() " + ex.getMessage() + " \r\n", true, true, true, false, false); }
89- }
90- // test(" " + clipSounds.isOpen() + "\r\n");
91- }
92- }
93- else if ( media.getSource().contains("voice") )
94- {
95- if (voice_Is_Enabled)
96- {
97- if ((clipVoice != null) && ( clipVoice.isOpen() )) // new voice stopping currently playing voice
98- {
99- clipVoice.stop(); try { audioInputStreamVoice.close(); } catch (IOException ex) { ui.log("Error: IOException audioIn.close() " + ex.getMessage() + " \r\n", true, true, true, true, false); }
100- }
101- try { audioInputStreamVoice = AudioSystem.getAudioInputStream(new URL(media.getSource())); }
102- catch (UnsupportedAudioFileException ex) { ui.log("Error: UnsupportedAudioFileException play(..) AudioSystem.getAudioInputStream(" + media.getSource() + " " + ex.getMessage() + " \r\n", true, true, true, true, false); }
103- catch (IOException ex) { ui.log("Error: IOException " + Sound.class.getSimpleName() + ".play(..) AudioSystem.getAudioInputStream(" + media.getSource() + " " + ex.getMessage() + " \r\n", true, true, true, true, false); }
104-
105- clipVoice = null; try { clipVoice = AudioSystem.getClip(); } catch (LineUnavailableException ex) { ui.log("Error: LineUnavailableException " + Sound.class.getSimpleName() + ".play(..).AudioSystem.getClip() " + ex.getMessage() + " \r\n", true, true, true, true, false); }
106-
107- try { clipVoice.open(audioInputStreamVoice); }
108- catch (LineUnavailableException ex) { clipVoice.close(); clipVoice = null; ui.log("Error: LineUnavailableException " + Sound.class.getSimpleName() + ".play(..).clipVoice.open(" + media.getSource() + ") " + ex.getMessage() + " \r\n", true, true, true, false, false); }
109- catch (IOException ex) { clipVoice.close(); clipVoice = null; ui.log("Error: IOException " + Sound.class.getSimpleName() + ".play(..).clipVoice.open(" + media.getSource() + ") " + ex.getMessage() + " \r\n", true, true, true, false, false); }
110-
111- if ( clipVoice != null )
112- {
113- clipVoice.start();
114- try { audioInputStreamVoice.close(); } catch (IOException ex) { ui.log("Error: IOException " + Sound.class.getSimpleName() + ".play(..).audioInputStreamVoice.close() " + ex.getMessage() + " \r\n", true, true, true, false, false); }
115- }
116- else
117- {
118- try { audioInputStreamVoice.close(); } catch (IOException ex) { ui.log("Error: IOException " + Sound.class.getSimpleName() + ".play(..).audioInputStreamVoice.close() " + ex.getMessage() + " \r\n", true, true, true, false, false); }
119- }
120- // test(" " + clipVoice.isOpen() + "\r\n");
121- }
122- }
123- else { ui.log("Alert: " + Sound.class.getSimpleName() + ".play(" + media.getSource() + ") not recognized!\r\n", true, true, true, true, false); }
124- }
125-// });
126-// playThread.setName("playThread");
127-// playThread.setDaemon(true);
128-// playThread.start();
129- }
130-
131- synchronized public void playJavaFX(UI ui, Media media, int audio_codec) // javafx.scene.media.AudioClip
132- {
133-// Thread playThread = new Thread(() ->
134-// {
135- if (media != null)
136- {
137- if ( (media.getSource().contains("sounds")) ) // new sound added to any other audio playing
138- {
139- if (sound_Is_Enabled)
140- {
141- Platform.runLater(new Runnable(){ @Override public void run()
142- {
143- if (media != null)
144- {
145- if ( media.getSource().contains("sounds") )
146- {
147- Thread playSoundThread = new Thread(() ->
148- {
149- if (sound_Is_Enabled) { audioClipSounds = new AudioClip(media.getSource()); audioClipSounds.play(); /*(" " + play.isPlaying() + "\r\n");*/ }
150- });
151- playSoundThread.setName("playSoundThread");
152- playSoundThread.setDaemon(true);
153- playSoundThread.start();
154- }
155- else if ( media.getSource().contains("voice") )
156- {
157- if ( voice_Is_Enabled)
158- {
159- if ( (audioClipVoice != null) && ( audioClipVoice.isPlaying() )) { audioClipVoice.stop(); }
160- audioClipVoice = new AudioClip(media.getSource()); audioClipVoice.play(); /*test(" " + play.isPlaying() + "\r\n");*/
161- }
162- }
163- else { ui.log("Alert: play(" + media.getSource() + ") not recognized!\r\n", true, true, true, true, false); }
164- }
165- }});
166- }
167- }
168- else if ( media.getSource().contains("voice") )
169- {
170- if (voice_Is_Enabled)
171- {
172- if ((audioClipSounds != null) && ( audioClipSounds.isPlaying() )) // new voice stopping currently playing voice
173- {
174- audioClipSounds.stop();
175- }
176- Platform.runLater(new Runnable(){ @Override public void run()
177- {
178- if (media != null)
179- {
180- if ( media.getSource().contains("sounds") )
181- {
182- Thread playVoiceThread = new Thread(() ->
183- {
184- if (sound_Is_Enabled) { audioClipSounds = new AudioClip(media.getSource()); audioClipSounds.play(); /*(" " + play.isPlaying() + "\r\n");*/ }
185- });
186- playVoiceThread.setName("playVoiceThread");
187- playVoiceThread.setDaemon(true);
188- playVoiceThread.start();
189- }
190- else if ( media.getSource().contains("voice") )
191- {
192- if ( voice_Is_Enabled)
193- {
194- if ( (audioClipVoice != null) && ( audioClipVoice.isPlaying() )) { audioClipVoice.stop(); }
195- audioClipVoice = new AudioClip(media.getSource()); audioClipVoice.play(); /*test(" " + play.isPlaying() + "\r\n");*/
196- }
197- }
198- else { ui.log("Alert: play(" + media.getSource() + ") not recognized!\r\n", true, true, true, true, false); }
199- }
200- }});
201- }
202- }
203- else { ui.log("Alert: " + Sound.class.getSimpleName() + ".play(" + media.getSource() + ") not recognized!\r\n", true, true, true, true, false); }
204- }
205-// });
206-// playThread.setName("playThread");
207-// playThread.setDaemon(true);
208-// playThread.start();
209- }
210-}
--- a/src/rdj/Support.java
+++ b/src/rdj/Support.java
@@ -179,8 +179,8 @@ public class Support extends Application implements Initializable
179179
180180 @FXML private void facebookImageViewOnMouseClicked(MouseEvent event)
181181 {
182- new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
183- new Sound().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
182+ new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
183+ new AudioPlayer().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
184184 // play(SND_OPEN,Audio.AUDIO_CODEC);
185185 Thread shareThread; shareThread = new Thread(() ->
186186 {
@@ -202,8 +202,8 @@ public class Support extends Application implements Initializable
202202
203203 @FXML private void twitterImageViewOnMouseClicked(MouseEvent event)
204204 {
205- new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
206- new Sound().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
205+ new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
206+ new AudioPlayer().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
207207 Thread shareThread; shareThread = new Thread(() ->
208208 {
209209 String urlTarget = "https://twitter.com/intent/tweet";
@@ -226,8 +226,8 @@ public class Support extends Application implements Initializable
226226
227227 @FXML private void linkedInImageViewOnMouseClicked(MouseEvent event)
228228 {
229- new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
230- new Sound().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
229+ new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
230+ new AudioPlayer().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
231231 Thread shareThread; shareThread = new Thread(() ->
232232 {
233233 //
@@ -251,8 +251,8 @@ public class Support extends Application implements Initializable
251251
252252 @FXML private void pinterestImageViewOnMouseClicked(MouseEvent event)
253253 {
254- new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
255- new Sound().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
254+ new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
255+ new AudioPlayer().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
256256 Thread shareThread; shareThread = new Thread(() ->
257257 {
258258 String urlTarget = "https://pin.it/72kLWc2";
@@ -315,8 +315,8 @@ public class Support extends Application implements Initializable
315315
316316 @FXML private void homeImageViewOnMouseClicked(MouseEvent event)
317317 {
318- new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
319- new Sound().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
318+ new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
319+ new AudioPlayer().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
320320 Thread homeOpenThread; homeOpenThread = new Thread(() -> { Version.openWebSite(guifx, Version.HOMEPAGEURLSTRINGARRAY,"GET"); closeWindow(); });
321321 homeOpenThread.setName("homeOpenThread");
322322 homeOpenThread.setDaemon(true);
@@ -325,8 +325,8 @@ public class Support extends Application implements Initializable
325325
326326 @FXML private void videoImageViewOnMouseClicked(MouseEvent event)
327327 {
328- new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
329- new Sound().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
328+ new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
329+ new AudioPlayer().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
330330 Thread videoOpenThread; videoOpenThread = new Thread(() -> { Version.openWebSite(guifx, Version.VIDEOPAGEURLSTRINGARRAY,"HEAD"); closeWindow(); });
331331 videoOpenThread.setName("videoOpenThread");
332332 videoOpenThread.setDaemon(true);
@@ -335,8 +335,8 @@ public class Support extends Application implements Initializable
335335
336336 @FXML private void supportImageViewOnMouseClicked(MouseEvent event)
337337 {
338- new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
339- new Sound().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
338+ new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
339+ new AudioPlayer().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
340340 Thread supportOpenThread; supportOpenThread = new Thread(() -> { Version.openWebSite(guifx, Version.SUPPORTPAGEURLSTRINGARRAY,"GET"); closeWindow(); });
341341 supportOpenThread.setName("supportOpenThread");
342342 supportOpenThread.setDaemon(true);
@@ -345,8 +345,8 @@ public class Support extends Application implements Initializable
345345
346346 @FXML private void emailImageViewOnMouseClicked(MouseEvent event)
347347 {
348- new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
349- new Sound().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
348+ new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC);
349+ new AudioPlayer().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC);
350350
351351 String to = Version.SUPPORTEMAIL;
352352 String cc = "";
--- /dev/null
+++ b/src/rdj/TypeWriter.java
@@ -0,0 +1,221 @@
1+/*
2+ * Copyright © 2017 Ron de Jong (ron@finalcrypt.org)
3+ *
4+ * This is free software; you can redistribute it
5+ * under the terms of the Creative Commons License
6+ * Creative Commons License: (CC BY-NC-ND 4.0) as published by
7+ * https://creativecommons.org/licenses/by-nc-nd/4.0/ either
8+ * version 4.0 of the License, or (at your option) any later version.
9+ *
10+ * This software is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
14+ * International Public License for more details.
15+ *
16+ * You should have received a copy called: "LICENSE" of the
17+ * Creative Commons Public License along with this software;
18+ */
19+package rdj;
20+
21+import java.nio.file.*;
22+import java.util.*;
23+
24+public class TypeWriter implements UI
25+{
26+// Usage: typewriter.bash "text to write" [min_delay_ms] [max_delay_ms]
27+
28+ private Version version;
29+ private UI ui;
30+ private String text = "This is a test € é";
31+ private String sound = "20";
32+ private boolean soundstate;
33+ private int mindelay = 20;
34+ private boolean minset = false;
35+ private int maxdelay = 100;
36+ private boolean maxset = false;
37+ private Random random;
38+ private int seq;
39+ private int randomDelay;
40+
41+ public TypeWriter()
42+ {
43+ this.ui = this;
44+ text="";
45+ sound="20";
46+ random = new Random();
47+ version = new Version(this);
48+ version.checkLocalVersion(this);
49+ }
50+
51+// Command line parameter setting
52+ public TypeWriter(String[] args)
53+ {
54+ this();
55+
56+ if ( args.length == 0 ) { usage("Error: no parameters",true); }
57+ for (int p=0; p < args.length; p++)
58+ {
59+// Options
60+ if ( args[p].equals("-h")) { usage("",false); }
61+ else if ( args[p].equals("-t")) { if (p+1 < args.length) { text = reformat(args[p+1]); p++; } else { usage("Error: param -t \"value\" missing!",true); } }
62+ else if ( args[p].equals("-s")) { if (p+1 < args.length) { sound = args[p+1]; p++; } else { usage("Error: param -s \"value\" missing!",true); } }
63+ else if ( args[p].equals("-min")) { if (p+1 < args.length) { if (isInt(args[p+1])) { mindelay = Integer.parseInt(args[p+1]); minset = true; } else { usage("Error: param -min " + args[p+1] + " invalid",false); } p++; } else { usage("Error: param -min \"value\" missing!",true); } }
64+ else if ( args[p].equals("-max")) { if (p+1 < args.length) { if (isInt(args[p+1])) { maxdelay = Integer.parseInt(args[p+1]); maxset = true; } else { usage("Error: param -max " + args[p+1] + " invalid",false); } p++; } else { usage("Error: param -max \"value\" missing!",true); } }
65+ else { usage("Error: invalid parameter: " + args[p] + "\r\n", true); }
66+ }
67+
68+ if ((!minset) && (!maxset)) { mindelay = 20; maxdelay = 100; }
69+ else if ((!minset) && ( maxset)) { mindelay = 1; }
70+ else if (( minset) && (!maxset)) { maxdelay = mindelay; }
71+
72+ if (isInt(sound)) { if (Integer.parseInt(sound) >= Audio.soundArray.length) { usage("Error: sound: " + sound + " not available\r\n\r\n" + Audio.getSounds() + "", true); } }
73+
74+ write(sound);
75+ }
76+
77+// Internal parameter settings
78+ public TypeWriter(String text) { this(); this.text = text; write(sound); }
79+ public TypeWriter(String text, int min_delay_ms) { this(); this.text = text; this.mindelay = min_delay_ms; this.maxdelay = 0; write(""); }
80+ public TypeWriter(String text, int min_delay_ms, int max_delay_ms) { this(); this.text = text; this.mindelay = min_delay_ms; this.maxdelay = max_delay_ms; write(""); }
81+ public TypeWriter(String text, int min_delay_ms, int max_delay_ms, String sound) { this(); this.text = text; this.mindelay = min_delay_ms; this.maxdelay = max_delay_ms; write(sound); }
82+
83+ private void delay()
84+ {
85+ if (( mindelay > 0 ) && ( maxdelay > mindelay ))
86+ {
87+ randomDelay = (random.nextInt((maxdelay + 1) - mindelay) + mindelay);
88+ try { Thread.sleep(randomDelay); } catch (InterruptedException ex) {System.out.println(ex.getMessage());}
89+ }
90+ else if ( mindelay > 0) { try { Thread.sleep(mindelay); } catch (InterruptedException ex) {System.out.println(ex.getMessage());} }
91+ else if ( maxdelay > mindelay) { try { Thread.sleep(mindelay + 1); } catch (InterruptedException ex) {System.out.println(ex.getMessage());} }
92+ else { }
93+ }
94+
95+// sound param is an internal file or external file
96+ private void write(String soundParam) // "", "num",
97+ {
98+ soundstate = AudioPlayer.sound_Is_Enabled; AudioPlayer.sound_Is_Enabled = true;
99+
100+ String sound = Audio.SND_TYPEWRITE;
101+ int codec = Audio.AIFF;
102+
103+ if (soundParam.length() == 0)
104+ {
105+ sound = Audio.SND_TYPEWRITE;
106+ codec = Audio.AIFF;
107+ }
108+ else
109+ {
110+ if (isInt(soundParam)) // sound is a num
111+ {
112+ if (!soundParam.equals("-1"))
113+ {
114+ sound = Audio.getSound(Integer.parseInt(soundParam));
115+ codec = Audio.AIFF;
116+ } else { sound = soundParam; }
117+ }
118+ else // Sound probably is a file
119+ {
120+ if (Files.exists(Paths.get(soundParam))) { sound = soundParam; } else { usage("Error: soundfile: " + soundParam + " dos not exist!", true); }
121+ }
122+ }
123+
124+ AudioPlayer player = new AudioPlayer();
125+ for(seq = 0; seq<text.length(); seq++)
126+ {
127+ System.out.print(text.charAt(seq));
128+// if (text.subSequence(seq, seq+1).equals("\n")) { player.play(this, Audio.SND_ALARM, codec); }
129+ if (( text.length() > 0) && ( mindelay + maxdelay != 0) && (!text.subSequence(seq, seq+1).equals("\r"))) { if ( sound.startsWith("/rdj/audio/") ) { player.play(this, sound, codec); } else { player.playAudioClipFile(this, sound); } }
130+ if (( mindelay + maxdelay != 0) && (!text.subSequence(seq, seq+1).equals("\r"))) { delay(); }
131+ }
132+// if (( text.length() > 0) && (! text.equals("\n"))) { if ( sound.startsWith("/rdj/audio/") ) { player.play(this, sound, codec); } else { player.playAudioClipFile(this, sound); } }
133+ if ( mindelay + maxdelay != 0) { delay(); }
134+
135+ if (( player != null ) && ( player.audioClip != null)) { while ( player.audioClip.isPlaying() ) { try { Thread.sleep(100); } catch (InterruptedException ex) {System.out.println(ex.getMessage());} } }
136+
137+ AudioPlayer.sound_Is_Enabled = soundstate;
138+ }
139+
140+ private boolean isInt(String text) { try { Integer.parseInt(text); return true;} catch (NumberFormatException e) { return false; } }
141+
142+ private static String reformat(String text) { return text.replace("\\t", "\t").replace("\\b", "\b").replace("\\n", "\n").replace("\\r", "\r").replace("\\f", "\f"); }
143+
144+ public static void main(String[] args) { new TypeWriter(args); }
145+
146+ protected void usage(String errorMessage, boolean error)
147+ {
148+ if ( errorMessage.length() > 0 )
149+ {
150+ log("\r\n", false, true, false, false, false);
151+ log(errorMessage + "\r\n", false, true, false, false, false);
152+ }
153+
154+ new TypeWriter("\r\n", 0, 0);
155+ new TypeWriter("Print to screen like a typewriter\r\n");
156+ new TypeWriter("\r\n", 0, 0);
157+ new TypeWriter("Usage: java -cp finalcrypt.jar rdj/TypeWriter -t \"text to write\" [-s sound-nr|\"file\"] [-min delay_ms] [-max delay_ms]\r\n",0,0);
158+ new TypeWriter("\r\n", 0, 0);
159+ new TypeWriter("Examples\r\n",0,0);
160+ new TypeWriter("\r\n",0,0);
161+ new TypeWriter("java -cp finalcrypt.jar rdj/TypeWriter -t \"type at steady pace\" -min 100;\t\t",0,0);new TypeWriter(" # type at steady pace\r\n",100);
162+ new TypeWriter("java -cp finalcrypt.jar rdj/TypeWriter -t \"type at random pace\" -min 20 -max 100;\t",0,0);new TypeWriter(" # type at random pace\r\n",20,100);
163+ new TypeWriter("java -cp finalcrypt.jar rdj/TypeWriter -t \"\" -min 1000;\t\t\t\t\t # just pause 1000 ms",0,0); new TypeWriter("",1000); new TypeWriter("\r\n",0);
164+ new TypeWriter("java -cp finalcrypt.jar rdj/TypeWriter -t \"\\n\" -min 1000 ;\t\t\t\t # newline with pause",0,0); new TypeWriter("\r\n",0,0);
165+ new TypeWriter("\r\n",0,0);
166+ new TypeWriter("java -cp finalcrypt.jar rdj/TypeWriter -t \"built-in sound\" -s 8 -min 20 -max 100;\t",0,0);new TypeWriter(" # built-in sound\r\n",20,100,"8");
167+ new TypeWriter("java -cp finalcrypt.jar rdj/TypeWriter -t \"ext sound file\" -s file.wav -min 20 -max 100;",0,0);new TypeWriter(" # ext sound file\r\n",20,100,"2");
168+ new TypeWriter("\r\n");
169+ System.exit(error ? 1 : 0);
170+ }
171+
172+ @Override public void test(String message) { log(message, true, true, false, false, false); }
173+
174+ @Override
175+ synchronized public void log(String message, boolean status, boolean log, boolean logfile, boolean errfile, boolean print)
176+ {
177+ if ((!status) && (!log)) { }
178+ else if ((!status) && ( log)) { log(message,errfile); }
179+ else if (( status) && (!log)) { }
180+ else if (( status) && ( log)) { log(message,errfile); }
181+ if (logfile) { logfile(message); }
182+ if (errfile) { errfile(message); }
183+ if (print) { print(message,errfile); }
184+ }
185+
186+ public void status(String message) { }
187+ public void log(String message, boolean err) { if ( ! err ) { System.out.print(message); } else { System.err.print(message); } }
188+ public void logfile(String message) { }
189+ public void errfile(String message) { }
190+ public void print(String message, boolean err) { if ( ! err ) { System.out.print(message); } else { System.err.print(message); } }
191+
192+ @Override
193+ public void processGraph(int value)
194+ {
195+ }
196+
197+ @Override
198+ public void processProgress(int filesProgressPercent, int fileProgressPercent, long bytesTotalParam, long bytesProcessedParam, double bytesPerMiliSecondParam)
199+ {
200+ }
201+
202+ @Override
203+ public void fileProgress()
204+ {
205+ }
206+
207+ @Override
208+ public void processFinished(FCPathList<FCPath> openFCPathList, boolean open)
209+ {
210+ }
211+
212+ @Override
213+ public void processStarted()
214+ {
215+ }
216+
217+ @Override
218+ public void buildReady(FCPathList<FCPath> fcPathListParam, boolean validBuild)
219+ {
220+ }
221+}
--- a/src/rdj/VERSION
+++ b/src/rdj/VERSION
@@ -1 +1 @@
1-6.5.0
\ No newline at end of file
1+6.6.0
\ No newline at end of file
--- a/src/rdj/VERSION2
+++ b/src/rdj/VERSION2
@@ -1,4 +1,4 @@
1-[Version] = {6.5.0}
1+[Version] = {6.6.0}
22 [] = {} ================================================================
33 [Release Notes] = {You are using a very old version of FinalCrypt}
44 [Release Message] = {Please visit the website & download the latest}
@@ -12,17 +12,20 @@
1212 [Version Notes] = {Improved User Interface & File Manager behavior}
1313 [Version Notes] = {Improved UserGuidance, Display & Button Layout}
1414 [] = {} ----------------------------------------------------------------
15-[Upgrade Notes] = {Upgrade 5 (2020-11-02)}
15+[Upgrade Notes] = {Upgrade 6 (2021-01-02)}
1616 [Upgrade Notes] = {}
17-[Upgrade Notes] = {Upgraded the Java Runtime Engine to version 1.8.0-271}
18-[Upgrade Notes] = {This update improves overal performance and security!}
19-[Upgrade Notes] = {A portable FinalCrypt version for Apple OSX was added}
17+[Upgrade Notes] = {A typewriter was added to help command-line tutors}
18+[Upgrade Notes] = {The typewriter prints to screen like a human types}
19+[Upgrade Notes] = {}
20+[Upgrade Notes] = {We learn better when we see a moving mouse pointer}
21+[Upgrade Notes] = {We also learn better by seeing typed command-lines}
22+[Upgrade Notes] = {}
23+[Upgrade Notes] = {This typewriter can be used for any scripting demo}
2024
2125 [] = {} ----------------------------------------------------------------
22-[Update Notes] = {Update 0 (2020-11-11)}
26+[Update Notes] = {Update 0 (2021-01-02)}
2327 [Update Notes] = {}
24-[Update Notes] = {* Please don't look away FinalCrypt needs your help *}
25-[Update Notes] = {* Please help by sharing FinalCrypt on Social Media *}
28+[Update Notes] = {No update, only upgrade}
2629 [] = {} --------------------------------------------------------------------------------------------------------
2730 [Alert Subject_] = {}
2831 [Alert Notes_] = {}
--- a/src/rdj/Version.java
+++ b/src/rdj/Version.java
@@ -484,23 +484,31 @@ public class Version
484484 {
485485 String userAgent = getUserAgent("(HTTP)");
486486
487+// URL
487488 URL url = null;
488489 try { url = new URL(urlString); } catch (MalformedURLException ex) { checkOnlineFailed = true; ui.log("Error: httpGetRequest MalformedURLException: new URL(" + urlString +") (URL Typo?)\r\n", false, true, true, true, false); return null; }
489490 if (url == null) { checkOnlineFailed = true; ui.log("Error: httpGetRequest InvalidURL: url = new URL(" + urlString +"); (URL Typo?)\r\n", false, true, true, true, false); return null; }
490- HttpURLConnection httpConnection = null;
491- try { httpConnection = (HttpURLConnection) url.openConnection(); } catch (IOException ex){ checkOnlineFailed = true; ui.log("Error: httpGetRequest IOException: url.openConnection(): " + ex.getMessage() + "\r\n", false, true, true, true, false); return null; }
492- httpConnection.setConnectTimeout(HTTP_CONNECT_TIMEOUT);
493- httpConnection.setReadTimeout(HTTP_CONNECT_TIMEOUT);
494- try { httpConnection.setRequestMethod(requestMethod); } catch (ProtocolException ex) { checkOnlineFailed = true; ui.log("Error: httpGetRequest ProtocolException: httpConnection.setRequestMethod(\"GET\"): " + ex.getMessage() + "\r\n", false, true, true, true, false); return null; }
495- httpConnection.setRequestProperty("User-Agent", userAgent);
491+
492+// Connect
493+ HttpURLConnection httpURLConnection = null;
494+ try { httpURLConnection = (HttpURLConnection) url.openConnection(); }
495+ catch (IOException ex){ checkOnlineFailed = true; ui.log("Error: httpGetRequest IOException: url.openConnection(): " + ex.getMessage() + "\r\n", false, true, true, true, false); return null; }
496+
497+// Connection Settings
498+ httpURLConnection.setConnectTimeout(HTTP_CONNECT_TIMEOUT);
499+ httpURLConnection.setReadTimeout(HTTP_CONNECT_TIMEOUT);
500+ httpURLConnection.setRequestProperty("User-Agent", userAgent);
501+ try { httpURLConnection.setRequestMethod(requestMethod); }
502+ catch (ProtocolException ex) { checkOnlineFailed = true; ui.log("Error: httpGetRequest ProtocolException: httpConnection.setRequestMethod(\"GET\"): " + ex.getMessage() + "\r\n", false, true, true, true, false); return null; }
496503
497- int responseCode = 0;
498- try { responseCode = httpConnection.getResponseCode(); } catch (IOException ex) {checkOnlineFailed = true; ui.log("Error: httpGetRequest IOException: httpConnection.getResponseCode(): " + ex.getMessage() + "\r\n", false, true, true, true, false); return null; }
504+// ResponseCodes
505+ int responseCode = 0;
506+ try { responseCode = httpURLConnection.getResponseCode(); } catch (IOException ex) {checkOnlineFailed = true; ui.log("Error: httpGetRequest IOException: httpConnection.getResponseCode(): " + ex.getMessage() + "\r\n", false, true, true, true, false); return null; }
499507
500508 if ((responseCode >= 200) && (responseCode < 400))
501509 {
502510 BufferedReader responseReader = null;
503- try { responseReader = new BufferedReader(new InputStreamReader(httpConnection.getInputStream())); } catch (IOException ex) { checkOnlineFailed = true; ui.log("Error: httpGetRequest IOException: new InputStreamReader(httpConnection.getInputStream()): " + ex.getMessage() + "\r\n", false, true, true, true, false); return null; }
511+ try { responseReader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream())); } catch (IOException ex) { checkOnlineFailed = true; ui.log("Error: httpGetRequest IOException: new InputStreamReader(httpConnection.getInputStream()): " + ex.getMessage() + "\r\n", false, true, true, true, false); return null; }
504512
505513 String responseLine;
506514 StringBuffer response = new StringBuffer();
@@ -511,7 +519,7 @@ public class Version
511519 } } catch (IOException ex) { checkOnlineFailed = true; ui.log("Error: httpGetRequest IOException: responseReader.readLine(): " + ex.getMessage() + "\r\n", false, true, true, true, false); }
512520 try { responseReader.close(); } catch (IOException ex) { checkOnlineFailed = true; ui.log("Error: httpGetRequest IOException: responseReader.close(): " + ex.getMessage() + "\r\n", false, true, true, true, false); }
513521
514- httpConnection.disconnect();
522+ httpURLConnection.disconnect();
515523
516524 return response.toString();
517525 } else { checkOnlineFailed = true; ui.log("Error: httpGetRequest HTTP Response Code: " + responseCode + "\r\n", false, true, true, true, false); }
@@ -522,37 +530,45 @@ public class Version
522530 {
523531 String userAgent = getUserAgent("(HTTPS)");
524532
533+// URL
525534 URL url = null;
526535 try { url = new URL(urlString); } catch (MalformedURLException ex) { checkOnlineFailed = true; ui.log("Error: MalformedURLException: new URL(" + urlString +") (URL Typo?)\r\n", false, true, true, true, false); }
527536 if (url == null) { checkOnlineFailed = true; ui.log("Error: InvalidURL: url = new URL(" + urlString +"); (URL Typo?)\r\n", false, true, true, true, false); return null; }
528- HttpsURLConnection httpConnection = null;
529-
530- try { httpConnection = (HttpsURLConnection) url.openConnection(); } catch (IOException ex){ checkOnlineFailed = true; ui.log("Error: IOException: url.openConnection(): " + ex.getMessage() + "\r\n", false, true, true, true, false); }
531- httpConnection.setConnectTimeout(HTTP_CONNECT_TIMEOUT);
532- httpConnection.setReadTimeout(HTTP_CONNECT_TIMEOUT);
533- try { httpConnection.setRequestMethod(requestMethod); } catch (ProtocolException ex) { checkOnlineFailed = true; ui.log("Error: ProtocolException: httpConnection.setRequestMethod(\"GET\"): " + ex.getMessage() + "\r\n", false, true, true, true, false); }
534- httpConnection.setRequestProperty("User-Agent", userAgent);
535- httpConnection.setRequestProperty("Referer", Version.WEBSITEURISTRING);
537+
538+// Connect
539+ HttpsURLConnection httpsURLConnection = null;
540+ try { httpsURLConnection = (HttpsURLConnection) url.openConnection(); } catch (IOException ex){ checkOnlineFailed = true; ui.log("Error: IOException: url.openConnection(): " + ex.getMessage() + "\r\n", false, true, true, true, false); }
541+
542+// Connection Settings
543+ httpsURLConnection.setConnectTimeout(HTTP_CONNECT_TIMEOUT);
544+ httpsURLConnection.setReadTimeout(HTTP_CONNECT_TIMEOUT);
545+ try { httpsURLConnection.setRequestMethod(requestMethod); }
546+ catch (ProtocolException ex) { checkOnlineFailed = true; ui.log("Error: ProtocolException: httpsURLConnection.setRequestMethod(\"GET\"): " + ex.getMessage() + "\r\n", false, true, true, true, false); }
547+ httpsURLConnection.setRequestProperty("User-Agent", userAgent);
548+ httpsURLConnection.setRequestProperty("Referer", Version.WEBSITEURISTRING);
536549
550+// ResponseCodes
537551 int responseCode = 0;
538- try { responseCode = httpConnection.getResponseCode(); } catch (IOException ex) {checkOnlineFailed = true; ui.log("Error: IOException: httpConnection.getResponseCode(): " + ex.getMessage() + "\r\n", false, true, true, true, false); }
552+ try { responseCode = httpsURLConnection.getResponseCode(); } catch (IOException ex) {checkOnlineFailed = true; ui.log("Error: IOException: httpsURLConnection.getResponseCode(): " + ex.getMessage() + "\r\n", false, true, true, true, false); }
539553
540554 if ((responseCode >= 200) && (responseCode < 400))
541555 {
542-
543556 BufferedReader responseReader = null;
544- try { responseReader = new BufferedReader(new InputStreamReader(httpConnection.getInputStream())); } catch (IOException ex) { checkOnlineFailed = true; ui.log("Error: IOException: new InputStreamReader(httpConnection.getInputStream()): " + ex.getMessage() + "\r\n", false, true, true, true, false); }
557+ try { responseReader = new BufferedReader(new InputStreamReader(httpsURLConnection.getInputStream())); } catch (IOException ex) { checkOnlineFailed = true; ui.log("Error: IOException: new InputStreamReader(httpsURLConnection.getInputStream()): " + ex.getMessage() + "\r\n", false, true, true, true, false); }
545558
546559 String responseLine;
547560 StringBuffer response = new StringBuffer();
548561
549- try { while ((responseLine = responseReader.readLine()) != null)
562+ try
550563 {
551- response.append(responseLine + "\n");
552- } } catch (IOException ex) { checkOnlineFailed = true; ui.log("Error: IOException: responseReader.readLine() " + ex.getCause() + "\r\n", false, true, true, true, false); }
564+ while ((responseLine = responseReader.readLine()) != null)
565+ {
566+ response.append(responseLine + "\n");
567+ }
568+ } catch (IOException ex) { checkOnlineFailed = true; ui.log("Error: IOException: responseReader.readLine() " + ex.getCause() + "\r\n", false, true, true, true, false); }
553569 try { responseReader.close(); } catch (IOException ex) { checkOnlineFailed = true; ui.log("Error: IOException: responseReader.close(): " + ex.getMessage() + "\r\n", false, true, true, true, false); }
554570
555- httpConnection.disconnect();
571+ httpsURLConnection.disconnect();
556572
557573 return response.toString();
558574 } else { checkOnlineFailed = true; ui.log("Error: HTTP Response Code: " + responseCode + "\r\n", false, true, true, true, false); }
@@ -566,20 +582,28 @@ public class Version
566582 latestVersionIsKnown = false;
567583 latestOverallVersionString = "Unknown";
568584
569- loop: for(String remoteVERSION2FileString:REMOTEVERSIONFILEURLSTRINGARRAY)
585+// Loop through array
586+ loop: for(String remoteVERSION2FileURLString:REMOTEVERSIONFILEURLSTRINGARRAY)
570587 {
571588 checkOnlineFailed = false;
572589
573590 Thread logThread;
574591 logThread = new Thread(() ->
575592 {
576- ui.log("Fetch: " + remoteVERSION2FileString + "\r\n", false, true, true, false, false);
593+ ui.log("Fetch: " + remoteVERSION2FileURLString + "\r\n", false, true, true, false, false);
577594 });
578595 logThread.setName("logThread");
579596 logThread.setDaemon(true);
580597 logThread.start();
581598
582- if (remoteVERSION2FileString.startsWith("https://")) { remoteContent = httpsGetRequest(ui, remoteVERSION2FileString, "GET"); } else { remoteContent = httpGetRequest(ui, remoteVERSION2FileString, "GET"); }
599+ if (remoteVERSION2FileURLString.startsWith("https://"))
600+ {
601+ remoteContent = httpsGetRequest(ui, remoteVERSION2FileURLString, "GET");
602+ }
603+ else
604+ {
605+ remoteContent = httpGetRequest(ui, remoteVERSION2FileURLString, "GET");
606+ }
583607
584608 // ui.test("Remote Content: " + remoteContent + "\r\n\r\n");
585609 if ((remoteContent != null) && (! checkOnlineFailed))
Binary files /dev/null and b/src/rdj/audio/sounds/key.aiff differ
--- a/src/rdj/todo_doing_done.txt
+++ b/src/rdj/todo_doing_done.txt
@@ -59,3 +59,11 @@ the java.util.prefs.MacOSXPreferencesFactory class should be in rt.jar in JDK 1.
5959 See hg.openjdk.java.net/macosx-port/macosx-port/jdk/file/… for the source code.
6060 JDK 8 all the items in java.util.prefs:
6161 */
62+
63+// ExecutorService executorservice = Executors.newSingleThreadExecutor();
64+// Runnable runnable = () ->
65+// {
66+// };
67+// executorservice.submit(runnable);
68+// try { executorservice.awaitTermination((long)(randomVal / 2), TimeUnit.MILLISECONDS); } catch (InterruptedException ex) { }
69+// executorservice.shutdown();