/// <summary> /// 对文件类型消息进行处理 /// </summary> private void ProcessFileMessage(MessageContext info) { ResponseAckInfo responseAckInfo = info.IMResponse; if (responseAckInfo.Status == ResponseCode.OK) { if (responseAckInfo.Data == null) { //已经有此文件 return; } if (responseAckInfo.DataDict.ContainsKey("upload_url")) { object upload_url = responseAckInfo.DataDict["upload_url"]; if (upload_url != null && !string.IsNullOrWhiteSpace(upload_url.ToString())) { Upload(info.IMRequest.MessageId, upload_url.ToString(), info.IMRequest.Data.path); return; } } } }
public static void Connected(RequestInfo rqInfo, ResponseAckInfo ackInfo) { int a = ackInfo.Data["11"]; Console.WriteLine("Connected:{0}", ackInfo.MessageId); }
public static void SendCallback(RequestInfo rqInfo, ResponseAckInfo ackInfo) { Console.WriteLine("SendCallback:{0}", ackInfo.MessageId); }
private void LoopTestLogToFile(RequestInfo rqInfo, ResponseAckInfo ackInfo, string sendData) { System.IO.File.AppendAllText(filePath, string.Format("{0}|{1}|{2}|{3}\r\n", sendData, ackInfo.MessageId, ackInfo.Status, DateTime.Now.ToString())); }
public void Connected(RequestInfo rqInfo, ResponseAckInfo ackInfo) { Log(string.Format("ConnectedCallBack:{0}", ackInfo.ToJsonString())); }
/// <summary> /// 统一处理用户回调函数 /// </summary> /// <param name="callback"></param> /// <param name="requestInfo"></param> /// <param name="responseInfo"></param> private void RunUserCallback(Action <RequestInfo, ResponseAckInfo> callback, RequestInfo requestInfo, ResponseAckInfo responseInfo) { if (callback != null) { try { callback(requestInfo, responseInfo); //LogOpInfo("RunUserCallback:", responseInfo.ToJsonString()); } catch (Exception ex) { LogInfo("用户:回调异常", ex); string runFunName = "未知方法"; try { runFunName = callback.Method.ReflectedType.Name + "." + callback.Method.Name; } catch { } throw new Exception(string.Format("回调函数 {0} 异常", runFunName));//抛出用户异常 } } }
public void CallbackFun(RequestInfo rqInfo, ResponseAckInfo ackInfo) { Log(string.Format("client:{0}\r\nserver:{1}", rqInfo.ToJsonString(), ackInfo.ToJsonString())); }