备份txt目录规则

pull/306/head
gedoor 4 years ago
parent 9a98bc0a8d
commit 89d4ab5b66
  1. 2
      app/src/main/java/io/legado/app/help/storage/Backup.kt
  2. 3
      app/src/main/java/io/legado/app/help/storage/Restore.kt

@ -30,6 +30,7 @@ object Backup {
"rssSource.json", "rssSource.json",
"rssStar.json", "rssStar.json",
"replaceRule.json", "replaceRule.json",
"txtTocRule.json",
ReadBookConfig.readConfigFileName, ReadBookConfig.readConfigFileName,
"config.xml" "config.xml"
) )
@ -55,6 +56,7 @@ object Backup {
writeListToJson(App.db.rssSourceDao().all, "rssSource.json", backupPath) writeListToJson(App.db.rssSourceDao().all, "rssSource.json", backupPath)
writeListToJson(App.db.rssStarDao().all, "rssStar.json", backupPath) writeListToJson(App.db.rssStarDao().all, "rssStar.json", backupPath)
writeListToJson(App.db.replaceRuleDao().all, "replaceRule.json", backupPath) writeListToJson(App.db.replaceRuleDao().all, "replaceRule.json", backupPath)
writeListToJson(App.db.txtTocRule().all, "txtTocRule.json", backupPath)
GSON.toJson(ReadBookConfig.configList)?.let { GSON.toJson(ReadBookConfig.configList)?.let {
FileUtils.createFileIfNotExist(backupPath + File.separator + ReadBookConfig.readConfigFileName) FileUtils.createFileIfNotExist(backupPath + File.separator + ReadBookConfig.readConfigFileName)
.writeText(it) .writeText(it)

@ -131,6 +131,9 @@ object Restore {
fileToListT<ReplaceRule>(path, "replaceRule.json")?.let { fileToListT<ReplaceRule>(path, "replaceRule.json")?.let {
App.db.replaceRuleDao().insert(*it.toTypedArray()) App.db.replaceRuleDao().insert(*it.toTypedArray())
} }
fileToListT<TxtTocRule>(path, "txtTocRule.json")?.let {
App.db.txtTocRule().insert(*it.toTypedArray())
}
} }
} }

Loading…
Cancel
Save