NSIS脚本有关保存exe.config文件中的值 [英] NSIS Scripts about save the values in exe.config file

查看:105
本文介绍了NSIS脚本有关保存exe.config文件中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

var INI_ESHOST

var INI_ESPORT

部分-RadliveService.exe.config

DetailPrint更改RadliveService.exe.config

$ {xml :: LoadFile}$ INSTDIR\Apps\RadLive_Services \ RadliveService.exe.config$ 0

$ {xml :: GotoPath}/ configuration / appSettings$ 0

$ {xml :: FirstChildElement}add$ 0 $ 1

loopCCImagePath:

$ {xml :: GetAttribute}关键$ 0 $ 1

; StrCmpUNCPath$ 0 foundimagestore

StrCmpINIPATH$ 0 foundpath

StrCmpUploadStore$ 0 foundpath1

StrCmpArchivePath$ 0 foundpath2

StrCmpDownloadPath$ 0 foundpath3

StrCmpConnectionString$ 0 foundpath4

; StrCmpSqlConnection$ 0 foundpath5

NextSibbling:

$ {xml :: NextSiblingElement}add$ 0 $ 1

StrCmp $ 10loopCCImagePath SaveFile

sleep 1000

foundpath:

$ {xml :: SetAttribute}value$ INSTDIR\Apps\Common\ $ 0

转到NextSibbling

foundpath1:

; $ {xml :: SetAttribute}value$ INSTDIR \ ImageStore \ UploadFolder $ 0

$ {xml :: SetAttribute}value$ INI_ESUPLOAD$ 0

转到NextSibbling

foundpath2:

$ {xml :: SetAttribute}value$ INI_ESARCHIVE$ 0

转到NextSibbling

foundpath3:

$ {xml: :SetAttribute}value$ INI_ESDOWNLOAD$ 0

转到NextSibbling

foundpath4:

$ {xml :: SetAttribute}value数据源= $ INI_HOSTINSTANCE; uid = $ INI_ADMINID;密码= $ INI_ADMINPASS;初始目录= $ INI_DBNAME;集成安全性= false$ 0

转到NextSibbling

调用SetAppConfigE nterpriseSettings

SaveFile:

$ {xml :: SaveFile}$ INSTDIR\Apps\RadLive_Services\RadliveService.exe.config$ 0

$ {xml :: Unload}

返回

SectionEnd

; -------------- ----------------------------------

函数SetAppConfigEnterpriseSettings

$ {xml :: GotoPath}/ configuration /system.serviceModel / services / service / endpoint$ 0

$ {xml :: SetAttribute}addressnet.tcp:// $ INI_ESHOST:$ INI_ESPORT / servertest$ 0

; $ {xml :: FirstChildElement}endpoint$ 0 $ 1

; loopIAuthenticationService:

; $ {xml :: GetAttribute}address$ 0 $ 1

; StrCmpendpoint$ 0 foundIAuthenticationService; break loop

; $ {xml :: NextSiblingElement}endpoint$ 0 $ 1

; StrCmp $ 10loopIAuthenticationService AppConfigFailed;循环除非发生错误

; foundIAuthenticationService:

; $ {xml :: SetAttribut e}addressnet.tcp:// $ INI_ESHOST:$ INI_ESPORT / servertest$ 0

AppConfigFailed:

MessageBox MB_OK | MB_ICONSTOP服务失败组件配置。查看安装日志以获取详细信息。重新安装将是必需的。

FunctionEnd

如何更改运行时的值:Services.exe.config文件:/ configuration / system.serviceModel / services / service / endpoint

< system.servicemodel>

< services>< service behaviorconfiguration =Radlive.WCF.Servicesname =RadLiveService.cls_Methodcall >< endpoint address =net.tcp://0.0.0.0:2107 / servertestbinding =netTcpBinding>

bindingConfiguration =WCFCommServiceBindingcontract =Pellucid.Communication.ICommunication />

< endpoint address =http://0.0.0.0:801/servertestbinding =basicHttpBindingbindingconfiguration =WCFCommServiceBindingcontract =Pellucid.Communication.ICommunication> ;


