本文整理汇总了C#中Converter.Serialize方法的典型用法代码示例。如果您正苦于以下问题:C# Converter.Serialize方法的具体用法?C# Converter.Serialize怎么用?C# Converter.Serialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Converter
的用法示例。
在下文中一共展示了Converter.Serialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeForSend
internal void InitializeForSend( IController parent, Converter converter, uint cmd, uint flags, object payload )
{
Packet header = parent.NewPacket();
header.m_cmd = cmd;
header.m_flags = flags;
m_parent = parent;
m_raw = new MessageRaw ();
m_base = new MessageBase();
m_base.m_header = header;
m_base.m_payload = payload;
if(payload != null)
{
m_raw.m_payload = converter.Serialize( payload );
m_base.m_header.m_size = (uint)m_raw.m_payload.Length;
m_base.m_header.m_crcData = CRC.ComputeCRC( m_raw.m_payload, 0 );
}
}
示例2: UpdateCRC
private void UpdateCRC( Converter converter )
{
Packet header = m_base.m_header;
//
// The CRC for the header is computed setting the CRC field to zero and then running the CRC algorithm.
//
header.m_crcHeader = 0;
header.m_crcHeader = CRC.ComputeCRC( converter.Serialize( header ), 0 );
m_raw.m_header = converter.Serialize( header );
}