File tree Expand file tree Collapse file tree 6 files changed +0
-33
lines changed
Expand file tree Collapse file tree 6 files changed +0
-33
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,6 @@ import java.io.File
1212const val ICON =
1313 " https://www.dropbox.com/scl/fi/4o3busy75hk1mga2i665g/aries.png?rlkey=fp7yrxl5lz5ldfcjndsiikus2&st=m9ydm8op&dl=1"
1414
15- // URL of the openNotepad.scpt file
16- const val SCPT =
17- " https://www.dropbox.com/scl/fi/lppie7xcxbzloo860t7qg/openNotepad.scpt?rlkey=xv413n4dclvsjj6hdj580u0s6&st=1uk85psv&dl=1"
18-
1915/* *
2016 * Downloads a file from the specified URL and saves it to the given destination path.
2117 *
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ import util.extension.type
99import java.awt.Robot
1010import java.awt.event.KeyEvent
1111import java.io.File
12- import java.io.IOException
1312
1413class LinuxNotepad : Notepad {
1514 private val robot = Robot ()
@@ -19,7 +18,6 @@ class LinuxNotepad : Notepad {
1918 val homeDirectory = System .getProperty(" user.home" ) + File .separator + " Aries"
2019 }
2120
22- @Throws(IOException ::class )
2321 override fun openNotepad () {
2422 process =
2523 ProcessBuilder (" notepadqq" ).start().also {
@@ -31,10 +29,6 @@ class LinuxNotepad : Notepad {
3129 }
3230 }
3331
34- override fun writeText (text : String ) {
35- robot.type(text)
36- }
37-
3832 override fun deleteText () {
3933 robot.apply {
4034 control(KeyEvent .VK_A )
@@ -61,7 +55,6 @@ class LinuxNotepad : Notepad {
6155 robot.control(KeyEvent .VK_N )
6256 }
6357
64- @Throws(InterruptedException ::class )
6558 override fun closeNotepad () {
6659 robot.control(KeyEvent .VK_F4 )
6760 process?.waitFor()?.also { Logger .d(" Exited Notepad++ with code: $it " ) }
Original file line number Diff line number Diff line change @@ -21,10 +21,6 @@ class MacNotepad : Notepad {
2121 }
2222 }
2323
24- override fun writeText (text : String ) {
25- robot.type(text)
26- }
27-
2824 override fun deleteText () {
2925 robot.control(KeyEvent .VK_A )
3026 robot.type(KeyEvent .VK_BACK_SPACE )
Original file line number Diff line number Diff line change 11package util.notepad
22
3- import java.awt.AWTException
4- import java.io.IOException
5-
63interface Notepad {
7- @Throws(IOException ::class , InterruptedException ::class , AWTException ::class )
84 fun openNotepad ()
95
10- fun writeText (text : String )
11-
126 fun deleteText ()
137
148 fun addNewLine ()
@@ -17,6 +11,5 @@ interface Notepad {
1711
1812 fun openNewFile ()
1913
20- @Throws(InterruptedException ::class )
2114 fun closeNotepad ()
2215}
Original file line number Diff line number Diff line change @@ -4,8 +4,6 @@ import util.emu.Platform.Companion.currentPlatform
44import util.emu.Platform.LINUX
55import util.emu.Platform.MAC
66import util.emu.Platform.WINDOWS
7- import java.awt.AWTException
8- import java.io.IOException
97
108class NotepadProcessor {
119 private val notepad: Notepad =
@@ -16,11 +14,8 @@ class NotepadProcessor {
1614 else -> error(" Platform not supported" )
1715 }
1816
19- @Throws(IOException ::class , InterruptedException ::class , AWTException ::class )
2017 fun openNotepad () = notepad.openNotepad()
2118
22- fun writeText (text : String ) = notepad.writeText(text)
23-
2419 fun deleteText () = notepad.deleteText()
2520
2621 fun addNewLine () = notepad.addNewLine()
@@ -29,6 +24,5 @@ class NotepadProcessor {
2924
3025 fun openNewFile () = notepad.openNewFile()
3126
32- @Throws(InterruptedException ::class )
3327 fun closeNotepad () = notepad.closeNotepad()
3428}
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import util.extension.type
77import java.awt.Robot
88import java.awt.event.KeyEvent
99import java.io.File.separator
10- import java.io.IOException
1110import java.nio.file.Files
1211import java.nio.file.Paths
1312
@@ -23,14 +22,11 @@ class WinNotepad : Notepad {
2322 Files .createDirectories(Paths .get(homeDirectory))
2423 }
2524
26- @Throws(IOException ::class )
2725 override fun openNotepad () {
2826 process = ProcessBuilder (" C:\\ Program Files\\ Notepad++\\ notepad++.exe" ).start()
2927 robot.delay(1000 )
3028 }
3129
32- override fun writeText (text : String ) = robot.type(text)
33-
3430 override fun deleteText () {
3531 robot.control(KeyEvent .VK_A )
3632 robot.type(KeyEvent .VK_BACK_SPACE )
@@ -54,7 +50,6 @@ class WinNotepad : Notepad {
5450
5551 override fun openNewFile () = robot.control(KeyEvent .VK_N )
5652
57- @Throws(InterruptedException ::class )
5853 override fun closeNotepad () {
5954 process?.let {
6055 it.destroy()
You can’t perform that action at this time.
0 commit comments