private TextRecogTopLevelMultiple ProcessRecognizeTextResult(byte[] json_data) { TextRecogTopLevelMultiple text = null; try { fsData data = null; fsResult r = fsJsonParser.Parse(Encoding.UTF8.GetString(json_data), out data); if (!r.Succeeded) { throw new WatsonException(r.FormattedMessages); } text = new TextRecogTopLevelMultiple(); object obj = text; r = sm_Serializer.TryDeserialize(data, obj.GetType(), ref obj); if (!r.Succeeded) { throw new WatsonException(r.FormattedMessages); } } catch (Exception e) { Log.Error("Visual Recognition", "Detect text exception: {0}", e.ToString()); } return(text); }
private void OnRecognizeTextResp(RESTConnector.Request req, RESTConnector.Response resp) { TextRecogTopLevelMultiple text = null; if (resp.Success) { text = ProcessRecognizeTextResult(resp.Data); } if (((RecognizeTextReq)req).Callback != null) { ((RecognizeTextReq)req).Callback(text); } }