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


C# IMessage.Write方法代码示例

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


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

示例1: SendMessage

 public void SendMessage(IMessage msg, NetConnection conn)
 {
     NetOutgoingMessage om = server.CreateMessage();
     om.Write(msg.Id);
     msg.Write(om);
     server.SendMessage(om, conn, NetDeliveryMethod.Unreliable);
 }
开发者ID:xxy1991,项目名称:cozy,代码行数:7,代码来源:ServerMain.cs

示例2: SendMessage

 public void SendMessage(IMessage msg)
 {
     lock (MessageQueueLocker)
     {
         NetOutgoingMessage om = client.CreateMessage();
         om.Write(msg.Id);
         msg.Write(om);
         if (om.LengthBytes > MaxPacketSize)
         {
             var id = client.UniqueIdentifier;
             lock (PacketMessageDictionaryLocker)
             {
                 PacketMessageDictionary[id] = om;
             }
             var packetMsg = new SendPacketMessage()
             {
                 UniqueIdentifier    = id,
                 TargetSize          = (om.LengthBytes + MaxPacketSize - 1) / MaxPacketSize,
             };
             SendMessage(packetMsg);
         }
         else
         {
             MessageQueue.Enqueue(new NetClientMsg(om, NetDeliveryMethod.Unreliable));
         }
     }
 }
开发者ID:xxy1991,项目名称:cozy,代码行数:27,代码来源:ClientMain.cs

示例3: SendMessageExceptOne

        public static void SendMessageExceptOne(NetServer server, IMessage msg, NetConnection except)
        {
            NetOutgoingMessage om = server.CreateMessage();
            om.Write(msg.Id);
            msg.Write(om);

            List<NetConnection> all = server.Connections;
            if (all.Contains(except))
            {
                all.Remove(except);
            }
            if (all.Count > 0)
            {
                server.SendMessage(om, all, NetDeliveryMethod.Unreliable, 0);
            }
        }
开发者ID:shangshen,项目名称:cozy,代码行数:16,代码来源:ServerMain.cs

示例4: Serialize

 private byte[] Serialize(IMessage msg)
 {
     MemoryStream ms = new MemoryStream();
     NetworkWriter writer = new NetworkWriter(ms);
     msg.Write(writer);
     return ms.ToArray();
 }
开发者ID:JimmyJune,项目名称:DotWeb,代码行数:7,代码来源:Messages.cs

示例5: SerializeRequest

        private void SerializeRequest(IMessage message, MethodDefinition method, object[] args)
        {
            message.InitializeRequestMessage(this._serviceProxy.ClientChannel, this._serviceInterface.Namespace, this._serviceProxy.ActiveInterfaceName, method.Name);

            for (int i = 0; i < method.Parameters.Count; i++)
            {
                ParameterDefinition parameter = method.Parameters[i];
                message.Write(parameter.Name, args[i], parameter.Type, parameter.StreamingFormat);
            }

            message.FinalizeMessage();
        }
开发者ID:Phrynohyas,项目名称:margo,代码行数:12,代码来源:ServiceDynamicProxy.cs

示例6: SendMessage

 public void SendMessage(IMessage msg)
 {
     lock (MessageQueueLocker)
     {
         NetOutgoingMessage om = client.CreateMessage();
         om.Write(msg.Id);
         msg.Write(om);
         MessageQueue.Enqueue(new NetClientMsg(om, NetDeliveryMethod.Unreliable));
     }
 }
开发者ID:shangshen,项目名称:cozy,代码行数:10,代码来源:ClientMain.cs

示例7: SendMessageToServer

 public void SendMessageToServer(IMessage msg)
 {
     if (ServerConn != null)
     {
         NetOutgoingMessage om = server.CreateMessage();
         om.Write(msg.Id);
         msg.Write(om);
         server.SendMessage(om, ServerConn, NetDeliveryMethod.Unreliable);
     }
 }
开发者ID:xxy1991,项目名称:cozy,代码行数:10,代码来源:RelayServerMain.cs


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