コード例 #1
0
 /// <summary>
 /// 针对响应数据回调处理
 /// </summary>
 /// <param name="cmConOpt"></param>
 /// <param name="command"></param>
 private static void RespCallBack(CmppConnectionOption cmConOpt, CmppCommand command)
 {
     //LogUtil.Info("接收运营商响应信息", command, CompModuleLogs.SmsExchangeRespLog);
     if (command.Response.MsgHeader.CommandType == CommandType.ConnectResp)
     {
         var resp = command.Response as ConnectResp;
         if (resp != null)
         {
             var result = resp.GetResult();
             if (result.Ret == ResultTypes.Success)
             {
                 LogUtil.Info("建立连接成功!", "connect_success");
             }
             else
             {
                 LogUtil.Info(result.Message, "connect_failed");
             }
         }
     }
     else if (command.Response.MsgHeader.CommandType != CommandType.ActiveTestResp &&
              command.Response.MsgHeader.CommandType != CommandType.ActiveTest)
     {
         if (cmConOpt.CallBack != null)
         {
             AsynUtil.Asyn(obj =>
             {
                 var com = obj.Item2;
                 var opt = obj.Item1;
                 opt.CallBack(com);
             }, Tuple.Create(cmConOpt, command));
         }
     }
 }
コード例 #2
0
        /// <summary>
        ///   记录日志
        /// </summary>
        /// <param name="info"></param>
        private static string Log(LogInfo info)
        {
            if (string.IsNullOrEmpty(info.ModuleName))
            {
                info.ModuleName = ModuleNames.Default;
            }

            var logWrite = GetLogWrite(info.ModuleName);

            info.LogCode = logWrite.GetLogCode(info);

            AsynUtil.Asyn(logWrite.WriteLog, info, LogAsynModuleName); // logActionList.Post(info);
            return(info.LogCode);
        }