解决方案

{xml :: LoadFile}


INSTDIR \\ \\ Apps\RadLive_Services\RadliveService.exe.config


0

var INI_ESHOST
var INI_ESPORT
Section "-RadliveService.exe.config"
DetailPrint "Changing RadliveService.exe.config"
${xml::LoadFile} "$INSTDIR\Apps\RadLive_Services\RadliveService.exe.config" $0
${xml::GotoPath} "/configuration/appSettings" $0
${xml::FirstChildElement} "add" $0 $1
loopCCImagePath:
${xml::GetAttribute} "key" $0 $1
; StrCmp "UNCPath" $0 foundimagestore
StrCmp "INIPATH" $0 foundpath
StrCmp "UploadStore" $0 foundpath1
StrCmp "ArchivePath" $0 foundpath2
StrCmp "DownloadPath" $0 foundpath3
StrCmp "ConnectionString" $0 foundpath4
; StrCmp "SqlConnection" $0 foundpath5
NextSibbling:
${xml::NextSiblingElement} "add" $0 $1
StrCmp $1 "0" loopCCImagePath SaveFile
sleep 1000
foundpath:
${xml::SetAttribute} "value" "$INSTDIR\Apps\Common\" $0
goto NextSibbling
foundpath1:
;${xml::SetAttribute} "value" "$INSTDIR\ImageStore\UploadFolder" $0
${xml::SetAttribute} "value" "$INI_ESUPLOAD" $0
goto NextSibbling
foundpath2:
${xml::SetAttribute} "value" "$INI_ESARCHIVE" $0
goto NextSibbling
foundpath3:
${xml::SetAttribute} "value" "$INI_ESDOWNLOAD" $0
goto NextSibbling
foundpath4:
${xml::SetAttribute} "value" "Data Source=$INI_HOSTINSTANCE;uid=$INI_ADMINID;password=$INI_ADMINPASS;Initial Catalog=$INI_DBNAME;Integrated Security=false" $0
goto NextSibbling
Call SetAppConfigEnterpriseSettings
SaveFile:
${xml::SaveFile} "$INSTDIR\Apps\RadLive_Services\RadliveService.exe.config" $0
${xml::Unload}
Return
SectionEnd
;------------------------------------------------
Function SetAppConfigEnterpriseSettings
${xml::GotoPath} "/configuration/system.serviceModel/services/service/endpoint" $0
${xml::SetAttribute} "address" "net.tcp://$INI_ESHOST:$INI_ESPORT/servertest" $0
;${xml::FirstChildElement} "endpoint" $0 $1
;loopIAuthenticationService:
;${xml::GetAttribute} "address" $0 $1
;StrCmp "endpoint" $0 foundIAuthenticationService ;breaks loop
;${xml::NextSiblingElement} "endpoint" $0 $1
;StrCmp $1 "0" loopIAuthenticationService AppConfigFailed ;loops unless an error occurred
;foundIAuthenticationService:
;${xml::SetAttribute} "address" "net.tcp://$INI_ESHOST:$INI_ESPORT/servertest" $0
AppConfigFailed:
MessageBox MB_OK|MB_ICONSTOP "A failure has occurred on service component configuration. Review the installation log for details. A reinstallation will be required."
FunctionEnd
how i can change the values in Run time : Services.exe.config files:"/configuration/system.serviceModel/services/service/endpoint"
<system.servicemodel>
<services><service behaviorconfiguration="Radlive.WCF.Services" name="RadLiveService.cls_Methodcall"><endpoint address="net.tcp://0.0.0.0:2107/servertest" binding="netTcpBinding">
bindingConfiguration="WCFCommServiceBinding" contract="Pellucid.Communication.ICommunication" />
<endpoint address="http://0.0.0.0:801/servertest" binding="basicHttpBinding" bindingconfiguration="WCFCommServiceBinding" contract="Pellucid.Communication.ICommunication">

解决方案

{xml::LoadFile} "


INSTDIR\Apps\RadLive_Services\RadliveService.exe.config"


0


这篇关于NSIS脚本有关保存exe.config文件中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