Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
Actually implement disconnecting from the ftp server, not just visually.
Browse files Browse the repository at this point in the history
Also says "disconnected" on statusbar when successfully disconnected
  • Loading branch information
gordon0001 committed Sep 22, 2016
1 parent 001757c commit e83e966
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
17 changes: 14 additions & 3 deletions src/com/soywiz/vitaorganizer/PsvitaDevice.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,17 @@ object PsvitaDevice {


retries@for (n in 0 until 5) {
println("Connecting to ftp $ip:$port...")
if (!ftp.isConnected) {
if (!ftp.isConnected()) {
println("Connecting to ftp $ip:$port...")
ftp.connect(ip, port)
ftp.login("", "")
println("Connected")
if(ftp.isConnected()) {
println("Connected")
}
else {
println("Could not connect ($n)");
break@retries
}
}
try {
ftp.noop()
Expand All @@ -101,6 +107,11 @@ object PsvitaDevice {
}
return ftp
}

fun disconnectFromFtp(): Boolean {
ftp.disconnect(true);
return !ftp.isConnected();
}

fun getGameIds() = connectedFtp().list("/ux0:/app").filter { i -> i.type == it.sauronsoftware.ftp4j.FTPFile.TYPE_DIRECTORY }.map { File(it.name).name }

Expand Down
6 changes: 5 additions & 1 deletion src/com/soywiz/vitaorganizer/VitaOrganizer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,17 @@ class VitaOrganizer : JPanel(BorderLayout()), StatusUpdater {
val button = this

fun disconnect() {
if(PsvitaDevice.disconnectFromFtp()) {
connected = false
button.text = connectText
synchronized(VITA_GAME_IDS) {
VITA_GAME_IDS.clear()
}
updateEntries()
statusLabel.text = Texts.format("DISCONNECTED")
updateStatus(Texts.format("DISCONNECTED"))
}
else
println("Failed to disconnect!")
}

fun connect(ip: String) {
Expand Down

2 comments on commit e83e966

@Wantedbra
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, I apologize for my English is the google translator!
Come on, the app works great pc, and I wonder if it is possible to use it in some way in the smart phone with android operating system? I've tried some java emulators, however without success! The only way that worked was installing linux on the smart phone with the tool "Linux Deploy". However, unable to access the files in the smart phone partition! For the installation process you create a virtual disk only for Linux, making the system independent file.

@soywiz
Copy link
Member

@soywiz soywiz commented on e83e966 Oct 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Wantedbra Let's discuss the android version here: #58

Please sign in to comment.