Player APIs (BrightScript & Ja...
...
Object Reference
Content Management Objects
roSyncSpec
11min
this object represents a parsed sync spec it allows you to retrieve various parts of the specification with methods ifsyncspec getfailurereason() as string returns information if an rosyncspec method indicates failure readfromfile(filename as string) as boolean populates the sync spec by reading the specified file this method returns true upon success and false upon failure readfromstring(spec as string) as boolean populates the sync spec by reading the passed string this method returns true upon success and false upon failure writetofile(filename as string) as boolean writes out the current sync spec to the specified file as xml because the xml is regenerated, it is possible this file may not be textually identical to the specification that was read this method returns true upon success and false upon failure writetofile(filename as string, options as roassociativearray) as boolean writes out the current sync spec to the specified file as xml or json the options associative array can currently contain the format parameter, which can have a value of "xml" or "json" because the xml/json is regenerated, it is possible this file may not be textually identical to the specification that was read this method returns true upon success and false upon failure writetostring() as string writes out the current sync spec to a string and returns it as xml this method returns an empty string if the write operation fails writetostring(options as roassociativearray) as string writes out the current sync spec to a string and returns it as xml or json the options associative array can currently contain the format parameter, which can have a value of "xml" or "json" this method returns an empty string if the write operation fails getmetadata(section as string) as roassociativearray returns an roassociativearray object containing the information stored in the specified metadata section of the sync spec (typically "client" or "server") this method returns 0 if the read operation fails if the sync spec is formatted as xml, then all returned values will be strings if the spec spec is formatted as json, the javascript types will be converted as follows javascript type brightscript type array roarray object roassociativearray string string boolean boolean number double null invalid lookupmetadata(section as string, field as string) as string provides a shortcut for looking up specified metadata items in the specified section without needing to create a temporary roassociativearray object this method returns an empty string if the read operation fails getfilelist(section as string) as rolist returns an rolist object containing roassociativearray objects for each file in the specified section of the sync spec this method returns invalid if the read operation fails getfile(section as string, index as integer) as roassociativearray returns an roassociativearray object for the file in the specified section and at the specified index this method returns invalid if the read operation fails getname() as string returns the name supplied for the sync spec in the \<sync> xml element equalto(other as rosyncspec) as boolean compares the contents of the rosyncspec object with another rosyncspec object this method compares the parsed contents of each sync spec rather than the xml files themselves verifysignature(signature as string, obfuscated passphrase as string) as boolean de obfuscates the passphrase and uses it to verify the signature of the sync spec this method returns true upon success and false upon failure filterfiles(section as string, criteria as roassociativearray) as rosyncspec returns a new rosyncspec object that is a copy of the existing object, except that the specified section is filtered using the specified criteria the criteria are matched against the file metadata multiple criteria can be specified in the passed associative array, and all criteria must be met for a file to be returned with the new rosyncspec the following call will yield an rosyncspec object with a "download" section that has been filtered so that only files of the group "scripts" will remain filtered spec = spec filterfiles("download", { group "scripts" }) filesequalto(spec as rosyncspec) as boolean compares the contents of the sync spec to another sync spec and returns true if they're identical this method compares the parsed contents of the sync specs, rather than the xml/json itself getassets(section as string) as object retrieves a list of assets from the sync spec in a form that's compatible with roassetpool and its associated objects