【发布时间】:2019-09-03 22:35:38
【问题描述】:
我尝试创建一个 roRegistration 部分并编写两个函数 GetAuthData 和 SetAuthData 我尝试在 SetAuthData 中传递多个参数并使用 GetAuthData 读取。
Function GetAuthData() As Dynamic
sec = CreateObject("roRegistrySection", "Authentication")
' print "section : " + Authentication
if sec.Exists("Authentication")
print "Read URL : " + m.top.GlobleURL
print " ****************** DATA :" + m.top.GlobleURL
return sec.Read("Authentication")
'return sec.Delete("Authentication") ' Here not override concept so compalsary delete first and after again second URL Store pannel.brs and hud.brs both file
print "***********************GetAuthData************************"
endif
return invalid
End Function
'Here the SetAuthData to wrire URL
Function SetAuthData(Serverurl As String,zxorausername As String, zxorapassword As String) As Void
sec = CreateObject("roRegistrySection", "Authentication")
m.top.GlobleURL = Serverurl
m.top.globalusername = zxorausername
m.top.globalpass = zxorapassword
sec.Write("Authentication", m.top.GlobleURL)
sec.Write("Authentication", m.top.globalusername)
sec.write("Authentication", m.top.globalpass)
?"key for the URL" sec.GetKeyList()
Print "Write URL :" + m.top.GlobleURL
Print " Write username :" + m.top.globalusername + " Write pass :" + m.top.globalpass
print "***********************SetAuthData************************"
End Function
我调用 GetAuth 数据如下所示
m.top.GlobleURL = GetAuthData()
m.top.globalusername = GetAuthData()
m.top.globalpass = GetAuthData()
我打印了所有三个项目,但每次都打印 m.top.GlobleURL 值。我试图存储所有三个值。但只存储一个值。有人知道这个问题吗?
编辑后的帖子
Function GetAuthData(key as string) As Dynamic
' reg = CreateObject("roRegistry")
sec = CreateObject("roRegistrySection", "Authentication")
' print "section : " + Authentication
if sec.Exists(key)
return sec.Read(key)
end if
return invalid
'return sec.Delete("Authentication") ' Here not override concept so compalsary delete first and after again second URL Store pannel.brs and hud.brs both file
print "***********************GetAuthData************************"
End Function
'Here the SetAuthData to wrire URL
Function SetAuthData(Serverurl As String,zxorausername As String, zxorapassword As String) As Void
' reg = CreateObject("roRegistry")
sec = CreateObject("roRegistrySection", "Authentication")
m.top.GlobleURL = Serverurl
m.top.globalusername = zxorausername
m.top.globalpass = zxorapassword
' if not m.top.GlobleURL = Serverurl
sec.Write("url", m.top.GlobleURL)
sec.Write("username", m.top.globalusername)
sec.write("password", m.top.globalpass)
sec.Flush()
?"key for the URL" sec.GetKeyList()
Print "Write URL :" + m.top.GlobleURL
Print " Write username :" + m.top.globalusername + " Write pass :" + m.top.globalpass
' end if
print "***********************SetAuthData************************"
' Flush(true)
End Function
并使用
打印m.keyUrl = GetAuthData("url")
m.keyUserName = GetAuthData("username")
m.keyPassword = GetAuthData("password")
?"URL Print : " m.keyUrl
?"Username print : " m.keyUserName
?"password print : " m.keyPassword
【问题讨论】:
标签: roku brightscript