Remove IniReadEx API command in favor of new IniRead Default= argument

This commit is contained in:
Homes32
2020-07-12 21:55:55 -05:00
parent 4f266da058
commit 8206635d0f
5 changed files with 22 additions and 66 deletions

View File

@@ -84,10 +84,10 @@ IniRead,"%ProgramsCache%\%ProgramFolder%\PENetwork.ini","PENetwork","UseProfiles
If,%PENMini_UseProfiles%,Equal,"Yes",RegWrite,HKLM,0x1,"Tmp_Software\PENetwork","UseProfiles",1
Else,RegWrite,HKLM,0x1,"Tmp_Software\PENetwork","UseProfiles",0
IniReadEx,"%ProgramsCache%\%ProgramFolder%\PENetwork.ini","PENetwork","StartMode",1,PENMini_StartMode
IniRead,"%ProgramsCache%\%ProgramFolder%\PENetwork.ini","PENetwork","StartMode",%PENMini_StartMode%,Default=1
RegWrite,HKLM,0x1,"Tmp_Default\Software\PENetwork","StartMode",%PENMini_StartMode%
IniReadEx,"%ProgramsCache%\%ProgramFolder%\PENetwork.ini","PENetwork","StartToTray",1,PENMini_StartToTray
IniRead,"%ProgramsCache%\%ProgramFolder%\PENetwork.ini","PENetwork","StartToTray",%PENMini_StartToTray%,Default=1
RegWrite,HKCU,0x1,"Tmp_Default\Software\PENetwork","StartToTray",%PENMini_StartToTray%
// Custom Wireless Config

View File

@@ -79,23 +79,23 @@ If,%PEBakeryVersion%,<,%MinEngineVersion%,Begin
End
// Pebakery.ini - [Log]
IniReadEx,%BaseDir%\PEBakery.ini,Log,DeferredLogging,True,DeferredLogging
IniRead,"%BaseDir%\PEBakery.ini","Log","DeferredLogging",%DeferredLogging%,Default=True
// PEBakeryCompat.ini - [PEBakeryCompat]
IniReadEx,%ProjectDir%\PEBakeryCompat.ini,PEBakeryCompat,AsteriskBugDirCopy,False,AsteriskBugDirCopy
IniReadEx,%ProjectDir%\PEBakeryCompat.ini,PEBakeryCompat,AsteriskBugDirLink,False,AsteriskBugDirLink
IniReadEx,%ProjectDir%\PEBakeryCompat.ini,PEBakeryCompat,FileRenameCanMoveDir,False,FileRenameCanMoveDir
IniReadEx,%ProjectDir%\PEBakeryCompat.ini,PEBakeryCompat,LegacyBranchCondition,False,LegacyBranchCondition
IniReadEx,%ProjectDir%\PEBakeryCompat.ini,PEBakeryCompat,AllowLetterInLoop,False,AllowLetterInLoop
IniReadEx,%ProjectDir%\PEBakeryCompat.ini,PEBakeryCompat,LegacyRegWrite,False,LegacyRegWrite
IniReadEx,%ProjectDir%\PEBakeryCompat.ini,PEBakeryCompat,AllowSetModifyInterface,False,AllowSetModifyInterface
IniReadEx,%ProjectDir%\PEBakeryCompat.ini,PEBakeryCompat,LegacyInterfaceCommand,False,LegacyInterfaceCommand
IniReadEx,%ProjectDir%\PEBakeryCompat.ini,PEBakeryCompat,LegacySectionParamCommand,False,LegacySectionParamCommand
IniReadEx,%ProjectDir%\PEBakeryCompat.ini,PEBakeryCompat,IgnoreWidthOfWebLabel,False,IgnoreWidthOfWebLabel
IniReadEx,%ProjectDir%\PEBakeryCompat.ini,PEBakeryCompat,OverridableFixedVariables,False,OverridableFixedVariables
IniReadEx,%ProjectDir%\PEBakeryCompat.ini,PEBakeryCompat,EnableEnvironmentVariables,False,EnableEnvironmentVariables
IniReadEx,%ProjectDir%\PEBakeryCompat.ini,PEBakeryCompat,DisableExtendedSectionParams,False,DisableExtendedSectionParams
IniReadEx,%ProjectDir%\PEBakeryCompat.ini,PEBakeryCompat,AutoCompactIniWriteCommand,False,AutoCompactIniWriteCommand
IniRead,"%ProjectDir%\PEBakeryCompat.ini","PEBakeryCompat","AsteriskBugDirCopy",%AsteriskBugDirCopy%,Default=False
IniRead,"%ProjectDir%\PEBakeryCompat.ini","PEBakeryCompat","AsteriskBugDirLink",%AsteriskBugDirLink%,Default=False
IniRead,"%ProjectDir%\PEBakeryCompat.ini","PEBakeryCompat","FileRenameCanMoveDir",%FileRenameCanMoveDir%,Default=False
IniRead,"%ProjectDir%\PEBakeryCompat.ini","PEBakeryCompat","LegacyBranchCondition",%LegacyBranchCondition%,Default=False
IniRead,"%ProjectDir%\PEBakeryCompat.ini","PEBakeryCompat","AllowLetterInLoop",%AllowLetterInLoop%,Default=False
IniRead,"%ProjectDir%\PEBakeryCompat.ini","PEBakeryCompat","LegacyRegWrite",%LegacyRegWrite%,Default=False
IniRead,"%ProjectDir%\PEBakeryCompat.ini","PEBakeryCompat","AllowSetModifyInterface",%AllowSetModifyInterface%,Default=False
IniRead,"%ProjectDir%\PEBakeryCompat.ini","PEBakeryCompat","LegacyInterfaceCommand",%LegacyInterfaceCommand%,Default=False
IniRead,"%ProjectDir%\PEBakeryCompat.ini","PEBakeryCompat","LegacySectionParamCommand",%LegacySectionParamCommand%,Default=False
IniRead,"%ProjectDir%\PEBakeryCompat.ini","PEBakeryCompat","IgnoreWidthOfWebLabel",%IgnoreWidthOfWebLabel%,Default=False
IniRead,"%ProjectDir%\PEBakeryCompat.ini","PEBakeryCompat","OverridableFixedVariables",%OverridableFixedVariables%,Default=False
IniRead,"%ProjectDir%\PEBakeryCompat.ini","PEBakeryCompat","EnableEnvironmentVariables",%EnableEnvironmentVariables%,Default=False
IniRead,"%ProjectDir%\PEBakeryCompat.ini","PEBakeryCompat","DisableExtendedSectionParams",%DisableExtendedSectionParams%,Default=False
IniRead,"%ProjectDir%\PEBakeryCompat.ini","PEBakeryCompat","AutoCompactIniWriteCommand",%AutoCompactIniWriteCommand%,Default=False
If,%DeferredLogging%,Equal,False,Set,%Message%,"WARNING: Logging --> Delayed Logging is disabled. This can significantly increase build time.#$x#$x"
If,%AsteriskBugDirCopy%,Equal,True,Begin

