public bool StoreHasKey(string key) { ResultMessageData data = StoreHasKeyAsData(key); bool b = false; return(bool.TryParse(data.result, out b)); }
public ResultMessageData StoreHasKeyAsData(string key) { string ip = serverIp.Replace("http://", "").Replace("https://", ""); string url = string.Format("http://{0}/postman/store?cmd=HAS&key={1}", ip, key); if (secureToken != "") { url += "&tkn=" + secureToken; } UnityWebRequest request = UnityWebRequest.Get(url); request.SendWebRequest(); while (!request.isDone) { ; } ResultMessageData responce; #if UNITY_2020_1_OR_NEWER if (request.result == UnityWebRequest.Result.ProtocolError || request.result == UnityWebRequest.Result.ConnectionError) #else if (request.isHttpError || request.isNetworkError) #endif { Debug.LogError("PostmanClient :: " + request.error); responce = new ResultMessageData("", request.error); } else { responce = JsonConvert.DeserializeObject <ResultMessageData>(request.downloadHandler.text); Debug.Log(string.Format("PostmanClient :: store haskey [ {0} ] ", key) + responce.result); } request.Dispose(); return(responce); }
public string StoreSet(string key, string val) { ResultMessageData data = StoreSetAsData(key, val); return(data.result); }
public string StoreGet(string key) { ResultMessageData data = StoreGetAsData(key); return(data.result); }