这是存储收藏夹频道列表的功能。但是我无法将数组存储在注册表中,因为只能将字符串作为输入
Function addToFavorites(channeljson as object)as boolean
print "started"
sec = CreateObject("roRegistrySection", "FuturV1")
poster = CreateObject("roAssociativeArray")
'if not sec.Exists("FavoriteChannels")
contentList = CreateObject("roArray", 100, true)
'else
'end if
poster.ShortDescriptionLine1 = channeljson.name
poster.SDPosterURL = channeljson.logo
poster.HDPosterURL = ch`enter code here`anneljson.logo
poster.url= channeljson.ch
contentList.push( poster ) `enter code here`
'sec.Write("FavoriteChannels", ba.ToAsciiString())
print "again"
print contentList.GetEntry(0)
end function
答案 0 :(得分:2)
最简单的方法是使用 formatJSON()/ parseJSON()。
答案 1 :(得分:1)
将任何对象存储到持久存储 -
从持久性存储中检索数据 -
答案 2 :(得分:1)
这是使用ParseJSON和FormatJSON保存注册表设置的函数示例:
Sub SaveSettings(settings as Object)
SaveRegistryString("Settings", FormatJSON({settings: settings}, 1))
End Sub
Function LoadSettings() as Dynamic
json = GetRegistryString("Settings")
if json <> ""
obj = ParseJSON(json)
if obj <> invalid
return obj.settings
end if
end if
return invalid
End Function
Function GetRegistryString(key as String, default = "") As String
sec = CreateObject("roRegistrySection", "YourAppName")
if sec.Exists(key)
return sec.Read(key)
end if
return default
End Function
Sub SaveRegistryString(key As String, value As String)
sec = CreateObject("roRegistrySection", "YourAppName")
sec.Write(key, value)
sec.Flush()
End Sub