diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/installer/winamp/sectionsHelper.nsh | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/installer/winamp/sectionsHelper.nsh')
-rw-r--r-- | Src/installer/winamp/sectionsHelper.nsh | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Src/installer/winamp/sectionsHelper.nsh b/Src/installer/winamp/sectionsHelper.nsh new file mode 100644 index 00000000..a9c907fa --- /dev/null +++ b/Src/installer/winamp/sectionsHelper.nsh @@ -0,0 +1,75 @@ +!ifndef WINAMP_SECTIONS_HELPER_HEADER +!define WINAMP_SECTIONS_HELPER_HEADER + +; use WinampSection/WinampSectionEnd instead of Section/SectionEnd if you want section +; to store invariant name in install.ini +; Example: +; WinampSection "winampSection1" "$(IDS_WINAMPSECTION1_TITLE)" IDX_WINAMPSECTION1 +; .... +; .... +; WinampSectionEnd +; +; + +!macro WinampSection __sectionName __sectionTitle __sectionIndex + !ifdef WINAMP_SECTION_ACTIVE_ID | WINAMP_SECTION_ACTIVE_NAME + !error "Missing WinampSectionEnd" + !endif + !define WINAMP_SECTION_ACTIVE_ID "${__sectionIndex}" + !define WINAMP_SECTION_ACTIVE_NAME "${__sectionName}" + Section "${__sectionTitle}" "${__sectionIndex}" +!macroend + +!define WinampSection "!insertmacro 'WinampSection'" + +!macro SECTIONHEADER_LINE __line + !appendfile "${WINAMP_SECTION_HEADER}" "${__line}$\r$\n" +!macroend + +!define SECTIONHEADER_LINE "!insertmacro 'SECTIONHEADER_LINE'" + +!macro InitializeGetSectionName + !ifdef WINAMP_SECTION_HEADER + !include "${WINAMP_SECTION_HEADER}" + !delfile "${WINAMP_SECTION_HEADER}" + SectionGetText $0 $0 + GetSectionName_FunctionEnd: + Exch $0 + FunctionEnd + !else + !define GetSectionName SectionGetText + !endif +!macroend + +!define InitializeGetSectionName "!insertmacro 'InitializeGetSectionName'" + +!macro WinampSectionEnd + SectionEnd +!ifndef WINAMP_SECTION_ACTIVE_ID | WINAMP_SECTION_ACTIVE_NAME + !error "Missing WinampSection" +!endif + +!ifndef WINAMP_SECTION_HEADER + !tempfile WINAMP_SECTION_HEADER + !delfile "${WINAMP_SECTION_HEADER}" + + ${SECTIONHEADER_LINE} "!define GetSectionName $\"!insertmacro 'GetSectionName'$\"" + ${SECTIONHEADER_LINE} "!macro GetSectionName __sectionIndex __outputVar" + ${SECTIONHEADER_LINE} "$\tPush ${__sectionIndex}" + ${SECTIONHEADER_LINE} "$\tCall GetSectionName" + ${SECTIONHEADER_LINE} "$\tPop ${__outputVar}" + ${SECTIONHEADER_LINE} "!macroend" + ${SECTIONHEADER_LINE} "Function GetSectionName" + ${SECTIONHEADER_LINE} "$\tExch $0" +!endif + + ${SECTIONHEADER_LINE} "$\tIntCmp $0 ${${WINAMP_SECTION_ACTIVE_ID}} 0 +3 +3" + ${SECTIONHEADER_LINE} "$\t$\tStrCpy $0 ${WINAMP_SECTION_ACTIVE_NAME}" + ${SECTIONHEADER_LINE} "$\t$\tGoto GetSectionName_FunctionEnd" + + !undef WINAMP_SECTION_ACTIVE_ID + !undef WINAMP_SECTION_ACTIVE_NAME +!macroend + +!define WinampSectionEnd "!insertmacro 'WinampSectionEnd'" +!endif
\ No newline at end of file |