使用 NSIS,用户如何修改它以包含超过 8192 字节?
Using NSIS, How can the user modify it to contain more than 8192Bytes?
感谢阅读我的文章:]
我收到了使用http 通信的响应,但由于超过1024 字节而被升级。于是,${NSIS_MAX_STRLEN}的Byte就变成了8192。但是,由于我收到的Json类型的return值超过了8192字节,所以出现了错误。我应该设置什么设置以获得更多字节?
你不能把整个JSON放在一个NSIS字符串中,你必须使用插件来找到你需要的值:
这能够解析超过 9000 个字节:
!macro prepare_example
FileOpen "$temp\!tempjson.txt" w
FileWrite "["
${For} 1 500
${IfThen} U> 1 ${|} FileWrite "," ${|}
FileWrite '{"Return":"", "Out":"Any Request"}$\n'
${Next}
FileWrite "]"
FileSeek 0 END
FileClose
DetailPrint "About to parse bytes of JSON..."
!macroend
!include LogicLib.nsh
Section
!insertmacro prepare_example
ClearErrors
nsJSON::Set /file "$temp\!tempjson.txt"
${IfThen} ${Errors} ${|} Abort "nsJSON::Set failed" ${|}
nsJSON::Get /count /end
${IfThen} ${Errors} ${|} Abort "nsJSON::Get failed" ${|}
Pop
DetailPrint Count=
${IfThen} <> 0 ${|} IntOp - 1 ${|}
${For} 0
nsJSON::Get /index /end
${IfThen} ${Errors} ${|} Abort "nsJSON::Get failed" ${|}
Pop
DetailPrint Object=
${Next}
${For} 0
nsJSON::Get /index "Return" /end
${IfThen} ${Errors} ${|} Abort "nsJSON::Get failed" ${|}
Pop
DetailPrint Object.Return=
${Next}
SectionEnd
感谢阅读我的文章:]
我收到了使用http 通信的响应,但由于超过1024 字节而被升级。于是,${NSIS_MAX_STRLEN}的Byte就变成了8192。但是,由于我收到的Json类型的return值超过了8192字节,所以出现了错误。我应该设置什么设置以获得更多字节?
你不能把整个JSON放在一个NSIS字符串中,你必须使用插件来找到你需要的值:
这能够解析超过 9000 个字节:
!macro prepare_example
FileOpen "$temp\!tempjson.txt" w
FileWrite "["
${For} 1 500
${IfThen} U> 1 ${|} FileWrite "," ${|}
FileWrite '{"Return":"", "Out":"Any Request"}$\n'
${Next}
FileWrite "]"
FileSeek 0 END
FileClose
DetailPrint "About to parse bytes of JSON..."
!macroend
!include LogicLib.nsh
Section
!insertmacro prepare_example
ClearErrors
nsJSON::Set /file "$temp\!tempjson.txt"
${IfThen} ${Errors} ${|} Abort "nsJSON::Set failed" ${|}
nsJSON::Get /count /end
${IfThen} ${Errors} ${|} Abort "nsJSON::Get failed" ${|}
Pop
DetailPrint Count=
${IfThen} <> 0 ${|} IntOp - 1 ${|}
${For} 0
nsJSON::Get /index /end
${IfThen} ${Errors} ${|} Abort "nsJSON::Get failed" ${|}
Pop
DetailPrint Object=
${Next}
${For} 0
nsJSON::Get /index "Return" /end
${IfThen} ${Errors} ${|} Abort "nsJSON::Get failed" ${|}
Pop
DetailPrint Object.Return=
${Next}
SectionEnd