public static string GetCoCUrlSingle(stCoCAPI.CoCAPI.CoCEnum.CoCFmtReq type, string key, string clanTag, string curlexe, string rootpath, stCore.IMessage iLog = null) { if (!CoCRequest._CheckArgs(type, key, clanTag, iLog)) { return(String.Empty); } string reqUrl = CoCRequest.MakeCoCUrl(type, clanTag); if (string.IsNullOrWhiteSpace(reqUrl)) { stCore.LogException.Error(Properties.Resources.CoCUrlEmpty, iLog); return(String.Empty); } #if DEBUG_CHECKCURL stConsole.WriteHeader("Get URL: " + reqUrl); #endif dynamic ccl = null; try { ccl = CoCRequest._InitCUrlObj(curlexe, key, rootpath, iLog); string jsonOut = ccl.GetJson(reqUrl, ((stRuntime.isRunTime()) ? null : key)); if (!CoCRequest._CheckReturnString(jsonOut, type, iLog)) { return(String.Empty); } return(jsonOut); } catch (Exception e) { stCore.LogException.Error(e, iLog); return(String.Empty); } finally { if (ccl != null) { ccl.Dispose(); } } }
public static string GetCoCUrlMulti(stCoCAPI.CoCAPI.CoCEnum.CoCFmtReq type, string key, string clanTag, dynamic curlobj, stCore.IMessage iLog = null) { if (curlobj == null) { stCore.LogException.Error(Properties.Resources.CurlObjEmpty, iLog); return(String.Empty); } if (!CoCRequest._CheckArgs(type, key, clanTag, iLog)) { return(String.Empty); } string reqUrl = CoCRequest.MakeCoCUrl(type, clanTag); if (string.IsNullOrWhiteSpace(reqUrl)) { stCore.LogException.Error(Properties.Resources.CoCUrlEmpty, iLog); return(String.Empty); } #if DEBUG_CHECKCURL stConsole.WriteHeader("Get URL: " + reqUrl); #endif try { string jsonOut = curlobj.GetJson(reqUrl, ((stRuntime.isRunTime()) ? null : key)); if (!CoCRequest._CheckReturnString(jsonOut, type, iLog)) { return(String.Empty); } return(jsonOut); } catch (Exception e) { stCore.LogException.Error(e, iLog); return(String.Empty); } }