public static Dictionary <string, string> ContentToEventParams(OwrResponse response, ILogger logger) { var eventParams = new Dictionary <string, string>(); eventParams.Add("ResponseCode", response.Definitions.OwrRequest.ResponseCode.ToString()); eventParams.Add("ResponseMessage", response.Definitions.OwrRequest.ResponseMessage); eventParams.Add("LaunchUri", response.Definitions.OwrRequest.LaunchUri); return(eventParams); }
public static OwrResponse DeserializeOwrResponseJson(string json, ILogger logger) { if (string.IsNullOrWhiteSpace(json)) { return(null); } try { var response = new OwrResponse(); using (var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(json))) { var deSerializer = new DataContractJsonSerializer(response.GetType()); response = deSerializer.ReadObject(memoryStream) as OwrResponse; } return(response); } catch (Exception ex) { logger.LogError($"Failed trying to deserialize response from the server. Exception:{ex.ToString()}"); return(null); } }