Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Managing Sections depending on License Feature (http://forums.winamp.com/showthread.php?t=303760)

xbarns 4th March 2009 14:45

Managing Sections depending on License Feature
 
1 Attachment(s)
Hi all,

i have a Setup that is supposed to react to features that are extracted out of a license file.

I will get back a string like "Feature1,Feature2,Feature4,Feature5" for all valid features.

I disable all(!) Sections and SectionGroups using SectionSetFlags.

Now i check for the single Features using ${Wordfind} and if a feature exists i (re)enable certain sections.

There are quite a few sections (roughly 30) and i am looking for an easier way to manage that stuff since i have to enable some sections twice (e.g. once for Feature1 and once for Feature3)

Has anyone done something like that before and would like to share knowledge?

I have attached the part of the script that i am talking about.

Thanks for your help.

Animaether 4th March 2009 20:42

could you loop over the sections, grab their text, and compare the text to a featureset variable that is based on the features enabled?

code:

Function Test
StrCpy $0 0
_loop:
ClearErrors
SectionGetText $0 $1
${If} ${Errors}
goto _done
${Else}
MessageBox MB_OK "[$1]"
${EndIf}
IntOp $0 $0 + 1
goto _loop
_done:
FunctionEnd



( you might be able to abuse the section flags as well as there's quite a few bits unused )


Alternatively, perhaps you could use InstTypes with SectionIn? ( though I think that adds an installation type drop-down above the components which you would subsequently have to hide from the user )



Mind you, limiting installation features based on a 'license' like this is pretty poor protection unless used in conjunction with other functionality to prevent the user from e.g. simply extracting the files (if only file extraction would be needed).

xbarns 6th March 2009 10:34

Quote:

Mind you, limiting installation features based on a 'license' like this is pretty poor protection unless used in conjunction with other functionality to prevent the user from e.g. simply extracting the files (if only file extraction would be needed).
I know, but it was (luckily) not my decision to do it that way, sadly i have to implement it :(

Animaether 6th March 2009 11:39

well, I hope the method above might be of use, then - it would provided fully automated handling of section enabled/disabled states, without having to adjust a separate section of code each time you add/remove a section to the list/etc.


All times are GMT. The time now is 04:27.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.