当前位置: 首页>>代码示例>>C#>>正文


C# MessageStructure.ReadHeadGzip方法代码示例

本文整理汇总了C#中ZyGames.Framework.RPC.IO.MessageStructure.ReadHeadGzip方法的典型用法代码示例。如果您正苦于以下问题:C# MessageStructure.ReadHeadGzip方法的具体用法?C# MessageStructure.ReadHeadGzip怎么用?C# MessageStructure.ReadHeadGzip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZyGames.Framework.RPC.IO.MessageStructure的用法示例。


在下文中一共展示了MessageStructure.ReadHeadGzip方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnNetTcpCallback

 private static void OnNetTcpCallback(object sender, RemoteEventArgs e)
 {
     try
     {
         RemoteService proxy = sender as RemoteService;
         if (proxy == null)
         {
             return;
         }
         try
         {
             using (var ms = new MessageStructure(e.Data))
             {
                 var head = ms.ReadHeadGzip();
                 if (head != null)
                 {
                     var package = proxy.Find(head.MsgId);
                     if (package != null)
                     {
                         package.Message = ms.ReadBuffer();
                         proxy.Remove(head.MsgId);
                         package.OnCallback();
                         return;
                     }
                 }
             }
         }
         catch (Exception)
         { }
         proxy.OnPushedHandle(e);
     }
     catch (Exception ex)
     {
         TraceLog.WriteError("OnNetTcpCallback error:{0}", ex);
     }
 }
开发者ID:yunjoker,项目名称:Scut,代码行数:36,代码来源:RemoteService.cs

示例2: OnReceive

 private static void OnReceive(object sender, SocketEventArgs e)
 {
     var myConnect = ((ClientSocket)sender).UserData as MyConnect;
     if (myConnect != null)
     {
         var stream = new MessageStructure(e.Data);
         var head = stream.ReadHeadGzip();
         var pack = new MyPack() { Head = head, Data = e.Data };
         myConnect.actionPools.Enqueue(pack);
     }
 }
开发者ID:kehaoran74,项目名称:Scut,代码行数:11,代码来源:NetHelper.cs

示例3: DoReceive

 private void DoReceive(byte[] data)
 {
     try
     {
         MessageStructure writer = new MessageStructure(data);
         var head = writer.ReadHeadGzip();
         if (head.Success)
         {
             SuccessCallback(writer, head);
         }
         else
         {
             FailCallback(head);
         }
     }
     catch (Exception ex)
     {
         new BaseLog().SaveLog(ex);
     }
 }
开发者ID:rongxiong,项目名称:Scut,代码行数:20,代码来源:GameSocketClient.cs

示例4: DoRunProcess

        private void DoRunProcess(byte[] sendData)
        {
            bool success = false;
            try
            {
                MessageStructure reader = null;
                MessageHead head = null;
                _stepTimer.StartTime();
                _session.Proxy.SendAsync(sendData, data =>
                {
                    try
                    {
                        if (data.Length == 0) return true;
                        reader = new MessageStructure(data);
                        head = reader.ReadHeadGzip();
                        return head.Action.ToString() == Action;
                    }
                    catch (Exception ex)
                    {
                        TraceLog.WriteError("Step {0} error:{1}", Action, ex);
                        return false;
                    }
                });

                if (CheckCompleted(head) && DecodePacket(reader, head))
                {
                    success = true;
                    _stepTimer.Completed();
                }
            }
            catch (Exception ex)
            {
                _stepTimer.PushError(ex.Message);
            }
            finally
            {
                _stepTimer.StopTime();
            }

            if (success && ChildStep != null)
            {
                ChildStep.StartRun();
            }
        }
开发者ID:lvshiling,项目名称:Scut,代码行数:44,代码来源:CaseStep.cs


注:本文中的ZyGames.Framework.RPC.IO.MessageStructure.ReadHeadGzip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。