FinalCrypt - The No¹ One-Time Pad Encryption
Revisión | 97d301ce20d4ed7ea6f669e25e5542b599545a38 (tree) |
---|---|
Tiempo | 2021-01-03 02:00:41 |
Autor | ron <ronuitzaandam@gmai...> |
Commiter | ron |
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
@@ -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 | + | |
1 | 14 | Date: 2020-11-14 Version: 6.5.0 |
2 | 15 | |
3 | 16 | Upgraded the Java Runtime Engine to version 1.8.0-271 |
@@ -10,9 +23,6 @@ Added nice splash image to FinalCrypt GUI startup | ||
10 | 23 | Improved Support Email Messages with Email Button |
11 | 24 | Updated a number of deprecated social media links |
12 | 25 | |
13 | -Please don't look away FinalCrypt needs your help | |
14 | -Please help by sharing FinalCrypt on Social Media | |
15 | - | |
16 | 26 | Date: 2020-11-02 Version: 6.4.2 |
17 | 27 | |
18 | 28 | Improved support added to Graphical User Interface |
@@ -2,7 +2,7 @@ Usage: java -cp finalcrypt.jar rdj/CLUI <Mode> [options] <Parameters> | ||
2 | 2 | |
3 | 3 | Examples: |
4 | 4 | |
5 | - java -cp finalcrypt.jar rdj/CLUI --examples Print commandline examples. | |
5 | + java -cp finalcrypt.jar rdj/CLUI --examples Print commandline examples. | |
6 | 6 | |
7 | 7 | java -cp finalcrypt.jar rdj/CLUI --encrypt --test -k "key_dir" -t "target_dir" -t "target_file" # Test Encrypt (Auto Key Mode) |
8 | 8 | 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: | ||
15 | 15 | |
16 | 16 | Mode: |
17 | 17 | |
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!). | |
26 | 28 | |
27 | 29 | Options: |
28 | 30 | |
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 | |
44 | 46 | |
45 | 47 | Test Options: |
46 | 48 | |
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. | |
50 | 52 | |
51 | 53 | Filtering Options: |
52 | 54 | |
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! | |
56 | 58 | |
57 | 59 | Parameters: |
58 | 60 | |
59 | - <-k "keydir"> The directory that holds your keys. Keep SECRET! | |
61 | + <-k "keydir"> The directory that holds your keys. Keep SECRET! | |
60 | 62 | |
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). | |
64 | 66 | |
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 |
@@ -76,4 +76,18 @@ Key Device Examples (Linux): | ||
76 | 76 | java -cp finalcrypt.jar rdj/CLUI --encrypt -k /dev/sdc1 -t myfile |
77 | 77 | java -cp finalcrypt.jar rdj/CLUI --decrypt -k /dev/sdc1 -t myfile |
78 | 78 | |
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 |
@@ -8,7 +8,7 @@ application.homepage=http://www.finalcrypt.org/ | ||
8 | 8 | application.splash= |
9 | 9 | application.title=FinalCrypt |
10 | 10 | application.vendor=FinalCrypt |
11 | -application.implementation.version=6.5.0 | |
11 | +application.implementation.version=6.6.0 | |
12 | 12 | auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=false |
13 | 13 | auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=4 |
14 | 14 | auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=4 |
@@ -51,10 +51,11 @@ public class Audio | ||
51 | 51 | public static final String SND_SELECT = "/rdj/audio/sounds/select"; |
52 | 52 | public static final String SND_SELECTINVALID = "/rdj/audio/sounds/select_invalid"; |
53 | 53 | public static final String SND_SELECTKEY = "/rdj/audio/sounds/select_key"; |
54 | + public static final String SND_SHUTDOWN = "/rdj/audio/sounds/shutdown"; | |
54 | 55 | public static final String SND_SOUND_DISABLED = "/rdj/audio/sounds/sound_disabled"; |
55 | 56 | 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"; | |
58 | 59 | |
59 | 60 | public static final String VOI_CLONE_KEY_DEVICE = "/rdj/audio/voice/clone_key_device"; |
60 | 61 | public static final String VOI_CONFIRM_PASS_WITH_ENTER = "/rdj/audio/voice/confirm_password_with_enter"; |
@@ -77,4 +78,42 @@ public class Audio | ||
77 | 78 | |
78 | 79 | public static boolean sound_Is_Enabled = true; |
79 | 80 | 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 | + } | |
80 | 119 | } |
@@ -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 | +} |
@@ -169,6 +169,7 @@ public class CLUI implements UI | ||
169 | 169 | // Options |
170 | 170 | if (( args[paramCnt].equals("-h")) || ( args[paramCnt].equals("--help") )) { usage(false); } |
171 | 171 | else if ( args[paramCnt].equals("--examples")) { examples(); } |
172 | + else if ( args[paramCnt].equals("--typewriter")) { typewriter(args); } | |
172 | 173 | else if ( args[paramCnt].equals("--disable-MAC")) { finalCrypt.disabledMAC = true; FCPath.KEY_SIZE_MIN = 1; encryptModeNeeded = true; } |
173 | 174 | else if ( args[paramCnt].equals("--scan")) { scan=true; } |
174 | 175 | 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 | ||
819 | 820 | log(" <--create-keydev> -k \"key_file\" -t \"target\" Create Key Device (only unix).\r\n", false, true, false, false, false); |
820 | 821 | log(" <--create-keyfile> -K \"key_file\" -S \"Size (bytes)\" Create OTP Key File.\r\n", false, true, false, false, false); |
821 | 822 | 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); | |
822 | 825 | log(" [--print-gpt] -t \"target_device\" Print GUID Partition Table.\r\n", false, true, false, false, false); |
823 | 826 | log(" [--delete-gpt] -t \"target_device\" Delete GUID Partition Table (DATA LOSS!).\r\n", false, true, false, false, false); |
824 | 827 | log("\r\n", false, true, false, false, false); |
@@ -950,10 +953,33 @@ public class CLUI implements UI | ||
950 | 953 | log(" java -cp finalcrypt.jar rdj/CLUI --encrypt -k /dev/sdc1 -t myfile\r\n", false, true, false, false, false); |
951 | 954 | log(" java -cp finalcrypt.jar rdj/CLUI --decrypt -k /dev/sdc1 -t myfile\r\n", false, true, false, false, false); |
952 | 955 | 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); | |
953 | 970 | 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); |
954 | 971 | System.exit(0); |
955 | 972 | } |
956 | 973 | |
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 | + | |
957 | 983 | @Override public void processGraph(int value) { } |
958 | 984 | |
959 | 985 | @Override |
@@ -1220,4 +1246,4 @@ class ConsoleEraser extends Thread | ||
1220 | 1246 | private boolean running = true; |
1221 | 1247 | public void run() { while (running) { System.err.print("\b "); try { Thread.currentThread().sleep(1); } catch(InterruptedException err) { break; } } } |
1222 | 1248 | public synchronized void halt() { running = false; } |
1223 | -} | |
\ No newline at end of file | ||
1249 | +} |
@@ -170,7 +170,7 @@ public class CreateOTPKey extends Application implements Initializable | ||
170 | 170 | if ( filenameTextField.getText().matches(regex) ) { filenameTextField.setText(filenameTextField.getText().replaceAll(regex, "")); } |
171 | 171 | else |
172 | 172 | { |
173 | - new Sound().play(guifx, Audio.SND_KEYPRESS,Audio.AUDIO_CODEC); | |
173 | + new AudioPlayer().play(guifx, Audio.SND_KEYPRESS,Audio.AUDIO_CODEC); | |
174 | 174 | filenameTextField.setText(filenameTextField.getText().replaceAll(regex, "")); |
175 | 175 | } |
176 | 176 |
@@ -250,8 +250,8 @@ public class CreateOTPKey extends Application implements Initializable | ||
250 | 250 | |
251 | 251 | @FXML private void increaseButtonOnAction(ActionEvent event) { changeSize(1); } |
252 | 252 | @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); } | |
255 | 255 | @FXML private void increaseButtonOnMouseReleased(MouseEvent event) { changeSizeRepeaterOff(); } |
256 | 256 | @FXML private void decreaseButtonOnMouseReleased(MouseEvent event) { changeSizeRepeaterOff(); } |
257 | 257 |
@@ -308,7 +308,7 @@ public class CreateOTPKey extends Application implements Initializable | ||
308 | 308 | @FXML |
309 | 309 | private void createButtonAction(ActionEvent event) |
310 | 310 | { |
311 | - new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
311 | + new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
312 | 312 | filenameTextField.setDisable(true); |
313 | 313 | filesizeLabel.setDisable(true); |
314 | 314 | filesizeTextField.setDisable(true); |
@@ -376,7 +376,7 @@ public class CreateOTPKey extends Application implements Initializable | ||
376 | 376 | }; updateProgressTaskTimer = new java.util.Timer(); updateProgressTaskTimer.schedule(updateProgressTask, 0L, 200L); |
377 | 377 | |
378 | 378 | |
379 | - new Sound().play(guifx, Audio.SND_ENCRYPTFILES,Audio.AUDIO_CODEC); | |
379 | + new AudioPlayer().play(guifx, Audio.SND_ENCRYPTFILES,Audio.AUDIO_CODEC); | |
380 | 380 | |
381 | 381 | write1loop: while ( (totalTranfered < filesizeInBytes) && (! inputEnded )) |
382 | 382 | { |
@@ -439,13 +439,13 @@ public class CreateOTPKey extends Application implements Initializable | ||
439 | 439 | @FXML |
440 | 440 | private void cancelButtonAction(ActionEvent event) |
441 | 441 | { |
442 | - new Sound().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
442 | + new AudioPlayer().play(guifx, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
443 | 443 | Platform.runLater(new Runnable(){ @Override public void run() |
444 | 444 | { |
445 | 445 | if (repeaterTimeline != null) { repeaterTimeline.stop(); statusLabel1.setText("Canceled"); } else { statusLabel1.setText("Closing"); } |
446 | 446 | statusLabel1.setVisible(true); |
447 | 447 | |
448 | - new Sound().play(guifx, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); | |
448 | + new AudioPlayer().play(guifx, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); | |
449 | 449 | |
450 | 450 | repeaterTimeline = new Timeline(new KeyFrame( Duration.millis(100), ae -> closeWindow() )); |
451 | 451 | repeaterTimeline.setCycleCount(1); |
@@ -458,7 +458,7 @@ public class CreateOTPKey extends Application implements Initializable | ||
458 | 458 | { |
459 | 459 | Platform.runLater(new Runnable(){ @Override public void run() |
460 | 460 | { |
461 | - new Sound().play(guifx, Audio.SND_SHUTDOWN,Audio.AUDIO_CODEC); | |
461 | + new AudioPlayer().play(guifx, Audio.SND_SHUTDOWN,Audio.AUDIO_CODEC); | |
462 | 462 | guifx.updateFileChoosers(true, false, true, true, false, true); // Basically FileChoosers ComponentAlteration as guifx.updateFileChoosers(true, true); hanged sometimes. |
463 | 463 | Stage stage = (Stage) cancelButton.getScene().getWindow(); stage.close(); |
464 | 464 | }}); |
@@ -480,8 +480,8 @@ public class CreateOTPKey extends Application implements Initializable | ||
480 | 480 | { |
481 | 481 | Platform.runLater(new Runnable(){ @Override public void run() |
482 | 482 | { |
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); | |
485 | 485 | Thread complianceURLThread; |
486 | 486 | complianceURLThread = new Thread(() -> |
487 | 487 | { |
@@ -501,8 +501,8 @@ public class CreateOTPKey extends Application implements Initializable | ||
501 | 501 | { |
502 | 502 | Platform.runLater(new Runnable(){ @Override public void run() |
503 | 503 | { |
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); | |
506 | 506 | Thread otpRulesURLThread; |
507 | 507 | otpRulesURLThread = new Thread(() -> |
508 | 508 | { |
@@ -869,7 +869,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
869 | 869 | { |
870 | 870 | Platform.runLater(() -> |
871 | 871 | { |
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); } | |
873 | 873 | |
874 | 874 | // Shared |
875 | 875 | String val = prefs.get("Shared", "Unknown"); |
@@ -1416,7 +1416,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
1416 | 1416 | sysmonFadeTransition.setInterpolator(Interpolator.EASE_OUT); |
1417 | 1417 | sysmonFadeTransition.setOnFinished((ActionEvent enableKeyButtonEvent) -> |
1418 | 1418 | { |
1419 | - new Sound().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC); | |
1419 | + new AudioPlayer().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC); | |
1420 | 1420 | |
1421 | 1421 | userloadPercTest = 100.0d; userMemPercTest = 100.0d; throughputPercTest = 100d; // IO_THROUGHPUT_CEILING; |
1422 | 1422 | Timeline systemMonitorTestTimeline = new Timeline(new KeyFrame( Duration.millis(100), ae -> |
@@ -1429,7 +1429,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
1429 | 1429 | { |
1430 | 1430 | update_System_Monitor_Enabled = true; |
1431 | 1431 | }); |
1432 | - new Sound().play(this, Audio.SND_SELECTKEY,Audio.AUDIO_CODEC); | |
1432 | + new AudioPlayer().play(this, Audio.SND_SELECTKEY,Audio.AUDIO_CODEC); | |
1433 | 1433 | systemMonitorTestTimeline.play(); |
1434 | 1434 | |
1435 | 1435 | regrabFCFocusOnOSX(500); |
@@ -1536,29 +1536,29 @@ public class GUIFX extends Application implements UI, Initializable | ||
1536 | 1536 | { |
1537 | 1537 | if (Voice.sound_Is_Enabled) // turn sound off |
1538 | 1538 | { |
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); | |
1541 | 1541 | setSound(false); prefs.put("Sound", "Disabled"); flushPrefs(prefs); |
1542 | 1542 | } |
1543 | 1543 | else // turn sound on |
1544 | 1544 | { |
1545 | 1545 | 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); | |
1548 | 1548 | } |
1549 | 1549 | } |
1550 | 1550 | else if (( event.getX() >= 130 ) && (event.getX() <= 145)) // Voice |
1551 | 1551 | { |
1552 | 1552 | if (Voice.voice_Is_Enabled) // turn voice off |
1553 | 1553 | { |
1554 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
1554 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
1555 | 1555 | Voice.play(this, Audio.VOI_VOICE_DISABLED,Audio.AUDIO_CODEC); |
1556 | 1556 | setVoice(false); prefs.put("Voice", "Disabled"); flushPrefs(prefs); |
1557 | 1557 | } |
1558 | 1558 | else // turn voice on |
1559 | 1559 | { |
1560 | 1560 | 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); | |
1562 | 1562 | Voice.play(this, Audio.VOI_VOICE_ENABLED,Audio.AUDIO_CODEC); |
1563 | 1563 | } |
1564 | 1564 | } |
@@ -1814,7 +1814,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
1814 | 1814 | |
1815 | 1815 | public Alert introAlert(AlertType type, String title, String headerText, String message, String optOutMessage, Consumer<Boolean> optOutAction, ButtonType... buttonTypes) |
1816 | 1816 | { |
1817 | - new Sound().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC); | |
1817 | + new AudioPlayer().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC); | |
1818 | 1818 | Alert alert = new Alert(type); |
1819 | 1819 | alert.getDialogPane().applyCss(); |
1820 | 1820 | Node graphic = alert.getDialogPane().getGraphic(); |
@@ -1918,7 +1918,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
1918 | 1918 | |
1919 | 1919 | private void alertCurrentVersionIsUp2Date() |
1920 | 1920 | { |
1921 | - new Sound().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC); | |
1921 | + new AudioPlayer().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC); | |
1922 | 1922 | Alert alert = new Alert(AlertType.INFORMATION); |
1923 | 1923 | |
1924 | 1924 | DialogPane dialogPane = alert.getDialogPane(); |
@@ -1933,12 +1933,12 @@ public class GUIFX extends Application implements UI, Initializable | ||
1933 | 1933 | alert.setContentText(content); |
1934 | 1934 | alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); |
1935 | 1935 | 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); } | |
1937 | 1937 | } |
1938 | 1938 | |
1939 | 1939 | private void alertCurrentVersionCanBeUpdated() |
1940 | 1940 | { |
1941 | - new Sound().play(this, Audio.SND_ALERT,Audio.AUDIO_CODEC); | |
1941 | + new AudioPlayer().play(this, Audio.SND_ALERT,Audio.AUDIO_CODEC); | |
1942 | 1942 | String alertString = Version.getProductName() + " v" + version.getLocalOverallVersionString() + " " + canbeupdatedtoversion + ": " + version.getLatestOnlineOverallVersionString() + "\r\n\r\n"; |
1943 | 1943 | if (! version.getLatestReleaseString().isEmpty()) { alertString += version.getLatestReleaseString() + "\r\n"; } |
1944 | 1944 | alertString += wouldYouLikeToDownload + " (" + Version.getProductName() + " v" + version.getLatestOnlineOverallVersionString() + ") ?\r\n"; |
@@ -1954,14 +1954,14 @@ public class GUIFX extends Application implements UI, Initializable | ||
1954 | 1954 | alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); |
1955 | 1955 | alert.showAndWait(); |
1956 | 1956 | |
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); } | |
1958 | 1958 | } |
1959 | 1959 | |
1960 | 1960 | private void alertCurrentVersionIsDevelopement() |
1961 | 1961 | { |
1962 | 1962 | // Platform.runLater(() -> |
1963 | 1963 | // { |
1964 | - new Sound().play(this, Audio.SND_ALERT,Audio.AUDIO_CODEC); | |
1964 | + new AudioPlayer().play(this, Audio.SND_ALERT,Audio.AUDIO_CODEC); | |
1965 | 1965 | |
1966 | 1966 | String alertString = ""; |
1967 | 1967 | Alert alert = new Alert(Alert.AlertType.CONFIRMATION, alertString, ButtonType.YES, ButtonType.NO); |
@@ -1984,13 +1984,13 @@ public class GUIFX extends Application implements UI, Initializable | ||
1984 | 1984 | alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); |
1985 | 1985 | alert.showAndWait(); |
1986 | 1986 | |
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); } | |
1988 | 1988 | // }); |
1989 | 1989 | } |
1990 | 1990 | |
1991 | 1991 | private void alertlatestVersionUnknown() |
1992 | 1992 | { |
1993 | - new Sound().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC); | |
1993 | + new AudioPlayer().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC); | |
1994 | 1994 | Alert alert = new Alert(AlertType.ERROR); |
1995 | 1995 | |
1996 | 1996 | DialogPane dialogPane = alert.getDialogPane(); |
@@ -2003,12 +2003,12 @@ public class GUIFX extends Application implements UI, Initializable | ||
2003 | 2003 | alert.setContentText(version.getUpdateStatus() + "\r\n" + network_connection_issues_perhaps + "\r\n"); |
2004 | 2004 | alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); |
2005 | 2005 | 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); } | |
2007 | 2007 | } |
2008 | 2008 | |
2009 | 2009 | private void latestAlertMessage() |
2010 | 2010 | { |
2011 | - new Sound().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC); | |
2011 | + new AudioPlayer().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC); | |
2012 | 2012 | Alert alert = new Alert(AlertType.INFORMATION); |
2013 | 2013 | |
2014 | 2014 | // Style the Alert |
@@ -2022,12 +2022,12 @@ public class GUIFX extends Application implements UI, Initializable | ||
2022 | 2022 | alert.setContentText(version.getLatestAlertString()); |
2023 | 2023 | alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); |
2024 | 2024 | 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); } | |
2026 | 2026 | } |
2027 | 2027 | |
2028 | 2028 | private void currentAlertMessage() |
2029 | 2029 | { |
2030 | - new Sound().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC); | |
2030 | + new AudioPlayer().play(this, Audio.SND_MESSAGE,Audio.AUDIO_CODEC); | |
2031 | 2031 | Alert alert = new Alert(AlertType.INFORMATION); |
2032 | 2032 | |
2033 | 2033 | // Style the Alert |
@@ -2042,7 +2042,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2042 | 2042 | alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); |
2043 | 2043 | alert.showAndWait(); |
2044 | 2044 | |
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); } | |
2046 | 2046 | } |
2047 | 2047 | |
2048 | 2048 | // Custom FileChooserDelete Listener methods |
@@ -2053,8 +2053,8 @@ public class GUIFX extends Application implements UI, Initializable | ||
2053 | 2053 | { |
2054 | 2054 | Platform.runLater(() -> |
2055 | 2055 | { |
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); | |
2058 | 2058 | String itemword = ""; |
2059 | 2059 | if ( tgtFileChooser.getSelectedFiles().length == 1 ) { itemword = item; } |
2060 | 2060 | else if ( tgtFileChooser.getSelectedFiles().length > 1 ) { itemword = items; } |
@@ -2070,7 +2070,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2070 | 2070 | { |
2071 | 2071 | if (tgtFileChooser.getSelectedFiles().length > 0) |
2072 | 2072 | { |
2073 | - new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); | |
2073 | + new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); | |
2074 | 2074 | // play(SND_INPUT_OK, AUDIO_CODEC); |
2075 | 2075 | ArrayList<Path> pathList = finalCrypt.getPathList(tgtFileChooser.getSelectedFiles()); |
2076 | 2076 | // boolean delete = true; |
@@ -2084,7 +2084,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2084 | 2084 | updateFileChoosers(true, false, true, true, false, true); // targetFileDeleteButtonActionPerformed() |
2085 | 2085 | } |
2086 | 2086 | } |
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); } | |
2088 | 2088 | }); |
2089 | 2089 | } |
2090 | 2090 |
@@ -2096,8 +2096,8 @@ public class GUIFX extends Application implements UI, Initializable | ||
2096 | 2096 | { |
2097 | 2097 | Platform.runLater(() -> |
2098 | 2098 | { |
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); | |
2101 | 2101 | String itemword = ""; |
2102 | 2102 | if ( keyFileChooser.getSelectedFiles().length == 1 ) { itemword = item; } |
2103 | 2103 | else if ( keyFileChooser.getSelectedFiles().length > 1 ) { itemword = items; } |
@@ -2112,7 +2112,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2112 | 2112 | { |
2113 | 2113 | if (keyFileChooser.getSelectedFiles().length > 0) |
2114 | 2114 | { |
2115 | - new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); | |
2115 | + new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); | |
2116 | 2116 | ArrayList<Path> pathList = finalCrypt.getPathList(keyFileChooser.getSelectedFiles()); |
2117 | 2117 | // boolean delete = true; |
2118 | 2118 | boolean returnpathlist = false; |
@@ -2129,8 +2129,8 @@ public class GUIFX extends Application implements UI, Initializable | ||
2129 | 2129 | } |
2130 | 2130 | } else |
2131 | 2131 | { |
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); | |
2134 | 2134 | } |
2135 | 2135 | }); |
2136 | 2136 | } |
@@ -2222,7 +2222,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2222 | 2222 | { |
2223 | 2223 | Thread openThread = new Thread(() -> |
2224 | 2224 | { |
2225 | - new Sound().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC); | |
2225 | + new AudioPlayer().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC); | |
2226 | 2226 | 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); } |
2227 | 2227 | }); |
2228 | 2228 | openThread.setName("openThread"); |
@@ -2273,7 +2273,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2273 | 2273 | GUIFX guifx = this; |
2274 | 2274 | Thread openThread = new Thread(() -> |
2275 | 2275 | { |
2276 | - new Sound().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC); | |
2276 | + new AudioPlayer().play(guifx, Audio.SND_OPEN,Audio.AUDIO_CODEC); | |
2277 | 2277 | 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); } |
2278 | 2278 | }); |
2279 | 2279 | openThread.setName("openThread"); |
@@ -2303,7 +2303,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2303 | 2303 | { |
2304 | 2304 | if ((!processRunning ) && (evt.getPropertyName().equals("SelectedFilesChangedProperty"))) |
2305 | 2305 | { |
2306 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
2306 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
2307 | 2307 | tgtFileChooserPropertyCheck(true); |
2308 | 2308 | } |
2309 | 2309 | else if (evt.getPropertyName().equals("directoryChanged")) |
@@ -2329,7 +2329,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2329 | 2329 | // test("Prop: " + evt.getPropertyName() + "\r\n"); |
2330 | 2330 | if ((!processRunning ) && (evt.getPropertyName().equals("SelectedFilesChangedProperty"))) |
2331 | 2331 | { |
2332 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
2332 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
2333 | 2333 | keyFileChooserPropertyCheck(false); |
2334 | 2334 | } |
2335 | 2335 | else if (evt.getPropertyName().equals("directoryChanged")) |
@@ -2424,7 +2424,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2424 | 2424 | |
2425 | 2425 | if ((targetPathList != null) && (targetPathList.size() > 0)) { filesProgressBar.setVisible(true); filesProgressBar.setProgress(ProgressBar.INDETERMINATE_PROGRESS); } |
2426 | 2426 | |
2427 | - new Sound().play(this, Audio.SND_READY,Audio.AUDIO_CODEC); | |
2427 | + new AudioPlayer().play(this, Audio.SND_READY,Audio.AUDIO_CODEC); | |
2428 | 2428 | |
2429 | 2429 | ugMessage = new Message(scanning_files, 64, false, false, false, false, Voice.VOI_SCANNING_FILES, 0); |
2430 | 2430 | userGuidanceMessage(ugMessage); |
@@ -2453,7 +2453,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2453 | 2453 | } |
2454 | 2454 | else |
2455 | 2455 | { |
2456 | - new Sound().play(this, Audio.SND_SELECTINVALID,Audio.AUDIO_CODEC); | |
2456 | + new AudioPlayer().play(this, Audio.SND_SELECTINVALID,Audio.AUDIO_CODEC); | |
2457 | 2457 | ugMessage = new Message(select_key_dir, 64, false, false, true, false, Voice.VOI_SELECT_KEY_DIRECTORY, 0); |
2458 | 2458 | userGuidanceMessage(ugMessage); |
2459 | 2459 | } |
@@ -2558,7 +2558,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2558 | 2558 | else if (keyFCPath.type == FCPath.DIRECTORY) { keyitem = directory; } |
2559 | 2559 | else { keyitem = FCPath.getTypeString(keyFCPath.type); } |
2560 | 2560 | |
2561 | - new Sound().play(this, Audio.SND_SELECTKEY,Audio.AUDIO_CODEC); | |
2561 | + new AudioPlayer().play(this, Audio.SND_SELECTKEY,Audio.AUDIO_CODEC); | |
2562 | 2562 | keyHeaderLabel.setTextFill(Color.GREENYELLOW); keyHeaderLabel.setText(key + " " + keyitem); |
2563 | 2563 | keyNameLabel.setTextFill(Color.GREENYELLOW); keyNameLabel.setText(keyFCPath.path.toAbsolutePath().toString()); keyNameLabelTooltip.setText(keyFCPath.path.toAbsolutePath().toString()); |
2564 | 2564 | checksumLabel.setTextFill(Color.WHITESMOKE); checksumHeader.setText(""); checksumLabel.setText(""); |
@@ -2609,7 +2609,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2609 | 2609 | else if (keyFCPath.type == FCPath.DIRECTORY) { keyitem = directory; } |
2610 | 2610 | else { keyitem = FCPath.getTypeString(keyFCPath.type); } |
2611 | 2611 | |
2612 | - new Sound().play(this, Audio.SND_SELECTINVALID,Audio.AUDIO_CODEC); | |
2612 | + new AudioPlayer().play(this, Audio.SND_SELECTINVALID,Audio.AUDIO_CODEC); | |
2613 | 2613 | keyHeaderLabel.setTextFill(Color.ORANGE); keyHeaderLabel.setText(key + " " + keyitem); |
2614 | 2614 | keyNameLabel.setTextFill(Color.ORANGE); keyNameLabel.setText(keyFCPath.path.toAbsolutePath().toString()); keyNameLabelTooltip.setText(keyFCPath.path.toAbsolutePath().toString()); |
2615 | 2615 | if (keyFCPath.type != FCPath.FILE) { keyHeaderLabel.setTextFill(Color.ORANGERED); } |
@@ -2686,7 +2686,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2686 | 2686 | else if (keyFCPath.type == FCPath.DIRECTORY) { keyitem = directory; } |
2687 | 2687 | else { keyitem = FCPath.getTypeString(keyFCPath.type); } |
2688 | 2688 | |
2689 | - new Sound().play(this, Audio.SND_SELECTINVALID,Audio.AUDIO_CODEC); | |
2689 | + new AudioPlayer().play(this, Audio.SND_SELECTINVALID,Audio.AUDIO_CODEC); | |
2690 | 2690 | keyHeaderLabel.setTextFill(Color.ORANGE); keyHeaderLabel.setText(key + " " + keyitem); |
2691 | 2691 | keyNameLabel.setTextFill(Color.ORANGE); keyNameLabel.setText(keyFCPath.path.toAbsolutePath().toString()); keyNameLabelTooltip.setText(keyFCPath.path.toAbsolutePath().toString()); |
2692 | 2692 | if (keyFCPath.type != FCPath.FILE) { keyHeaderLabel.setTextFill(Color.ORANGERED); } |
@@ -2757,7 +2757,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2757 | 2757 | String hashString = getHexString(hashBytes,2); |
2758 | 2758 | Platform.runLater(() -> |
2759 | 2759 | { |
2760 | - new Sound().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC); | |
2760 | + new AudioPlayer().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC); | |
2761 | 2761 | checksumLabel.setTextFill(Color.GREENYELLOW); |
2762 | 2762 | checksumHeader.setText(checksum + " (" + FinalCrypt.HASH_ALGORITHM_NAME + ")"); checksumLabel.setText(hashString); |
2763 | 2763 | 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 | ||
2781 | 2781 | |
2782 | 2782 | @FXML private void checksumLabelOnMouseClicked(MouseEvent event) |
2783 | 2783 | { |
2784 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
2784 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
2785 | 2785 | Platform.runLater(() -> |
2786 | 2786 | { |
2787 | 2787 | if ( event.getButton() == MouseButton.PRIMARY ) |
2788 | 2788 | { |
2789 | 2789 | if ((keyFCPath != null) && (keyFCPath.isValidKey)) |
2790 | 2790 | { |
2791 | - new Sound().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC); | |
2791 | + new AudioPlayer().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC); | |
2792 | 2792 | checksumLabel.setTextFill(Color.WHITESMOKE); |
2793 | 2793 | checksumHeader.setText("Checksum (" + FinalCrypt.HASH_ALGORITHM_NAME + ")"); checksumLabel.setText("Calculating..."); checksumTooltip.setText(""); |
2794 | 2794 | Platform.runLater(() -> { calculateChecksum(); }); |
@@ -2798,7 +2798,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
2798 | 2798 | { |
2799 | 2799 | if ((keyFCPath != null) && (keyFCPath.isValidKey)) |
2800 | 2800 | { |
2801 | - new Sound().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC); | |
2801 | + new AudioPlayer().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC); | |
2802 | 2802 | Thread blinkThread = new Thread(() -> |
2803 | 2803 | { |
2804 | 2804 | Paint oldColor = checksumLabel.getTextFill(); |
@@ -3000,7 +3000,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
3000 | 3000 | // Encryptable Files |
3001 | 3001 | if (targetFCPathList.encryptableFiles > 0) // Encryptables |
3002 | 3002 | { |
3003 | - new Sound().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC); | |
3003 | + new AudioPlayer().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC); | |
3004 | 3004 | encryptableList = filter(targetFCPathList,(FCPath fcPath) -> fcPath.isEncryptable); |
3005 | 3005 | encryptButton.setDisable(false); |
3006 | 3006 |
@@ -3032,7 +3032,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
3032 | 3032 | // Decryptable Files |
3033 | 3033 | if ((targetFCPathList.decryptableFiles > 0) && ( ! finalCrypt.disabledMAC) ) // Prevents destruction! Non-MAC Mode encrypting MAC encrypted files (in stead of default decryption) |
3034 | 3034 | { |
3035 | - new Sound().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC); | |
3035 | + new AudioPlayer().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC); | |
3036 | 3036 | decryptableList = filter(targetFCPathList,(FCPath fcPath) -> fcPath.isDecryptable); |
3037 | 3037 | decryptButton.setDisable(false); |
3038 | 3038 | // pauseToggleButton.setDisable(true); stopButton.setDisable(true); |
@@ -3106,7 +3106,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
3106 | 3106 | { |
3107 | 3107 | if ((targetFCPathList.encryptedFiles > 0) && (targetFCPathList.decryptableFiles == 0)) |
3108 | 3108 | { |
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); } | |
3110 | 3110 | } |
3111 | 3111 | else |
3112 | 3112 | { |
@@ -3331,7 +3331,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
3331 | 3331 | { |
3332 | 3332 | Platform.runLater(() -> |
3333 | 3333 | { |
3334 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
3334 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
3335 | 3335 | Thread encryptThread = new Thread(new Runnable() |
3336 | 3336 | { |
3337 | 3337 | private DeviceManager deviceManager; |
@@ -3395,7 +3395,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
3395 | 3395 | { |
3396 | 3396 | Platform.runLater(() -> |
3397 | 3397 | { |
3398 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
3398 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
3399 | 3399 | Thread encryptThread = new Thread(new Runnable() |
3400 | 3400 | { |
3401 | 3401 | private DeviceManager deviceManager; |
@@ -3451,13 +3451,13 @@ public class GUIFX extends Application implements UI, Initializable | ||
3451 | 3451 | finalCrypt.encryptSelection(targetSourceFCPathList, filteredTargetSourceFCPathList, keyFCPath, false, pwd, pwdBytes, open); |
3452 | 3452 | } |
3453 | 3453 | |
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(); } | |
3456 | 3456 | |
3457 | 3457 | synchronized private void createOTPKeyFile() |
3458 | 3458 | { |
3459 | 3459 | // 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); | |
3461 | 3461 | String alertString = ""; |
3462 | 3462 | Alert alert = new Alert(Alert.AlertType.CONFIRMATION, alertString, ButtonType.YES, ButtonType.NO); |
3463 | 3463 |
@@ -3479,7 +3479,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
3479 | 3479 | |
3480 | 3480 | if (alert.getResult() == ButtonType.YES) |
3481 | 3481 | { |
3482 | - new Sound().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC); | |
3482 | + new AudioPlayer().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC); | |
3483 | 3483 | final GUIFX guifx = this; |
3484 | 3484 | final UI ui = this; |
3485 | 3485 |
@@ -3505,7 +3505,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
3505 | 3505 | |
3506 | 3506 | Platform.runLater(() -> |
3507 | 3507 | { |
3508 | - new Sound().play(ui, Sound.SND_OPEN,Audio.AUDIO_CODEC); | |
3508 | + new AudioPlayer().play(ui, AudioPlayer.SND_OPEN,Audio.AUDIO_CODEC); | |
3509 | 3509 | createOTPKeyStage = new Stage(); |
3510 | 3510 | createOTPKey = new CreateOTPKey(); |
3511 | 3511 |
@@ -3558,7 +3558,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
3558 | 3558 | // encryptThread.setDaemon(true); |
3559 | 3559 | // encryptThread.start(); |
3560 | 3560 | } |
3561 | - else { new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); } | |
3561 | + else { new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); } | |
3562 | 3562 | } |
3563 | 3563 | |
3564 | 3564 | synchronized private void openSupport(String caller, Locale selectedLocale, boolean exitAppOnClose) |
@@ -3579,7 +3579,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
3579 | 3579 | { |
3580 | 3580 | // test("Caller: " + caller + " exitAppOnClose " + exitAppOnClose + "\r\n"); |
3581 | 3581 | |
3582 | - new Sound().play(ui, Sound.SND_OPEN,Audio.AUDIO_CODEC); | |
3582 | + new AudioPlayer().play(ui, AudioPlayer.SND_OPEN,Audio.AUDIO_CODEC); | |
3583 | 3583 | supportStage = new Stage(); |
3584 | 3584 | support = new Support(); |
3585 | 3585 |
@@ -3631,10 +3631,10 @@ public class GUIFX extends Application implements UI, Initializable | ||
3631 | 3631 | |
3632 | 3632 | switch (processRunningMode) |
3633 | 3633 | { |
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; | |
3638 | 3638 | default: break; |
3639 | 3639 | } |
3640 | 3640 |
@@ -3893,7 +3893,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
3893 | 3893 | FCPath openFCPath = (FCPath) fcPathIterator.next(); |
3894 | 3894 | Path newPath = Paths.get(openFCPath.path.toAbsolutePath().toString().substring(0, openFCPath.path.toAbsolutePath().toString().lastIndexOf('.'))); |
3895 | 3895 | |
3896 | - new Sound().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC); | |
3896 | + new AudioPlayer().play(this, Audio.SND_OPEN,Audio.AUDIO_CODEC); | |
3897 | 3897 | try { Desktop.getDesktop().open(newPath.toFile()); } |
3898 | 3898 | catch (IOException ex) { log("Error: Desktop.getDesktop().open(" + newPath.toFile().getAbsolutePath().toString() + "); " + ex.getMessage() + "\r\n", true, true, true, true, false); } |
3899 | 3899 |
@@ -3914,7 +3914,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
3914 | 3914 | openThread.setDaemon(true); |
3915 | 3915 | openThread.start(); |
3916 | 3916 | |
3917 | - new Sound().play(this, Audio.SND_SHUTDOWN,Audio.AUDIO_CODEC); | |
3917 | + new AudioPlayer().play(this, Audio.SND_SHUTDOWN,Audio.AUDIO_CODEC); | |
3918 | 3918 | |
3919 | 3919 | if (System.getProperty("os.name").toLowerCase().indexOf("mac") == -1) // Again due to Mac OSX |
3920 | 3920 | { |
@@ -4006,7 +4006,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
4006 | 4006 | @FXML |
4007 | 4007 | private void keyInfoLabelClicked(MouseEvent event) |
4008 | 4008 | { |
4009 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4009 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4010 | 4010 | Alert alert = new Alert(AlertType.INFORMATION); |
4011 | 4011 | |
4012 | 4012 | // Style the Alert |
@@ -4020,16 +4020,16 @@ public class GUIFX extends Application implements UI, Initializable | ||
4020 | 4020 | String infotext = new String(); |
4021 | 4021 | infotext = keyInfoContent; |
4022 | 4022 | 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); | |
4024 | 4024 | alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); |
4025 | 4025 | 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); } | |
4027 | 4027 | } |
4028 | 4028 | |
4029 | 4029 | @FXML |
4030 | 4030 | private void targetInfoLabelClicked(MouseEvent event) |
4031 | 4031 | { |
4032 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4032 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4033 | 4033 | Alert alert = new Alert(AlertType.INFORMATION); |
4034 | 4034 | |
4035 | 4035 | // Style the Alert |
@@ -4043,10 +4043,10 @@ public class GUIFX extends Application implements UI, Initializable | ||
4043 | 4043 | String infotext = new String(); |
4044 | 4044 | infotext = targetInfoContent; |
4045 | 4045 | 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); | |
4047 | 4047 | alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); |
4048 | 4048 | 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); } | |
4050 | 4050 | } |
4051 | 4051 | |
4052 | 4052 | // 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 | ||
4064 | 4064 | { |
4065 | 4065 | if ( processPausing ) |
4066 | 4066 | { |
4067 | - new Sound().play(this, Audio.SND_SHUTDOWN,Audio.AUDIO_CODEC); | |
4067 | + new AudioPlayer().play(this, Audio.SND_SHUTDOWN,Audio.AUDIO_CODEC); | |
4068 | 4068 | if (processRunningMode == ENCRYPT_MODE) { encryptButton.setStyle(" -fx-text-fill: orange; "); } |
4069 | 4069 | else if (processRunningMode == DECRYPT_MODE) { decryptButton.setStyle(" -fx-text-fill: orange; "); } |
4070 | 4070 | PAUSE_TIMELINE.play(); |
@@ -4074,7 +4074,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
4074 | 4074 | { |
4075 | 4075 | if (!unPauseToStop) |
4076 | 4076 | { |
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); } | |
4078 | 4078 | } |
4079 | 4079 | PAUSE_TIMELINE.stop(); |
4080 | 4080 | 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 | ||
4104 | 4104 | // UI |
4105 | 4105 | Platform.runLater(() -> |
4106 | 4106 | { |
4107 | - new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); | |
4107 | + new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); | |
4108 | 4108 | }); |
4109 | 4109 | } |
4110 | 4110 | } |
4111 | 4111 | |
4112 | 4112 | @FXML private void authorLabelOnMouseClicked(MouseEvent event) |
4113 | 4113 | { |
4114 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4114 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4115 | 4115 | // new Sound().play(this, Audio.SND_INPUT_FAIL,Audio.AUDIO_CODEC); /*checkUpdate();*/ |
4116 | 4116 | Thread openAuthorThread; openAuthorThread = new Thread(() -> |
4117 | 4117 | { |
@@ -4129,7 +4129,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
4129 | 4129 | |
4130 | 4130 | private void checkUpdateButtonOnAction(ActionEvent event) |
4131 | 4131 | { |
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); }); | |
4133 | 4133 | Platform.runLater(() -> { checkUpdate( true ); }); |
4134 | 4134 | } |
4135 | 4135 |
@@ -4150,145 +4150,145 @@ public class GUIFX extends Application implements UI, Initializable | ||
4150 | 4150 | } |
4151 | 4151 | } |
4152 | 4152 | |
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); } | |
4154 | 4154 | |
4155 | 4155 | // Headers |
4156 | 4156 | // ================================================================================================================================================================== |
4157 | 4157 | |
4158 | 4158 | private void emptyFilesHeaderLabelOnMouseClicked(MouseEvent event) |
4159 | 4159 | { |
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); | |
4162 | 4162 | // 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); } |
4163 | 4163 | emptyList.forEach((fcPath) -> { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }); |
4164 | 4164 | 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); } | |
4166 | 4166 | } |
4167 | 4167 | |
4168 | 4168 | private void symlinkFilesHeaderLabelOnMouseClicked(MouseEvent event) |
4169 | 4169 | { |
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); | |
4172 | 4172 | // 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); } |
4173 | 4173 | symlinkList.forEach((fcPath) -> { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }); |
4174 | 4174 | 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); } | |
4176 | 4176 | } |
4177 | 4177 | |
4178 | 4178 | @FXML |
4179 | 4179 | private void unreadableFilesHeaderLabelOnMouseClicked(MouseEvent event) |
4180 | 4180 | { |
4181 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4181 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4182 | 4182 | if ( (unreadableList != null) && (unreadableList.size() > 0) ) |
4183 | 4183 | { |
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); | |
4185 | 4185 | // 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); |
4186 | 4186 | unreadableList.stream().map((fcPath) -> { setAttribute(fcPath, true, false); return fcPath; }).forEachOrdered((fcPath) -> { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }); |
4187 | 4187 | log("\r\n", false, true, false, false, false); |
4188 | 4188 | targetFCPathList = new FCPathList<FCPath>(); updateDashboard(targetFCPathList); |
4189 | 4189 | Platform.runLater(() -> { encryptButton.setDisable(true); decryptButton.setDisable(true); }); |
4190 | 4190 | } |
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); } | |
4192 | 4192 | } |
4193 | 4193 | |
4194 | 4194 | @FXML |
4195 | 4195 | private void unwritableFilesHeaderLabelOnMouseClicked(MouseEvent event) |
4196 | 4196 | { |
4197 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4197 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4198 | 4198 | if ( (unwritableList != null) && (unwritableList.size() > 0) ) |
4199 | 4199 | { |
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); | |
4201 | 4201 | // 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); |
4202 | 4202 | unwritableList.stream().map((fcPath) -> { setAttribute(fcPath, true, true); return fcPath; }).forEachOrdered((fcPath) -> { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); }); |
4203 | 4203 | log("\r\n", false, true, true, false, false); |
4204 | 4204 | targetFCPathList = new FCPathList<FCPath>(); updateDashboard(targetFCPathList); |
4205 | 4205 | Platform.runLater(() -> { encryptButton.setDisable(true); decryptButton.setDisable(true); }); |
4206 | 4206 | } |
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); } | |
4208 | 4208 | } |
4209 | 4209 | |
4210 | 4210 | private void hiddenFilesHeaderLabelOnMouseClicked(MouseEvent event) |
4211 | 4211 | { |
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); | |
4214 | 4214 | // for (Iterator it = hiddenList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4215 | 4215 | for (FCPath fcPath : hiddenList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4216 | 4216 | 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);} | |
4218 | 4218 | } |
4219 | 4219 | |
4220 | 4220 | @FXML |
4221 | 4221 | private void emptyFilesLabelOnMouseClicked(MouseEvent event) |
4222 | 4222 | { |
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); | |
4225 | 4225 | // for (Iterator it = emptyList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4226 | 4226 | for (FCPath fcPath : emptyList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4227 | 4227 | 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);} | |
4229 | 4229 | } |
4230 | 4230 | |
4231 | 4231 | @FXML |
4232 | 4232 | private void symlinkFilesLabelOnMouseClicked(MouseEvent event) |
4233 | 4233 | { |
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); | |
4236 | 4236 | // for (Iterator it = symlinkList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4237 | 4237 | for (FCPath fcPath : symlinkList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4238 | 4238 | 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);} | |
4240 | 4240 | } |
4241 | 4241 | |
4242 | 4242 | @FXML |
4243 | 4243 | private void unreadableFilesLabelOnMouseClicked(MouseEvent event) |
4244 | 4244 | { |
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); | |
4247 | 4247 | // for (Iterator it = unreadableList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4248 | 4248 | for (FCPath fcPath : unreadableList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4249 | 4249 | 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);} | |
4251 | 4251 | } |
4252 | 4252 | |
4253 | 4253 | @FXML |
4254 | 4254 | private void unwritableFilesLabelOnMouseClicked(MouseEvent event) |
4255 | 4255 | { |
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); | |
4258 | 4258 | // for (Iterator it = unwritableList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4259 | 4259 | for (FCPath fcPath : unwritableList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4260 | 4260 | 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);} | |
4262 | 4262 | } |
4263 | 4263 | |
4264 | 4264 | @FXML |
4265 | 4265 | private void hiddenFilesLabelOnMouseClicked(MouseEvent event) |
4266 | 4266 | { |
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); | |
4269 | 4269 | // for (Iterator it = hiddenList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4270 | 4270 | for (FCPath fcPath : hiddenList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4271 | 4271 | 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);} | |
4273 | 4273 | } |
4274 | 4274 | |
4275 | 4275 | @FXML |
4276 | 4276 | private void encryptableLabelOnMouseClicked(MouseEvent event) |
4277 | 4277 | { |
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); | |
4280 | 4280 | // for (Iterator it = encryptableList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4281 | 4281 | for (FCPath fcPath : encryptableList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4282 | 4282 | 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);} | |
4284 | 4284 | } |
4285 | 4285 | |
4286 | 4286 | @FXML private void keyWriteLabelOnMouseClicked(MouseEvent event) |
4287 | 4287 | { |
4288 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4288 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4289 | 4289 | if ( (writeAutoKeyList != null) && (writeAutoKeyList.size() > 0) ) |
4290 | 4290 | { |
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); | |
4292 | 4292 | // for (Iterator it = writeAutoKeyList.iterator(); it.hasNext();) |
4293 | 4293 | // { |
4294 | 4294 | // FCPath fcPath = (FCPath) it.next(); |
@@ -4302,15 +4302,15 @@ public class GUIFX extends Application implements UI, Initializable | ||
4302 | 4302 | } |
4303 | 4303 | log("\r\n", false, true, true, false, false); |
4304 | 4304 | } |
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);} | |
4306 | 4306 | } |
4307 | 4307 | |
4308 | 4308 | @FXML private void keyReadLabelOnMouseClicked(MouseEvent event) |
4309 | 4309 | { |
4310 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4310 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4311 | 4311 | if ( (readAutoKeyList != null) && (readAutoKeyList.size() > 0) ) |
4312 | 4312 | { |
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); | |
4314 | 4314 | // for (Iterator it = readAutoKeyList.iterator(); it.hasNext();) |
4315 | 4315 | // { |
4316 | 4316 | // FCPath fcPath = (FCPath) it.next(); |
@@ -4328,15 +4328,15 @@ public class GUIFX extends Application implements UI, Initializable | ||
4328 | 4328 | } |
4329 | 4329 | log("\r\n", false, true, true, false, false); |
4330 | 4330 | } |
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);} | |
4332 | 4332 | } |
4333 | 4333 | |
4334 | 4334 | @FXML private void keyMissingLabelOnMouseClicked(MouseEvent event) |
4335 | 4335 | { |
4336 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4336 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4337 | 4337 | if ( (missingAutoKeyList != null) && (missingAutoKeyList.size() > 0) ) |
4338 | 4338 | { |
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); | |
4340 | 4340 | // for (Iterator it = readAutoKeyList.iterator(); it.hasNext();) |
4341 | 4341 | // { |
4342 | 4342 | // FCPath fcPath = (FCPath) it.next(); |
@@ -4354,98 +4354,98 @@ public class GUIFX extends Application implements UI, Initializable | ||
4354 | 4354 | } |
4355 | 4355 | log("\r\n", false, true, true, false, false); |
4356 | 4356 | } |
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);} | |
4358 | 4358 | } |
4359 | 4359 | |
4360 | 4360 | @FXML private void decryptableLabelOnMouseClicked(MouseEvent event) |
4361 | 4361 | { |
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); | |
4364 | 4364 | // for (Iterator it = decryptableList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4365 | 4365 | for (FCPath fcPath : decryptableList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4366 | 4366 | 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);} | |
4368 | 4368 | } |
4369 | 4369 | |
4370 | 4370 | @FXML |
4371 | 4371 | private void decryptedLabelOnMouseClicked(MouseEvent event) |
4372 | 4372 | { |
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); | |
4375 | 4375 | // for (Iterator it = decryptedList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4376 | 4376 | for (FCPath fcPath : decryptedList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4377 | 4377 | 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);} | |
4379 | 4379 | } |
4380 | 4380 | |
4381 | 4381 | @FXML |
4382 | 4382 | private void encryptedLabelOnMouseClicked(MouseEvent event) |
4383 | 4383 | { |
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); | |
4386 | 4386 | // for (Iterator it = encryptedList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4387 | 4387 | for (FCPath fcPath : encryptedList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4388 | 4388 | 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);} | |
4390 | 4390 | } |
4391 | 4391 | |
4392 | 4392 | private void newEncryptedLabelOnMouseClicked(MouseEvent event) |
4393 | 4393 | { |
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); | |
4396 | 4396 | // for (Iterator it = newEncryptedList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4397 | 4397 | for (FCPath fcPath : newEncryptedList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4398 | 4398 | 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);} | |
4400 | 4400 | } |
4401 | 4401 | |
4402 | 4402 | @FXML |
4403 | 4403 | private void unencryptableLabelOnMouseClicked(MouseEvent event) |
4404 | 4404 | { |
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); | |
4407 | 4407 | // for (Iterator it = unencryptableList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4408 | 4408 | for (FCPath fcPath : unencryptableList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4409 | 4409 | 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);} | |
4411 | 4411 | } |
4412 | 4412 | |
4413 | 4413 | private void newDecryptedLabelOnMouseClicked(MouseEvent event) |
4414 | 4414 | { |
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); | |
4417 | 4417 | // 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); } |
4418 | 4418 | for (FCPath fcPath : newDecryptedList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4419 | 4419 | 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);} | |
4421 | 4421 | } |
4422 | 4422 | |
4423 | 4423 | @FXML |
4424 | 4424 | private void undecryptableLabelOnMouseClicked(MouseEvent event) |
4425 | 4425 | { |
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); | |
4428 | 4428 | // for (Iterator it = undecryptableList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4429 | 4429 | for (FCPath fcPath : undecryptableList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4430 | 4430 | 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);} | |
4432 | 4432 | } |
4433 | 4433 | |
4434 | 4434 | @FXML |
4435 | 4435 | private void invalidFilesLabelOnMouseClicked(MouseEvent event) |
4436 | 4436 | { |
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); | |
4439 | 4439 | // for (Iterator it = invalidFilesList.iterator(); it.hasNext();) { FCPath fcPath = (FCPath) it.next(); log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4440 | 4440 | for (FCPath fcPath : invalidFilesList) { log(fcPath.path.toAbsolutePath().toString() + "\r\n", false, true, true, false, false); } |
4441 | 4441 | 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);} | |
4443 | 4443 | } |
4444 | 4444 | |
4445 | 4445 | private void supportButtonOnAction(ActionEvent event) |
4446 | 4446 | { |
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); | |
4449 | 4449 | openSupport("supportButtonOnAction",selectedLocale, false); |
4450 | 4450 | } |
4451 | 4451 |
@@ -4614,7 +4614,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
4614 | 4614 | public void status(String message) { Platform.runLater(() -> { statusLabel.setText(message.replace("\r\n", "")); }); } |
4615 | 4615 | public void log(String message) { Platform.runLater(() -> { lineCounter++; logTextArea.appendText(message); if (lineCounter > 1000) { logTextArea.setText(message); lineCounter = 0; } }); } |
4616 | 4616 | 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); } }); } | |
4618 | 4618 | public void print(String message,boolean err) { if ( ! err ) { System.out.print(message); } else { System.err.print(message); } } |
4619 | 4619 | |
4620 | 4620 | public static void main(String[] args) { launch(args); } |
@@ -4628,15 +4628,15 @@ public class GUIFX extends Application implements UI, Initializable | ||
4628 | 4628 | selectLanguage.setVisible(false); |
4629 | 4629 | if (Voice.sound_Is_Enabled) // turn sound off |
4630 | 4630 | { |
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); | |
4633 | 4633 | setSound(false); prefs.put("Sound", "Disabled"); flushPrefs(prefs); |
4634 | 4634 | } |
4635 | 4635 | else // turn sound on |
4636 | 4636 | { |
4637 | 4637 | 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); | |
4640 | 4640 | } |
4641 | 4641 | } |
4642 | 4642 | 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 | ||
4644 | 4644 | selectLanguage.setVisible(false); |
4645 | 4645 | if (Voice.voice_Is_Enabled) // turn voice off |
4646 | 4646 | { |
4647 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4647 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4648 | 4648 | Voice.play(this, Audio.VOI_VOICE_DISABLED,Audio.AUDIO_CODEC); |
4649 | 4649 | setVoice(false); prefs.put("Voice", "Disabled"); flushPrefs(prefs); |
4650 | 4650 | } |
4651 | 4651 | else // turn voice on |
4652 | 4652 | { |
4653 | 4653 | 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); | |
4655 | 4655 | Voice.play(this, Audio.VOI_VOICE_ENABLED,Audio.AUDIO_CODEC); |
4656 | 4656 | } |
4657 | 4657 | } |
@@ -4662,16 +4662,16 @@ public class GUIFX extends Application implements UI, Initializable | ||
4662 | 4662 | selectLanguage.getSelectionModel().select(getLanguageName((LanguageList<Language>) languagesList, selectedLanguageCode)); |
4663 | 4663 | selectLanguage.scrollTo(getLanguageName((LanguageList<Language>) languagesList, selectedLanguageCode)); |
4664 | 4664 | selectLanguage.requestFocus(); |
4665 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4665 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4666 | 4666 | } |
4667 | 4667 | else // Animation |
4668 | 4668 | { |
4669 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4669 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4670 | 4670 | if (selectLanguage.isVisible()) { selectLanguage.setVisible(false); } |
4671 | 4671 | else |
4672 | 4672 | { |
4673 | 4673 | 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); } | |
4675 | 4675 | } |
4676 | 4676 | } |
4677 | 4677 | }); |
@@ -4692,14 +4692,14 @@ public class GUIFX extends Application implements UI, Initializable | ||
4692 | 4692 | if ( selectLanguage.getSelectionModel().getSelectedItem().equals(name) ) |
4693 | 4693 | { |
4694 | 4694 | // 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; } | |
4698 | 4698 | } |
4699 | 4699 | } |
4700 | 4700 | } |
4701 | 4701 | } |
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 | |
4703 | 4703 | }); |
4704 | 4704 | } |
4705 | 4705 |
@@ -4709,7 +4709,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
4709 | 4709 | { |
4710 | 4710 | if (event.getText().matches("[a-zA-Z]")) |
4711 | 4711 | { |
4712 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4712 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4713 | 4713 | for (String name: getInstalledLanguageNamesList((LanguageList<Language>) languagesList, false)) |
4714 | 4714 | { |
4715 | 4715 | // 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 | ||
4723 | 4723 | } |
4724 | 4724 | else if ((event.getCode() == KeyCode.ESCAPE)) |
4725 | 4725 | { |
4726 | - new Sound().play(this, Audio.SND_KEYPRESS,Audio.AUDIO_CODEC); | |
4726 | + new AudioPlayer().play(this, Audio.SND_KEYPRESS,Audio.AUDIO_CODEC); | |
4727 | 4727 | selectLanguage.setVisible(false); |
4728 | 4728 | } |
4729 | 4729 | else if ( |
@@ -4732,7 +4732,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
4732 | 4732 | || (event.getCode() == KeyCode.HOME) || (event.getCode() == KeyCode.END) |
4733 | 4733 | ) |
4734 | 4734 | { |
4735 | - new Sound().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4735 | + new AudioPlayer().play(this, Audio.SND_BUTTON,Audio.AUDIO_CODEC); | |
4736 | 4736 | } |
4737 | 4737 | else if (event.getCode() == KeyCode.ENTER) |
4738 | 4738 | { |
@@ -4746,14 +4746,14 @@ public class GUIFX extends Application implements UI, Initializable | ||
4746 | 4746 | { |
4747 | 4747 | if ( selectLanguage.getSelectionModel().getSelectedItem().equals(name) ) |
4748 | 4748 | { |
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; } | |
4752 | 4752 | } |
4753 | 4753 | } |
4754 | 4754 | } |
4755 | 4755 | } |
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 | |
4757 | 4757 | } |
4758 | 4758 | }); |
4759 | 4759 | } |
@@ -4786,7 +4786,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
4786 | 4786 | |
4787 | 4787 | @FXML private void pwdFieldOnMouseClicked(MouseEvent event) |
4788 | 4788 | { |
4789 | - new Sound().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC); | |
4789 | + new AudioPlayer().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC); | |
4790 | 4790 | ugMessage = new Message(password_enter, 48, false, false, true, false, Voice.VOI_CONFIRM_PASS_WITH_ENTER, 0); |
4791 | 4791 | userGuidanceMessage(ugMessage); |
4792 | 4792 | setFont(pwdField);setFont(pwdtxtField); |
@@ -4797,7 +4797,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
4797 | 4797 | // log("Pass: " + pwdField.getText() + " length: " + pwdField.getText().length() + event.getCode(), true, true, true, false, false); |
4798 | 4798 | if (event.getCode() == KeyCode.ENTER) |
4799 | 4799 | { |
4800 | - new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); | |
4800 | + new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); | |
4801 | 4801 | passwordHeaderLabel.setText(password_set); |
4802 | 4802 | settingPassword = false; |
4803 | 4803 | tgtFileChooserPropertyCheck(true); |
@@ -4818,7 +4818,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
4818 | 4818 | |
4819 | 4819 | @FXML private void pwdtxtFieldOnMouseClicked(MouseEvent event) |
4820 | 4820 | { |
4821 | - new Sound().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC); | |
4821 | + new AudioPlayer().play(this, Audio.SND_SELECT,Audio.AUDIO_CODEC); | |
4822 | 4822 | ugMessage = new Message(password_enter, 48, false, false, true, false, Voice.VOI_CONFIRM_PASS_WITH_ENTER, 0); userGuidanceMessage(ugMessage); |
4823 | 4823 | setFont(pwdField);setFont(pwdtxtField); |
4824 | 4824 | } |
@@ -4827,7 +4827,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
4827 | 4827 | { |
4828 | 4828 | if (event.getCode() == KeyCode.ENTER) |
4829 | 4829 | { |
4830 | - new Sound().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); | |
4830 | + new AudioPlayer().play(this, Audio.SND_INPUT_OK,Audio.AUDIO_CODEC); | |
4831 | 4831 | passwordHeaderLabel.setText(password_set); |
4832 | 4832 | settingPassword = false; |
4833 | 4833 | tgtFileChooserPropertyCheck(true); |
@@ -4875,8 +4875,8 @@ public class GUIFX extends Application implements UI, Initializable | ||
4875 | 4875 | @FXML private void logsLabelOnMouseExited(MouseEvent event) { Platform.runLater(() -> { logsLabel.setTextFill(Color.GREY); }); } |
4876 | 4876 | @FXML private void logsLabelOnMouseClicked(MouseEvent event) |
4877 | 4877 | { |
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); | |
4880 | 4880 | Thread shareThread; shareThread = new Thread(() -> |
4881 | 4881 | { |
4882 | 4882 | Version.openLogDir(guifx); |
@@ -4888,14 +4888,14 @@ public class GUIFX extends Application implements UI, Initializable | ||
4888 | 4888 | |
4889 | 4889 | @FXML private void supportLabelOnMouseClicked(MouseEvent event) |
4890 | 4890 | { |
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); | |
4893 | 4893 | openSupport("supportButtonOnAction",selectedLocale, false); |
4894 | 4894 | } |
4895 | 4895 | |
4896 | 4896 | @FXML private void updateLabelOnMouseClicked(MouseEvent event) |
4897 | 4897 | { |
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); }); | |
4899 | 4899 | Platform.runLater(() -> { checkUpdate( true ); }); |
4900 | 4900 | } |
4901 | 4901 |
@@ -4927,7 +4927,7 @@ public class GUIFX extends Application implements UI, Initializable | ||
4927 | 4927 | @FXML |
4928 | 4928 | private void commandLabelOnMouseClicked(MouseEvent event) |
4929 | 4929 | { |
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); | |
4931 | 4931 | log(Command.getCommandLine(!encryptButton.isDisabled(), !decryptButton.isDisabled()) + "\r\n", false, true, false, false, false); |
4932 | 4932 | } |
4933 | 4933 | } |
\ No newline at end of file |
@@ -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 | -} |
@@ -179,8 +179,8 @@ public class Support extends Application implements Initializable | ||
179 | 179 | |
180 | 180 | @FXML private void facebookImageViewOnMouseClicked(MouseEvent event) |
181 | 181 | { |
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); | |
184 | 184 | // play(SND_OPEN,Audio.AUDIO_CODEC); |
185 | 185 | Thread shareThread; shareThread = new Thread(() -> |
186 | 186 | { |
@@ -202,8 +202,8 @@ public class Support extends Application implements Initializable | ||
202 | 202 | |
203 | 203 | @FXML private void twitterImageViewOnMouseClicked(MouseEvent event) |
204 | 204 | { |
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); | |
207 | 207 | Thread shareThread; shareThread = new Thread(() -> |
208 | 208 | { |
209 | 209 | String urlTarget = "https://twitter.com/intent/tweet"; |
@@ -226,8 +226,8 @@ public class Support extends Application implements Initializable | ||
226 | 226 | |
227 | 227 | @FXML private void linkedInImageViewOnMouseClicked(MouseEvent event) |
228 | 228 | { |
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); | |
231 | 231 | Thread shareThread; shareThread = new Thread(() -> |
232 | 232 | { |
233 | 233 | // |
@@ -251,8 +251,8 @@ public class Support extends Application implements Initializable | ||
251 | 251 | |
252 | 252 | @FXML private void pinterestImageViewOnMouseClicked(MouseEvent event) |
253 | 253 | { |
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); | |
256 | 256 | Thread shareThread; shareThread = new Thread(() -> |
257 | 257 | { |
258 | 258 | String urlTarget = "https://pin.it/72kLWc2"; |
@@ -315,8 +315,8 @@ public class Support extends Application implements Initializable | ||
315 | 315 | |
316 | 316 | @FXML private void homeImageViewOnMouseClicked(MouseEvent event) |
317 | 317 | { |
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); | |
320 | 320 | Thread homeOpenThread; homeOpenThread = new Thread(() -> { Version.openWebSite(guifx, Version.HOMEPAGEURLSTRINGARRAY,"GET"); closeWindow(); }); |
321 | 321 | homeOpenThread.setName("homeOpenThread"); |
322 | 322 | homeOpenThread.setDaemon(true); |
@@ -325,8 +325,8 @@ public class Support extends Application implements Initializable | ||
325 | 325 | |
326 | 326 | @FXML private void videoImageViewOnMouseClicked(MouseEvent event) |
327 | 327 | { |
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); | |
330 | 330 | Thread videoOpenThread; videoOpenThread = new Thread(() -> { Version.openWebSite(guifx, Version.VIDEOPAGEURLSTRINGARRAY,"HEAD"); closeWindow(); }); |
331 | 331 | videoOpenThread.setName("videoOpenThread"); |
332 | 332 | videoOpenThread.setDaemon(true); |
@@ -335,8 +335,8 @@ public class Support extends Application implements Initializable | ||
335 | 335 | |
336 | 336 | @FXML private void supportImageViewOnMouseClicked(MouseEvent event) |
337 | 337 | { |
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); | |
340 | 340 | Thread supportOpenThread; supportOpenThread = new Thread(() -> { Version.openWebSite(guifx, Version.SUPPORTPAGEURLSTRINGARRAY,"GET"); closeWindow(); }); |
341 | 341 | supportOpenThread.setName("supportOpenThread"); |
342 | 342 | supportOpenThread.setDaemon(true); |
@@ -345,8 +345,8 @@ public class Support extends Application implements Initializable | ||
345 | 345 | |
346 | 346 | @FXML private void emailImageViewOnMouseClicked(MouseEvent event) |
347 | 347 | { |
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); | |
350 | 350 | |
351 | 351 | String to = Version.SUPPORTEMAIL; |
352 | 352 | String cc = ""; |
@@ -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 | +} |
@@ -1 +1 @@ | ||
1 | -6.5.0 | |
\ No newline at end of file | ||
1 | +6.6.0 | |
\ No newline at end of file |
@@ -1,4 +1,4 @@ | ||
1 | -[Version] = {6.5.0} | |
1 | +[Version] = {6.6.0} | |
2 | 2 | [] = {} ================================================================ |
3 | 3 | [Release Notes] = {You are using a very old version of FinalCrypt} |
4 | 4 | [Release Message] = {Please visit the website & download the latest} |
@@ -12,17 +12,20 @@ | ||
12 | 12 | [Version Notes] = {Improved User Interface & File Manager behavior} |
13 | 13 | [Version Notes] = {Improved UserGuidance, Display & Button Layout} |
14 | 14 | [] = {} ---------------------------------------------------------------- |
15 | -[Upgrade Notes] = {Upgrade 5 (2020-11-02)} | |
15 | +[Upgrade Notes] = {Upgrade 6 (2021-01-02)} | |
16 | 16 | [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} | |
20 | 24 | |
21 | 25 | [] = {} ---------------------------------------------------------------- |
22 | -[Update Notes] = {Update 0 (2020-11-11)} | |
26 | +[Update Notes] = {Update 0 (2021-01-02)} | |
23 | 27 | [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} | |
26 | 29 | [] = {} -------------------------------------------------------------------------------------------------------- |
27 | 30 | [Alert Subject_] = {} |
28 | 31 | [Alert Notes_] = {} |
@@ -484,23 +484,31 @@ public class Version | ||
484 | 484 | { |
485 | 485 | String userAgent = getUserAgent("(HTTP)"); |
486 | 486 | |
487 | +// URL | |
487 | 488 | URL url = null; |
488 | 489 | 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; } |
489 | 490 | 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; } | |
496 | 503 | |
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; } | |
499 | 507 | |
500 | 508 | if ((responseCode >= 200) && (responseCode < 400)) |
501 | 509 | { |
502 | 510 | 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; } | |
504 | 512 | |
505 | 513 | String responseLine; |
506 | 514 | StringBuffer response = new StringBuffer(); |
@@ -511,7 +519,7 @@ public class Version | ||
511 | 519 | } } catch (IOException ex) { checkOnlineFailed = true; ui.log("Error: httpGetRequest IOException: responseReader.readLine(): " + ex.getMessage() + "\r\n", false, true, true, true, false); } |
512 | 520 | try { responseReader.close(); } catch (IOException ex) { checkOnlineFailed = true; ui.log("Error: httpGetRequest IOException: responseReader.close(): " + ex.getMessage() + "\r\n", false, true, true, true, false); } |
513 | 521 | |
514 | - httpConnection.disconnect(); | |
522 | + httpURLConnection.disconnect(); | |
515 | 523 | |
516 | 524 | return response.toString(); |
517 | 525 | } 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 | ||
522 | 530 | { |
523 | 531 | String userAgent = getUserAgent("(HTTPS)"); |
524 | 532 | |
533 | +// URL | |
525 | 534 | URL url = null; |
526 | 535 | 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); } |
527 | 536 | 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); | |
536 | 549 | |
550 | +// ResponseCodes | |
537 | 551 | 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); } | |
539 | 553 | |
540 | 554 | if ((responseCode >= 200) && (responseCode < 400)) |
541 | 555 | { |
542 | - | |
543 | 556 | 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); } | |
545 | 558 | |
546 | 559 | String responseLine; |
547 | 560 | StringBuffer response = new StringBuffer(); |
548 | 561 | |
549 | - try { while ((responseLine = responseReader.readLine()) != null) | |
562 | + try | |
550 | 563 | { |
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); } | |
553 | 569 | try { responseReader.close(); } catch (IOException ex) { checkOnlineFailed = true; ui.log("Error: IOException: responseReader.close(): " + ex.getMessage() + "\r\n", false, true, true, true, false); } |
554 | 570 | |
555 | - httpConnection.disconnect(); | |
571 | + httpsURLConnection.disconnect(); | |
556 | 572 | |
557 | 573 | return response.toString(); |
558 | 574 | } else { checkOnlineFailed = true; ui.log("Error: HTTP Response Code: " + responseCode + "\r\n", false, true, true, true, false); } |
@@ -566,20 +582,28 @@ public class Version | ||
566 | 582 | latestVersionIsKnown = false; |
567 | 583 | latestOverallVersionString = "Unknown"; |
568 | 584 | |
569 | - loop: for(String remoteVERSION2FileString:REMOTEVERSIONFILEURLSTRINGARRAY) | |
585 | +// Loop through array | |
586 | + loop: for(String remoteVERSION2FileURLString:REMOTEVERSIONFILEURLSTRINGARRAY) | |
570 | 587 | { |
571 | 588 | checkOnlineFailed = false; |
572 | 589 | |
573 | 590 | Thread logThread; |
574 | 591 | logThread = new Thread(() -> |
575 | 592 | { |
576 | - ui.log("Fetch: " + remoteVERSION2FileString + "\r\n", false, true, true, false, false); | |
593 | + ui.log("Fetch: " + remoteVERSION2FileURLString + "\r\n", false, true, true, false, false); | |
577 | 594 | }); |
578 | 595 | logThread.setName("logThread"); |
579 | 596 | logThread.setDaemon(true); |
580 | 597 | logThread.start(); |
581 | 598 | |
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 | + } | |
583 | 607 | |
584 | 608 | // ui.test("Remote Content: " + remoteContent + "\r\n\r\n"); |
585 | 609 | if ((remoteContent != null) && (! checkOnlineFailed)) |
@@ -59,3 +59,11 @@ the java.util.prefs.MacOSXPreferencesFactory class should be in rt.jar in JDK 1. | ||
59 | 59 | See hg.openjdk.java.net/macosx-port/macosx-port/jdk/file/… for the source code. |
60 | 60 | JDK 8 all the items in java.util.prefs: |
61 | 61 | */ |
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(); |