* made IniGetKeys() append to existing array
* rewrote INI parser to work with any text file * renamed [ParseIniFiles] to just [ParseFiles] ! [ParseIniFiles] is still processed for backwards compatibility + added version info to SVN (Issue: 11)
This commit is contained in:
parent
a68c2da4b6
commit
6454757d0e
@ -9,7 +9,7 @@ If (StrLen(RunBeforeEject) > 0)
|
|||||||
StepsAll++
|
StepsAll++
|
||||||
If regsvr0 > 0
|
If regsvr0 > 0
|
||||||
StepsAll++
|
StepsAll++
|
||||||
If datini0 > 0
|
If dattxt0 > 0
|
||||||
StepsAll++
|
StepsAll++
|
||||||
If datexe0 > 0
|
If datexe0 > 0
|
||||||
StepsAll += 2
|
StepsAll += 2
|
||||||
@ -234,38 +234,39 @@ Else
|
|||||||
If datexe0 > 0
|
If datexe0 > 0
|
||||||
StepsPos++
|
StepsPos++
|
||||||
|
|
||||||
;Translate paths in INI files
|
;Translate paths in text files
|
||||||
Loop %datini0%
|
Loop %dattxt0%
|
||||||
{
|
{
|
||||||
Progress % StepsPos*StepsStep+StepsStep*(A_Index-1)/datini0, Translating paths in file %CurFile% ...
|
Progress % StepsPos*StepsStep+StepsStep*(A_Index-1)/dattxt0, Translating paths in file %CurFile% ...
|
||||||
CurFile := datini%A_Index%
|
CurFile := dattxt%A_Index%
|
||||||
IfExist %U3_APP_DATA_PATH%\%CurFile%
|
IfExist %U3_APP_DATA_PATH%\%CurFile%
|
||||||
{
|
{
|
||||||
TmpFile := "$$$" . CurFile
|
TmpFile := "$$$" . CurFile
|
||||||
FileMove %U3_APP_DATA_PATH%\%CurFile%, %U3_APP_DATA_PATH%\%TmpFile%, 1
|
FileMove %U3_APP_DATA_PATH%\%CurFile%, %U3_APP_DATA_PATH%\%TmpFile%, 1
|
||||||
Progress % StepsPos*StepsStep+StepsStep*(A_Index-0.5)/datini0, Translating paths in file %CurFile% ...
|
Progress % StepsPos*StepsStep+StepsStep*(A_Index-0.5)/dattxt0, Translating paths in file %CurFile% ...
|
||||||
Loop Read, %U3_APP_DATA_PATH%\%TmpFile%, %U3_APP_DATA_PATH%\%CurFile%
|
Loop Read, %U3_APP_DATA_PATH%\%TmpFile%, %U3_APP_DATA_PATH%\%CurFile%
|
||||||
{
|
{
|
||||||
IfNotInString A_LoopReadLine, =
|
|
||||||
{
|
|
||||||
; no key/value-pair --- skip processing
|
|
||||||
FileAppend %A_LoopReadLine%`n
|
|
||||||
Continue
|
|
||||||
}
|
|
||||||
IfNotInString A_LoopReadLine, \
|
IfNotInString A_LoopReadLine, \
|
||||||
{
|
{
|
||||||
; no paths to replace --- skip processing
|
; no paths to replace --- skip processing
|
||||||
FileAppend %A_LoopReadLine%`n
|
FileAppend %A_LoopReadLine%`n
|
||||||
Continue
|
Continue
|
||||||
}
|
}
|
||||||
SplitFirst(IKey, IVal, A_LoopReadLine, "=")
|
FileAppend % EnvUnparseStr(A_LoopReadLine) . "`n"
|
||||||
FileAppend % IKey . "=" . EnvUnparseStr(IVal) . "`n"
|
}
|
||||||
|
IfExist %U3_APP_DATA_PATH%\%CurFile%
|
||||||
|
{
|
||||||
|
FileDelete %U3_APP_DATA_PATH%\%TmpFile%
|
||||||
|
}
|
||||||
|
Else
|
||||||
|
{
|
||||||
|
FileMove %U3_APP_DATA_PATH%\%TmpFile%, %U3_APP_DATA_PATH%\%CurFile%
|
||||||
|
MsgBox 4112, Error while translating, The datafile %CurFile% could not be translated. The original state has been restored (hopefully).
|
||||||
}
|
}
|
||||||
FileDelete %U3_APP_DATA_PATH%\%TmpFile%
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
If datini0 > 0
|
If dattxt0 > 0
|
||||||
StepsPos++
|
StepsPos++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ IfNotExist %U3_HOST_EXEC_PATH%\%A_ScriptName%
|
|||||||
StepsAll++
|
StepsAll++
|
||||||
If regsvr0 > 0
|
If regsvr0 > 0
|
||||||
StepsAll++
|
StepsAll++
|
||||||
If datini0 > 0
|
If dattxt0 > 0
|
||||||
StepsAll++
|
StepsAll++
|
||||||
If datexe0 > 0
|
If datexe0 > 0
|
||||||
StepsAll++
|
StepsAll++
|
||||||
@ -106,39 +106,40 @@ If (ForeignSettings = "0")
|
|||||||
StepsPos++
|
StepsPos++
|
||||||
}
|
}
|
||||||
|
|
||||||
;Translate paths in INI files
|
;Translate paths in text files
|
||||||
Loop %datini0%
|
Loop %dattxt0%
|
||||||
{
|
{
|
||||||
Progress % StepsPos*StepsStep+StepsStep*(A_Index-1)/datini0, Translating paths in file %CurFile% ...
|
Progress % StepsPos*StepsStep+StepsStep*(A_Index-1)/dattxt0, Translating paths in file %CurFile% ...
|
||||||
CurFile := datini%A_Index%
|
CurFile := dattxt%A_Index%
|
||||||
IfExist %U3_APP_DATA_PATH%\%CurFile%
|
IfExist %U3_APP_DATA_PATH%\%CurFile%
|
||||||
{
|
{
|
||||||
TmpFile := "$$$" . CurFile
|
TmpFile := "$$$" . CurFile
|
||||||
FileMove %U3_APP_DATA_PATH%\%CurFile%, %U3_APP_DATA_PATH%\%TmpFile%, 1
|
FileMove %U3_APP_DATA_PATH%\%CurFile%, %U3_APP_DATA_PATH%\%TmpFile%, 1
|
||||||
Progress % StepsPos*StepsStep+StepsStep*(A_Index-0.5)/datini0, Translating paths in file %CurFile% ...
|
Progress % StepsPos*StepsStep+StepsStep*(A_Index-0.5)/dattxt0, Translating paths in file %CurFile% ...
|
||||||
Loop Read, %U3_APP_DATA_PATH%\%TmpFile%, %U3_APP_DATA_PATH%\%CurFile%
|
Loop Read, %U3_APP_DATA_PATH%\%TmpFile%, %U3_APP_DATA_PATH%\%CurFile%
|
||||||
{
|
{
|
||||||
IfNotInString A_LoopReadLine, =
|
|
||||||
{
|
|
||||||
; no key/value-pair --- skip processing
|
|
||||||
FileAppend %A_LoopReadLine%`n
|
|
||||||
Continue
|
|
||||||
}
|
|
||||||
IfNotInString A_LoopReadLine, `%
|
IfNotInString A_LoopReadLine, `%
|
||||||
{
|
{
|
||||||
; no envvars to replace --- skip processing
|
; no envvars to replace --- skip processing
|
||||||
FileAppend %A_LoopReadLine%`n
|
FileAppend %A_LoopReadLine%`n
|
||||||
Continue
|
Continue
|
||||||
}
|
}
|
||||||
SplitFirst(IKey, IVal, A_LoopReadLine, "=")
|
FileAppend % EnvParseStr(A_LoopReadLine) . "`n"
|
||||||
FileAppend % IKey . "=" . EnvParseStr(IVal) . "`n"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
FileDelete %U3_APP_DATA_PATH%\%TmpFile%
|
IfExist %U3_APP_DATA_PATH%\%CurFile%
|
||||||
|
{
|
||||||
|
FileDelete %U3_APP_DATA_PATH%\%TmpFile%
|
||||||
|
}
|
||||||
|
Else
|
||||||
|
{
|
||||||
|
FileMove %U3_APP_DATA_PATH%\%TmpFile%, %U3_APP_DATA_PATH%\%CurFile%
|
||||||
|
MsgBox 4112, Error while translating, The datafile %CurFile% could not be translated. The original state has been restored (hopefully).
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
If datini0 > 0
|
If dattxt0 > 0
|
||||||
StepsPos++
|
StepsPos++
|
||||||
|
|
||||||
;Copy data files
|
;Copy data files
|
||||||
|
@ -24,7 +24,8 @@ IniRead RunBeforeStop, %INIFile%, U3Helper, RunBeforeStop, %A_Space%
|
|||||||
IniRead RunBeforeEject, %INIFile%, U3Helper, RunBeforeEject, %A_Space%
|
IniRead RunBeforeEject, %INIFile%, U3Helper, RunBeforeEject, %A_Space%
|
||||||
IniGetKeys("regsvr", INIFile, "regsvr32")
|
IniGetKeys("regsvr", INIFile, "regsvr32")
|
||||||
IniGetKeys("datexe", INIFile, "DataToExecDir")
|
IniGetKeys("datexe", INIFile, "DataToExecDir")
|
||||||
IniGetKeys("datini", INIFile, "ParseIniFiles")
|
IniGetKeys("dattxt", INIFile, "ParseFiles")
|
||||||
|
IniGetKeys("dattxt", INIFile, "ParseIniFiles") ; backward compatibility
|
||||||
IniGetKeys("regbak", INIFile, "RegBackup")
|
IniGetKeys("regbak", INIFile, "RegBackup")
|
||||||
IniGetKeys("regdel", INIFile, "RegDelete")
|
IniGetKeys("regdel", INIFile, "RegDelete")
|
||||||
IniGetKeys("fildel", INIFile, "FileDelete")
|
IniGetKeys("fildel", INIFile, "FileDelete")
|
||||||
|
27
U3Helper.rc
Normal file
27
U3Helper.rc
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
1 VERSIONINFO
|
||||||
|
FILEVERSION 2,2,0,0
|
||||||
|
PRODUCTVERSION 2,2,0,0
|
||||||
|
FILEOS 0x4
|
||||||
|
FILETYPE 0x1
|
||||||
|
{
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
{
|
||||||
|
BLOCK "040904b0"
|
||||||
|
{
|
||||||
|
VALUE "FileDescription", "U3Helper manages registry settings and data files of ordinary applications to make them U3-compatible. (see http://www.u3.com/ for more info)"
|
||||||
|
VALUE "FileVersion", "2, 2, 0, 0"
|
||||||
|
VALUE "InternalName", "U3H"
|
||||||
|
VALUE "LegalCopyright", "(c)2007 Markus Birth <mbirth@webwriters.de>"
|
||||||
|
VALUE "OriginalFilename", "U3Helper.exe"
|
||||||
|
VALUE "ProductName", "U3Helper"
|
||||||
|
VALUE "ProductVersion", "2, 2, 0, 0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
{
|
||||||
|
VALUE "Translation", 0x0409 0x04B0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -33,22 +33,21 @@ CCListBar.ocx
|
|||||||
safe.dat
|
safe.dat
|
||||||
safe.ind
|
safe.ind
|
||||||
|
|
||||||
[ParseIniFiles]
|
[ParseFiles]
|
||||||
; enter filenames of .ini-files to be parsed for env vars on hostConfigure
|
; enter filenames of textfiles (mostly .ini or .xml) to be parsed for env vars
|
||||||
; and re-replace the paths by envvars on hostCleanUp. The files should reside
|
; on hostConfigure and re-replace the paths by envvars on hostCleanUp. The
|
||||||
; in %U3_APP_DATA_PATH%
|
; files should reside in %U3_APP_DATA_PATH%
|
||||||
test.ini
|
test.ini
|
||||||
|
|
||||||
[FileDelete]
|
[FileDelete]
|
||||||
; enter filenames or foldernames to be deleted on eject
|
; enter filenames or foldernames to be deleted on eject
|
||||||
; Environment variables working (case sensitive!):
|
; (To get a complete list of working environment variables,
|
||||||
; %ALLUSERSPROFILE%, %APPDATA%, %CommonProgramFiles%, %HOMEPATH%,
|
; run U3Helper.exe without any parameters.)
|
||||||
; %ProgramFiles%, %SystemRoot%, %TEMP%, %USERPROFILE%, %WINDIR%,
|
%ALLUSERSPROFILE%\%U3H_AppData%\Spybot - Search & Destroy
|
||||||
; %U3_APP_DATA_PATH%, %U3_DEVICE_DOCUMENT_PATH%, %U3_DEVICE_EXEC_PATH%
|
|
||||||
%ALLUSERSPROFILE%\Application Data\Spybot - Search & Destroy
|
|
||||||
|
|
||||||
[EnvPath]
|
[EnvPath]
|
||||||
; enter folders to be added to the PATH environment variable
|
; enter folders to be added to the PATH environment variable
|
||||||
; upon running the application. All variables mentioned under
|
; upon running the application.
|
||||||
; [FileDelete] get replaced.
|
; (To get a complete list of working environment variables,
|
||||||
|
; run U3Helper.exe without any parameters.)
|
||||||
%U3_HOST_EXEC_PATH%\lib\gtk\bin
|
%U3_HOST_EXEC_PATH%\lib\gtk\bin
|
||||||
|
@ -5,10 +5,14 @@
|
|||||||
IniGetKeys(Result, IniFile, IniSection)
|
IniGetKeys(Result, IniFile, IniSection)
|
||||||
{
|
{
|
||||||
global
|
global
|
||||||
%Result%0 = 0
|
|
||||||
local i, Inside, TrimLine, SectTest, cp, Key, Value
|
local i, Inside, TrimLine, SectTest, cp, Key, Value
|
||||||
i = 1
|
i := %Result%0 + 1
|
||||||
Inside = 0
|
If (!i)
|
||||||
|
{
|
||||||
|
%Result%0 := 0
|
||||||
|
i := 1
|
||||||
|
}
|
||||||
|
Inside := 0
|
||||||
Loop Read, %IniFile%
|
Loop Read, %IniFile%
|
||||||
{
|
{
|
||||||
TrimLine = %A_LoopReadLine%
|
TrimLine = %A_LoopReadLine%
|
||||||
|
Reference in New Issue
Block a user