public static IEnumerator LoadStoreInfo() { var url = "http://www.22series.com/api/store/info"; var storeInfo = Cache.GetAsString("ttrs-store-info", Cache.FileType.JSON, 60 * 24); if (!String.IsNullOrEmpty(storeInfo)) { LoadStoreInfoFromDataNode(DataFormats.LoadFromString(storeInfo)); yield break; } yield return(WebClient.RESTRequest(url, WebClient.DefaultTimeout, (error, msg) => { Log.Write("LoadStoreInfo() error: " + error); }, (response) => { if (response != null) { Cache.Add("ttrs-store-info", Cache.FileType.JSON, DataFormats.SaveToString(DataFormat.JSON, response)); LoadStoreInfoFromDataNode(response); } else { Log.Write("LoadStoreInfo() error: No response from 22series.com"); } })); }
public static DataNode GetDataNode(string CacheId, FileType FileType, int CacheLifetimeInMinutes, string WalletAddress = "") { var cacheContents = GetAsString(CacheId, FileType, CacheLifetimeInMinutes, WalletAddress); if (String.IsNullOrEmpty(cacheContents)) { return(null); } return(DataFormats.LoadFromString(cacheContents)); }