Fix indent - using 2 spaces tabs

This commit is contained in:
Salah Benmoussati 2024-05-16 11:28:07 +02:00
parent a16b38faff
commit e51bb1f14e

View File

@ -45,275 +45,275 @@ Var PerUser
Var AllUser Var AllUser
Function uninstallSymphony Function uninstallSymphony
StrCpy $0 0 StrCpy $0 0
SetRegView 64 SetRegView 64
loop: loop:
EnumRegKey $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $0 EnumRegKey $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $0
StrCmp $1 "" done StrCmp $1 "" done
ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1" "DisplayName" ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1" "DisplayName"
${If} $2 == "Symphony" ${If} $2 == "Symphony"
ReadRegStr $3 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1" "UninstallString" ReadRegStr $3 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1" "UninstallString"
ExecWait '$3 /qn' ExecWait '$3 /qn'
${EndIf} ${EndIf}
IntOp $0 $0 + 1 IntOp $0 $0 + 1
Goto loop Goto loop
done: done:
FunctionEnd FunctionEnd
Function WriteFindAt Function WriteFindAt
Exch $0 ;file Exch $0 ;file
Exch Exch
Exch $1 ;key Exch $1 ;key
Exch 2 Exch 2
Exch $2 ;string to write Exch $2 ;string to write
Exch 2 Exch 2
Push $3 Push $3
Push $4 Push $4
FileOpen $4 $0 r FileOpen $4 $0 r
GetTempFileName $R0 $LOCALAPPDATA\Programs GetTempFileName $R0 $LOCALAPPDATA\Programs
FileOpen $R4 $R0 w FileOpen $R4 $R0 w
#FileOpen $8 "E:\Projects\NSIS\$1_0.txt" w This one is for debugging purpose if you need, open it #FileOpen $8 "E:\Projects\NSIS\$1_0.txt" w This one is for debugging purpose if you need, open it
#CopyFiles /SILENT $0 "E:\Projects\NSIS\$1.txt" #CopyFiles /SILENT $0 "E:\Projects\NSIS\$1.txt"
loopFind: loopFind:
FileRead $4 $R1 FileRead $4 $R1
${If} $R1 == "" ${If} $R1 == ""
#FileWrite $8 "At Error" #FileWrite $8 "At Error"
#FileWrite $8 "$R1$\r$\n" #FileWrite $8 "$R1$\r$\n"
Goto done Goto done
${Else} ${Else}
${StrContains} $R5 "$\"url$\":" $R1 ${StrContains} $R5 "$\"url$\":" $R1
#FileWrite $8 "$R1$\r$\n" #FileWrite $8 "$R1$\r$\n"
#FileWrite $8 "At loop find" #FileWrite $8 "At loop find"
StrCmp $R5 "" notfound StrCmp $R5 "" notfound
#FileWrite $8 "$R5$\r$\n" #FileWrite $8 "$R5$\r$\n"
#FileWrite $8 "At URL found" #FileWrite $8 "At URL found"
FileWrite $R4 "$R1" FileWrite $R4 "$R1"
FileWrite $R4 "$2$\r$\n" FileWrite $R4 "$2$\r$\n"
Goto loopFind Goto loopFind
notfound: notfound:
${StrContains} $R6 $1 $R1 ${StrContains} $R6 $1 $R1
#FileWrite $8 "At not found" #FileWrite $8 "At not found"
#FileWrite $8 "$R6$\r$\n" #FileWrite $8 "$R6$\r$\n"
StrCmp $R6 "" notmatchkey StrCmp $R6 "" notmatchkey
#FileWrite $8 "At key found" #FileWrite $8 "At key found"
#FileWrite $8 "$R6$\r$\n" #FileWrite $8 "$R6$\r$\n"
Goto loopFind Goto loopFind
notmatchkey: notmatchkey:
#FileWrite $8 "At key not found" #FileWrite $8 "At key not found"
#FileWrite $8 "$R1$\r$\n" #FileWrite $8 "$R1$\r$\n"
FileWrite $R4 $R1 FileWrite $R4 $R1
Goto loopFind Goto loopFind
${EndIf} ${EndIf}
done: done:
FileClose $R4 FileClose $R4
FileClose $4 FileClose $4
#FileWrite $8 "At done" #FileWrite $8 "At done"
#FileWrite $8 "$4$\r$\n" #FileWrite $8 "$4$\r$\n"
#FileWrite $8 "At done" #FileWrite $8 "At done"
#FileWrite $8 "$R4$\r$\n" #FileWrite $8 "$R4$\r$\n"
CopyFiles /SILENT $R0 $0 CopyFiles /SILENT $R0 $0
Delete $R0 Delete $R0
pop $0 pop $0
pop $1 pop $1
pop $2 pop $2
pop $3 pop $3
pop $4 pop $4
pop $5 pop $5
pop $6 pop $6
pop $R0 pop $R0
pop $R1 pop $R1
pop $R4 pop $R4
pop $R5 pop $R5
pop $R6 pop $R6
FunctionEnd FunctionEnd
!macro migrationFailed !macro migrationFailed
MessageBox MB_OK "Auto update migration not supported as there are two versions installed" MessageBox MB_OK "Auto update migration not supported as there are two versions installed"
!macroend !macroend
Function SearchAndReplace Function SearchAndReplace
${If} $PerUser == "exists" ${If} $PerUser == "exists"
${AndIf} $AllUser == "exists" ${AndIf} $AllUser == "exists"
!insertmacro migrationFailed !insertmacro migrationFailed
${ElseIf} $AllUser == "exists" ${ElseIf} $AllUser == "exists"
StrCpy $3 "$PROGRAMFILES64\Symphony\Symphony\config\Symphony.config" StrCpy $3 "$PROGRAMFILES64\Symphony\Symphony\config\Symphony.config"
${ElseIf} $PerUser == "exists" ${ElseIf} $PerUser == "exists"
StrCpy $3 "$LOCALAPPDATA\Programs\Symphony\Symphony\config\Symphony.config" StrCpy $3 "$LOCALAPPDATA\Programs\Symphony\Symphony\config\Symphony.config"
${EndIf} ${EndIf}
pop $0 pop $0
pop $1 pop $1
StrCpy $4 "$\t$\"$0$\": $1," StrCpy $4 "$\t$\"$0$\": $1,"
#FileOpen $8 "E:\Projects\NSIS\text.txt" w #FileOpen $8 "E:\Projects\NSIS\text.txt" w
#FileWrite $8 "$0$\r$\n" #FileWrite $8 "$0$\r$\n"
#FileWrite $8 "$1$\r$\n" #FileWrite $8 "$1$\r$\n"
#FileWrite $8 "$4$\r$\n" #FileWrite $8 "$4$\r$\n"
#FileClose $8 #FileClose $8
#LogText $0 #LogText $0
#DetailPrint $0 #DetailPrint $0
#DetailPrint $1 #DetailPrint $1
#DetailPrint $4 #DetailPrint $4
# Find the term in the config # Find the term in the config
IfFileExists $3 0 +2 IfFileExists $3 0 +2
Push $4 Push $4
Push $0 Push $0
Push $3 Push $3
Call WriteFindAt Call WriteFindAt
Pop $0 Pop $0
Pop $1 Pop $1
Pop $2 Pop $2
Pop $3 Pop $3
Pop $4 Pop $4
FunctionEnd FunctionEnd
# isPodUrlEditable # isPodUrlEditable
Function updateConfigIsPodUrlEditable Function updateConfigIsPodUrlEditable
push true push true
push isPodUrlEditable push isPodUrlEditable
call SearchAndReplace call SearchAndReplace
FunctionEnd FunctionEnd
# forceAutoUpdate # forceAutoUpdate
Function updateConfigForceAutoUpdate Function updateConfigForceAutoUpdate
push false push false
push forceAutoUpdate push forceAutoUpdate
call SearchAndReplace call SearchAndReplace
FunctionEnd FunctionEnd
# enableBrowserLogin # enableBrowserLogin
Function updateConfigEnableBrowserLogin Function updateConfigEnableBrowserLogin
push false push false
push enableBrowserLogin push enableBrowserLogin
call SearchAndReplace call SearchAndReplace
FunctionEnd FunctionEnd
# browserLoginAutoConnect # browserLoginAutoConnect
Function updateConfigBrowserLoginAutoConnect Function updateConfigBrowserLoginAutoConnect
push false push false
push browserLoginAutoConnect push browserLoginAutoConnect
call SearchAndReplace call SearchAndReplace
FunctionEnd FunctionEnd
# betaAutoUpdateChannelEnabled # betaAutoUpdateChannelEnabled
Function updateConfigBetaAutoUpdateChannelEnabled Function updateConfigBetaAutoUpdateChannelEnabled
push true push true
push betaAutoUpdateChannelEnabled push betaAutoUpdateChannelEnabled
call SearchAndReplace call SearchAndReplace
FunctionEnd FunctionEnd
# latestAutoUpdateChannelEnabled # latestAutoUpdateChannelEnabled
Function updateConfigLatestAutoUpdateChannelEnabled Function updateConfigLatestAutoUpdateChannelEnabled
push true push true
push latestAutoUpdateChannelEnabled push latestAutoUpdateChannelEnabled
call SearchAndReplace call SearchAndReplace
FunctionEnd FunctionEnd
Function scriptMigration Function scriptMigration
call updateConfigIsPodUrlEditable call updateConfigIsPodUrlEditable
call updateConfigForceAutoUpdate call updateConfigForceAutoUpdate
call updateConfigEnableBrowserLogin call updateConfigEnableBrowserLogin
call updateConfigBrowserLoginAutoConnect call updateConfigBrowserLoginAutoConnect
call updateConfigBetaAutoUpdateChannelEnabled call updateConfigBetaAutoUpdateChannelEnabled
call updateConfigLatestAutoUpdateChannelEnabled call updateConfigLatestAutoUpdateChannelEnabled
FunctionEnd FunctionEnd
!macro copySystemGlobalConfig !macro copySystemGlobalConfig
IfFileExists $PROGRAMFILES64\Symphony\Symphony\config\Symphony.config 0 +2 IfFileExists $PROGRAMFILES64\Symphony\Symphony\config\Symphony.config 0 +2
CopyFiles /SILENT $PROGRAMFILES64\Symphony\Symphony\config\Symphony.config $WINDIR\Temp\temp-sys-Symphony.config CopyFiles /SILENT $PROGRAMFILES64\Symphony\Symphony\config\Symphony.config $WINDIR\Temp\temp-sys-Symphony.config
!macroend !macroend
!macro copyLocalGlobalConfig !macro copyLocalGlobalConfig
IfFileExists $LOCALAPPDATA\Programs\Symphony\Symphony\config\Symphony.config 0 +2 IfFileExists $LOCALAPPDATA\Programs\Symphony\Symphony\config\Symphony.config 0 +2
CopyFiles /SILENT $LOCALAPPDATA\Programs\Symphony\Symphony\config\Symphony.config $LOCALAPPDATA\Temp\temp-local-Symphony.config CopyFiles /SILENT $LOCALAPPDATA\Programs\Symphony\Symphony\config\Symphony.config $LOCALAPPDATA\Temp\temp-local-Symphony.config
!macroend !macroend
!macro replaceSystemGlobalConfig !macro replaceSystemGlobalConfig
IfFileExists $WINDIR\Temp\temp-sys-Symphony.config 0 +2 IfFileExists $WINDIR\Temp\temp-sys-Symphony.config 0 +2
CopyFiles /SILENT $WINDIR\Temp\temp-sys-Symphony.config $PROGRAMFILES64\Symphony\Symphony\config\Symphony.config CopyFiles /SILENT $WINDIR\Temp\temp-sys-Symphony.config $PROGRAMFILES64\Symphony\Symphony\config\Symphony.config
!macroend !macroend
!macro replaceLocalGlobalConfig !macro replaceLocalGlobalConfig
IfFileExists $LOCALAPPDATA\Temp\temp-local-Symphony.config 0 +2 IfFileExists $LOCALAPPDATA\Temp\temp-local-Symphony.config 0 +2
CopyFiles /SILENT $LOCALAPPDATA\Temp\temp-local-Symphony.config $LOCALAPPDATA\Programs\Symphony\Symphony\config\Symphony.config CopyFiles /SILENT $LOCALAPPDATA\Temp\temp-local-Symphony.config $LOCALAPPDATA\Programs\Symphony\Symphony\config\Symphony.config
!macroend !macroend
!macro bothM !macro bothM
MessageBox MB_OK "Auto update not supported as there are two versions installed" MessageBox MB_OK "Auto update not supported as there are two versions installed"
!macroend !macroend
!macro perUserM !macro perUserM
call scriptMigration call scriptMigration
!insertmacro copyLocalGlobalConfig !insertmacro copyLocalGlobalConfig
Call uninstallSymphony Call uninstallSymphony
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "$LOCALAPPDATA\Programs\Symphony\Symphony" WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "$LOCALAPPDATA\Programs\Symphony\Symphony"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "$LOCALAPPDATA\Programs\Symphony\Symphony" WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "$LOCALAPPDATA\Programs\Symphony\Symphony"
!macroend !macroend
!macro allUserM !macro allUserM
${IfNot} ${UAC_IsAdmin} ${IfNot} ${UAC_IsAdmin}
ShowWindow $HWNDPARENT ${SW_HIDE} ShowWindow $HWNDPARENT ${SW_HIDE}
!insertmacro UAC_RunElevated !insertmacro UAC_RunElevated
Quit Quit
${endif} ${endif}
call scriptMigration call scriptMigration
!insertmacro copySystemGlobalConfig !insertmacro copySystemGlobalConfig
Call uninstallSymphony Call uninstallSymphony
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "$PROGRAMFILES64\Symphony\Symphony" WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "$PROGRAMFILES64\Symphony\Symphony"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "$PROGRAMFILES64\Symphony\Symphony" WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "$PROGRAMFILES64\Symphony\Symphony"
!macroend !macroend
!macro abortM !macro abortM
; MessageBox MB_OK "Something went wrong!! Could not find existing SDA" ; MessageBox MB_OK "Something went wrong!! Could not find existing SDA"
!macroend !macroend
!macro validateInstallation !macro validateInstallation
IfFileExists $PROGRAMFILES64\Symphony\Symphony\Symphony.exe 0 +2 IfFileExists $PROGRAMFILES64\Symphony\Symphony\Symphony.exe 0 +2
StrCpy $AllUser "exists" StrCpy $AllUser "exists"
IfFileExists $LOCALAPPDATA\Programs\Symphony\Symphony\Symphony.exe 0 +2 IfFileExists $LOCALAPPDATA\Programs\Symphony\Symphony\Symphony.exe 0 +2
StrCpy $PerUser "exists" StrCpy $PerUser "exists"
!macroend !macroend
!macro preInit !macro preInit
!insertmacro validateInstallation !insertmacro validateInstallation
${If} $PerUser == "exists" ${If} $PerUser == "exists"
${AndIf} $AllUser == "exists" ${AndIf} $AllUser == "exists"
!insertmacro bothM !insertmacro bothM
${ElseIf} $PerUser == "exists" ${ElseIf} $PerUser == "exists"
!insertmacro perUserM !insertmacro perUserM
${ElseIf} $AllUser == "exists" ${ElseIf} $AllUser == "exists"
!insertmacro allUserM !insertmacro allUserM
${Else} ${Else}
!insertmacro abortM !insertmacro abortM
${EndIf} ${EndIf}
!macroend !macroend
!macro customInstall !macro customInstall
${If} $PerUser == "exists" ${If} $PerUser == "exists"
!insertmacro replaceLocalGlobalConfig !insertmacro replaceLocalGlobalConfig
${ElseIf} $AllUser == "exists" ${ElseIf} $AllUser == "exists"
!insertmacro replaceSystemGlobalConfig !insertmacro replaceSystemGlobalConfig
${Else} ${Else}
!insertmacro abortM !insertmacro abortM
${EndIf} ${EndIf}
!macroend !macroend
!macro customUnInit !macro customUnInit
!insertmacro validateInstallation !insertmacro validateInstallation
${If} $AllUser == "exists" ${If} $AllUser == "exists"
${IfNot} ${UAC_IsAdmin} ${IfNot} ${UAC_IsAdmin}
ShowWindow $HWNDPARENT ${SW_HIDE} ShowWindow $HWNDPARENT ${SW_HIDE}
!insertmacro UAC_RunElevated !insertmacro UAC_RunElevated
Quit Quit
${endif} ${endif}
${EndIf} ${EndIf}
!macroend !macroend