Inno setup Inno设置:不同的串行键具有不同的选项?
如何在Inno设置中提供具有多个选项的多个序列号 我想根据我提供给客户的不同序列键在注册表中写入不同的值 ex不同的串行键,如Inno setup Inno设置:不同的串行键具有不同的选项?,inno-setup,pascalscript,Inno Setup,Pascalscript,如何在Inno设置中提供具有多个选项的多个序列号 我想根据我提供给客户的不同序列键在注册表中写入不同的值 ex不同的串行键,如 sKey1 = "A1AA-B2ACF-HEJUI-UYTER" sKey2 = "A1BB-B2ACF-HEJUI-UYTER" sKey3 = "A1CC-B2ACF-HEJUI-UYTER" 要在注册表中创建的不同键的前4个字符或不同字符 if (custInput.startwith ("A1AA") then Root: "HKLM"; Subkey
sKey1 = "A1AA-B2ACF-HEJUI-UYTER"
sKey2 = "A1BB-B2ACF-HEJUI-UYTER"
sKey3 = "A1CC-B2ACF-HEJUI-UYTER"
要在注册表中创建的不同键的前4个字符或不同字符
if (custInput.startwith ("A1AA") then
Root: "HKLM"; Subkey: "SOFTWARE\Version\"; ValueType:string; ValueName:"Name";ValueData: "{"Lite"}";
elseif (custInput.startwith ("A1BB") then
Root: "HKLM"; Subkey: "SOFTWARE\Version\"; ValueType:string; ValueName:"Name";ValueData: "{"Pro"}";
elseif (custInput.startwith ("A1CC") then
Root: "HKLM"; Subkey: "SOFTWARE\Version\"; ValueType:string; ValueName:"Name";ValueData: "{"Online"}";
endif
如何在Inno设置中实现这一点?我使用了下面的CheckSerial
功能:
函数CheckSerial(Serial:String):布尔值;
开始
结果:=Serial='{#SerialNumber}';
结束;
使用a以编程方式决定要存储到注册表的值:
[Setup]
UserInfoPage=yes
[Registry]
Root: "HKLM"; Subkey: "SOFTWARE\Version"; ValueType: string; ValueName: "Name"; \
ValueData: "{code:GetEdition}";
[代码]
变量
系列:TStrings;
版本:TStrings;
函数CheckSerial(Serial:String):布尔值;
开始
结果:=(Serials.IndexOf(Serial)>=0);
结束;
过程注册表项(序列:字符串;版本:字符串);
开始
序列号。添加(序列号);
版本。添加(版本);
结束;
函数GetEdition(参数:string):string;
变量
索引:整数;
开始
索引:=Serials.IndexOf(WizardForm.UserInfoSerialEdit.Text);
如果索引>=0,则结果:=Editions[Index];
结束;
函数InitializeSetup():Boolean;
开始
Serials:=TStringList.Create;
版本:=TStringList.Create;
注册编辑(“A1AA-B2ACF-HEJUI-UYTER”、“Lite”);
注册编辑('A1BB-B2ACF-HEJUI-UYTER','Pro');
注册编辑(“A1CC-B2ACF-HEJUI-UYTER”,“在线”);
结果:=真;
结束;