mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-06 23:24:26 +02:00
refactor: remove deprecated methods in ResourceData.kt
This commit is contained in:
parent
2b492e7a5e
commit
35749454ab
@ -15,16 +15,6 @@ class ResourceData(private val resourceCacheDirectory: File) : Data {
|
|||||||
fun forEach(action: (File) -> Unit) = resourceCacheDirectory.walkTopDown().forEach(action)
|
fun forEach(action: (File) -> Unit) = resourceCacheDirectory.walkTopDown().forEach(action)
|
||||||
fun get(path: String) = resolve(path)
|
fun get(path: String) = resolve(path)
|
||||||
|
|
||||||
fun replace(path: String, oldValue: String, newValue: String, oldValueIsRegex: Boolean = false) {
|
|
||||||
// TODO: buffer this somehow
|
|
||||||
val content = resolve(path).readText()
|
|
||||||
|
|
||||||
if (oldValueIsRegex) {
|
|
||||||
content.replace(Regex(oldValue), newValue)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getXmlEditor(path: String) = DomFileEditor(resolve(path))
|
fun getXmlEditor(path: String) = DomFileEditor(resolve(path))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,18 +30,6 @@ class ExampleResourcePatch : ResourcePatch() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// iterate through all available resources
|
|
||||||
data.forEach {
|
|
||||||
if (it.extension.lowercase() != "xml") return@forEach
|
|
||||||
|
|
||||||
data.replace(
|
|
||||||
it.path,
|
|
||||||
"\\ddip", // regex supported
|
|
||||||
"0dip",
|
|
||||||
true
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user