Skip to content

Commit

Permalink
refactor: util package structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Sculas committed Aug 3, 2022
1 parent 2572cd0 commit 01cf3fb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/app/revanced/patcher/util/dex/DexFile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import java.io.InputStream
/**
* Wrapper for dex files.
* @param name The original name of the dex file.
* @param dexFileInputStream The dex file as [InputStream].
* @param stream The dex file as [InputStream].
*/
data class DexFile(val name: String, val dexFileInputStream: InputStream)
data class DexFile(val name: String, val stream: InputStream)
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package app.revanced.patcher.util.patch.base
package app.revanced.patcher.util.patch

import app.revanced.patcher.data.Data
import app.revanced.patcher.patch.Patch
import java.io.File

/**
* @param patchBundlePath The path to the patch bundle.
* @param path The path to the patch bundle.
*/
abstract class PatchBundle(patchBundlePath: String) : File(patchBundlePath) {
abstract class PatchBundle(path: String) : File(path) {
internal fun loadPatches(classLoader: ClassLoader, classNames: Iterator<String>) = buildList {
classNames.forEach { className ->
for (className in classNames) {
val clazz = classLoader.loadClass(className)
if (!clazz.isAnnotationPresent(app.revanced.patcher.patch.annotations.Patch::class.java)) return@forEach
if (!clazz.isAnnotationPresent(app.revanced.patcher.patch.annotations.Patch::class.java)) continue
@Suppress("UNCHECKED_CAST") this.add(clazz as Class<out Patch<Data>>)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patcher.util.patch.util
package app.revanced.patcher.util.patch

internal class StringIterator<T, I : Iterator<T>>(
private val iterator: I,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package app.revanced.patcher.util.patch.implementation
package app.revanced.patcher.util.patch.impl

import app.revanced.patcher.util.patch.base.PatchBundle
import app.revanced.patcher.util.patch.util.StringIterator
import app.revanced.patcher.util.patch.PatchBundle
import app.revanced.patcher.util.patch.StringIterator
import org.jf.dexlib2.DexFileFactory

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package app.revanced.patcher.util.patch.implementation
package app.revanced.patcher.util.patch.impl

import app.revanced.patcher.util.patch.base.PatchBundle
import app.revanced.patcher.util.patch.util.StringIterator
import app.revanced.patcher.util.patch.PatchBundle
import app.revanced.patcher.util.patch.StringIterator
import java.net.URLClassLoader
import java.util.jar.JarFile

Expand Down

0 comments on commit 01cf3fb

Please sign in to comment.