View File

@@ -57,7 +57,7 @@ IniRead,%ScriptFile%,"Main","Version",%ScriptVer%
If,Not,ExistFile,"%RegistryCache%\.Cache",Run,%ScriptFile%,BuildRegistryCache
// Check for stale cache and rebuild if needed
IniReadEx,"%RegistryCache%\.Cache","Registry Cache","Version","0.0.0.0",RegCacheVer
IniRead,"%RegistryCache%\.Cache","Registry Cache","Version",%RegCacheVer%,"Default=0.0.0.0"
If,%RegCacheVer%,Equal,%ScriptVer%,Echo,"Registry Cache: ENABLED (v%RegCacheVer%)"
Else,Begin

View File

@@ -26,7 +26,7 @@ IniRead,%ScriptFile%,"Main","Version",%ScriptVer%
If,Not,ExistFile,"%ProjectCache%\NetworkDrivers\.Cache",Run,%ScriptFile%,BuildRegistryCache
// Check for stale cache and rebuild if needed
IniReadEx,"%ProjectCache%\NetworkDrivers\.Cache","Network Drivers Cache","Version","0.0.0.0",RegCacheVer
IniRead,"%ProjectCache%\NetworkDrivers\.Cache","Network Drivers Cache","Version",%RegCacheVer%,"Default=0.0.0.0"
If,%RegCacheVer%,Equal,%ScriptVer%,Echo,"Registry Cache: ENABLED (v%RegCacheVer%)"
Else,Begin

View File

