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

Commit

Permalink
Added search in two level of directories
Browse files Browse the repository at this point in the history
Updated to 0.5
  • Loading branch information
soywiz committed Sep 18, 2016
1 parent d4109c7 commit c82a921
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ You can download a prebuild binary here, or just build from source:

## CHANGELOG

**0.5**

* Filtering feature
* Dumper Version/Compression Level display
* About dialog
* Added 2 level of subdirectories
* More translations

**0.4**

* Improved row selection
Expand Down
2 changes: 1 addition & 1 deletion resources/com/soywiz/vitaorganizer/currentVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4
0.5
29 changes: 23 additions & 6 deletions src/com/soywiz/vitaorganizer/tasks/UpdateFileListTask.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.soywiz.vitaorganizer.tasks

import com.soywiz.util.open2
import com.soywiz.vitaorganizer.*
import com.soywiz.util.DumperNamesHelper
import com.soywiz.util.DumperModules
import com.soywiz.util.DumperNames
import com.soywiz.util.DumperNamesHelper
import com.soywiz.util.open2
import com.soywiz.vitaorganizer.*
import com.soywiz.vitaorganizer.ext.getBytes
import java.io.File
import java.util.zip.ZipFile
Expand All @@ -14,9 +14,26 @@ class UpdateFileListTask : VitaTask() {
synchronized(VitaOrganizer.VPK_GAME_IDS) {
VitaOrganizer.VPK_GAME_IDS.clear()
}
val vpkFiles = File(VitaOrganizerSettings.vpkFolder).listFiles().filter { it.name.toLowerCase().endsWith(".vpk") }
status(Texts.format("STEP_ANALYZING_FILES", "folder" to VitaOrganizerSettings.vpkFolder))
for ((index, vpkFile) in File(VitaOrganizerSettings.vpkFolder).listFiles().filter { it.name.toLowerCase().endsWith(".vpk") }.withIndex()) {

val MAX_SUBDIRECTORY_LEVELS = 2

fun listVpkFiles(folder: File, level: Int = 0): List<File> {
val out = arrayListOf<File>()
if (level > MAX_SUBDIRECTORY_LEVELS) return out
for (child in folder.listFiles()) {
if (child.isDirectory) {
out += listVpkFiles(child, level = level + 1)
} else {
if (child.extension.toLowerCase() == "vpk") out += child
}
}
return out
}

val vpkFiles = listVpkFiles(File(VitaOrganizerSettings.vpkFolder))

for ((index, vpkFile) in vpkFiles.withIndex()) {
//println(vpkFile)
status(Texts.format("STEP_ANALYZING_ITEM", "name" to vpkFile.name, "current" to index + 1, "total" to vpkFiles.size))
try {
Expand All @@ -33,7 +50,7 @@ class UpdateFileListTask : VitaTask() {
val compressionLevel = if (paramsfo != null) paramsfo.method.toString() else ""

var dumper = DumperNames.UNKNOWN
for ( file in DumperModules.values() ) {
for (file in DumperModules.values()) {
val suprx = zip.getEntry(file.file)
if (suprx != null) {
dumper = DumperNamesHelper().findDumperBySize(suprx.size)
Expand Down

0 comments on commit c82a921

Please sign in to comment.