Improvements in auto-config-ini

This commit is contained in:
DSR! 2023-02-23 16:55:14 -03:00
parent 8b3b58799e
commit 458d2fa3f2
3 changed files with 44 additions and 21 deletions

View File

@ -62,12 +62,56 @@ Section ""
;MessageBox MB_OK "$CONFIG_PATH"
${If} $CHECK_TYPE == "sync"
Call ConfigSectionSync
${GetSectionNames} "$CONFIG_PATH" "ReadSectionSyncCallback"
${Else}
${GetSectionNames} "$CONFIG_PATH" "ReadSectionCleanCallback"
${EndIf}
SectionEnd
Function ConfigSectionSync
; sync "disable_clean" from old file to new
ReadINIStr $R0 "$OLD_CONFIG_PATH" "UpdaterConfig" "disable_clean"
WriteINIStr "$CONFIG_PATH" "UpdaterConfig" "disable_clean" "$R0"
; sync "disable_repack" from old file to new
ReadINIStr $R0 "$OLD_CONFIG_PATH" "UpdaterConfig" "disable_repack"
WriteINIStr "$CONFIG_PATH" "UpdaterConfig" "disable_repack" "$R0"
; sync "disable_progress" from old file to new
ReadINIStr $R0 "$OLD_CONFIG_PATH" "UpdaterConfig" "disable_progress"
WriteINIStr "$CONFIG_PATH" "UpdaterConfig" "disable_progress" "$R0"
; sync "save_format_type" from old file to new
ReadINIStr $R0 "$OLD_CONFIG_PATH" "UpdaterConfig" "save_format_type"
WriteINIStr "$CONFIG_PATH" "UpdaterConfig" "save_format_type" "$R0"
; sync "use_github_api" from old file to new
ReadINIStr $R0 "$OLD_CONFIG_PATH" "UpdaterConfig" "use_github_api"
WriteINIStr "$CONFIG_PATH" "UpdaterConfig" "use_github_api" "$R0"
FunctionEnd
Function ReadSectionSyncCallback
; analyze all except the updater config and updater self updater
${If} $9 != "UpdaterConfig"
${AndIf} $9 != "UpdaterAutoUpdater"
; sync "local_version" from old file to new
ReadINIStr $R0 "$OLD_CONFIG_PATH" "$9" "local_version"
WriteINIStr "$CONFIG_PATH" "$9" "local_version" "$R0"
; sync "merge" from old file to new
ReadINIStr $R0 "$OLD_CONFIG_PATH" "$9" "merge"
${If} $R0 != ""
WriteINIStr "$CONFIG_PATH" "$9" "merge" "$R0"
${EndIf}
${EndIf}
; move on to the next
Push $0
FunctionEnd
Function ReadSectionCleanCallback
; analyze all except the updater config and updater self updater
${If} $9 != "UpdaterConfig"
@ -83,24 +127,3 @@ Function ReadSectionCleanCallback
; move on to the next
Push $0
FunctionEnd
Function ReadSectionSyncCallback
; analyze all except the updater config and updater self updater
${If} $9 != "UpdaterConfig"
${AndIf} $9 != "UpdaterAutoUpdater"
; sync "local_version" from old file to new
ReadINIStr $R0 "$OLD_CONFIG_PATH" "$9" "local_version"
WriteINIStr "$CONFIG_PATH" "$9" "local_version" "$R0"
; sync "merge" from old file to new
ReadINIStr $R1 "$OLD_CONFIG_PATH" "$9" "merge"
${If} $R1 != ""
WriteINIStr "$CONFIG_PATH" "$9" "merge" "$R1"
${EndIf}
${EndIf}
; move on to the next
Push $0
FunctionEnd

Binary file not shown.