@@ -2,14 +2,12 @@
Title=PhoenixPE API
Author=Homes32
Description=Scripting interface.
Version=1.2.1.0
Version=1.3.0.0
Level=0
Selected=None
[Variables]
%_PhoenixAPI_ConfigMode%=PECMD
%_PhoenixAPI_RequireFileEx_BulkFileList%=
%_PhoenixAPI_RequireFileEx_SingleFileList%=
[Macros]
RegLoadHives=Run,%API%,_PhoenixAPI_RegLoadHives
@@ -24,8 +22,6 @@ DirDeleteEx=Run,%API%,_PhoenixAPI_DirDeleteEx
FileCopyEx=Run,%API%,_PhoenixAPI_FileCopyEx
FileDeleteEx=Run,%API%,_PhoenixAPI_FileDeleteEx
IniReadEx=Run,%API%,_PhoenixAPI_IniReadEx
// Experimental - May be changed or removed without notice
7zExtract=Run,%API%,_PhoenixAPI_7zExtract
InnoExtract=Run,%API%,_PhoenixAPI_InnoExtract
@@ -36,8 +32,6 @@ XMLDelete=Run,%API%,_PhoenixAPI_XMLDelete
XMLRename=Run,%API%,_PhoenixAPI_XMLRename
XMLUpdate=Run,%API%,_PhoenixAPI_XMLUpdate
SetFileACL=Run,%API%,_PhoenixAPI_SetFileACL
SetRegACL=Run,%API%,_PhoenixAPI_SetRegACL
@@ -51,6 +45,7 @@ BitClear=Run,%API%,_PhoenixAPI_BitClear
BitSet=Run,%API%,_PhoenixAPI_BitSet
BitToggle=Run,%API%,_PhoenixAPI_BitToggle
// Experimental - May be changed or removed without notice
[_PhoenixAPI_7zExtract]
System,SetLocal
If,#1,Equal,"",Halt,"7zip Error: You must specify the file to decompress."
@@ -63,6 +58,7 @@ ShellExecute,Hide,%Tools%\7z.exe,"x -r -y #$q%SrcArchive%#$q -o#$q%DestDir%#$q"
System,EndLocal
// Experimental - May be changed or removed without notice
[_PhoenixAPI_InnoExtract]
System,SetLocal
If,#1,Equal,"",Halt,"InnoExtract Syntax Error: You must specify the file to decompress."
@@ -121,46 +117,6 @@ End
System,EndLocal
[#_PhoenixAPI_IniReadEx#]
// ===============================================================================================================================
// Name...........: IniReadEx
// Description....: Reads a value from a standard .ini file.
// If the file or key doesn't exist the specified default value will be returned.
// Syntax.........: IniReadEx,<FileName>,<Section>,<Key>,<DefaultValue>,<DestVar>
// Parameters.....: #1 FileName - The full path of the file to read.
// #2 Section - The section containing the value to be read.
// #3 Key - The name of the key to be read.
// #4 DefaultValue - The default value to return if the key cannot be found.
// #5 DestVar - The value will be saved to a variable with this name.
// Note that <DestVar> should NOT be enclosed in percent (%) signs
//
// Example: IniReadEx,C:\windows\win.ini,mySection,myKey,Default,myVariable
//
// Return values..: Sets <DestVar> to the value returned.
// Author.........: Homes32
// Remarks........: The Winbuilder/PEBakery IniRead implementation always returns an empty string if the Key is not found.
// If you don't need to specify a default key value IniRead will execute slightly faster then this macro.
//
// We need to run this macro in the local scope of the calling script in order to set the return var
// so we must not use System,SetLocal isolation here.
// Related........:
// ===============================================================================================================================
[_PhoenixAPI_IniReadEx]
If,#1,Equal,"",Halt,"IniWriteEx Syntax Error: You must specify the full path of the file to read."
If,#2,Equal,"",Halt,"IniWriteEx Syntax Error: You must specify the section containing the value to be read."
If,#3,Equal,"",Halt,"IniWriteEx Syntax Error: You must specify the key to be read."
If,#4,Equal,"",Halt,"IniWriteEx Syntax Error: You must specify the default value to return if the key cannot be found."
If,#5,Equal,"",Halt,"IniWriteEx Syntax Error: You must specify the name of the variable where the value will be saved."
If,ExistFile,#1,Begin
IniRead,#1,#2,#3,%IniReadEx_Return%
If,%IniReadEx_Return%,Equal,"",Set,%#5%,#4
Else,Set,%#5%,%IniReadEx_Return%
End
Else,Set,%#5%,#4
Set,%IniReadEx_Return%,Nil
[#_PhoenixAPI_SetFileACL#]
// ===============================================================================================================================
// Name...........: SetFileACL