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


C# LLSD.AsBinary方法代码示例

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


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

示例1: SerializeBinaryElement

 private static void SerializeBinaryElement( MemoryStream stream, LLSD llsd )
 {
     switch( llsd.Type )
     {
         case LLSDType.Unknown:
             stream.WriteByte( undefBinaryValue );
             break;
         case LLSDType.Boolean:
             stream.Write( llsd.AsBinary(), 0, 1 );
             break;
         case LLSDType.Integer:
             stream.WriteByte( integerBinaryMarker );
             stream.Write( llsd.AsBinary(), 0, int32Length );
             break;
         case LLSDType.Real:
             stream.WriteByte( realBinaryMarker );
             stream.Write( llsd.AsBinary(), 0, doubleLength );
             break;
         case LLSDType.UUID:
             stream.WriteByte( uuidBinaryMarker );
             stream.Write( llsd.AsBinary(), 0, 16 );
             break;
         case LLSDType.String:
             stream.WriteByte( stringBinaryMarker );
             byte[] rawString = llsd.AsBinary();
             byte[] stringLengthNetEnd = HostToNetworkIntBytes( rawString.Length );
             stream.Write( stringLengthNetEnd, 0, int32Length );
             stream.Write( rawString, 0, rawString.Length );
             break;
         case LLSDType.Binary:
             stream.WriteByte( binaryBinaryMarker );
             byte[] rawBinary = llsd.AsBinary();
             byte[] binaryLengthNetEnd = HostToNetworkIntBytes( rawBinary.Length );
             stream.Write( binaryLengthNetEnd, 0, int32Length );
             stream.Write( rawBinary, 0, rawBinary.Length );
             break;
         case LLSDType.Date:
             stream.WriteByte( dateBinaryMarker );
             stream.Write( llsd.AsBinary(), 0, doubleLength );
             break;
         case LLSDType.URI:
             stream.WriteByte( uriBinaryMarker );
             byte[] rawURI = llsd.AsBinary();
             byte[] uriLengthNetEnd = HostToNetworkIntBytes( rawURI.Length );
             stream.Write( uriLengthNetEnd, 0, int32Length );
             stream.Write( rawURI, 0, rawURI.Length );
             break;
         case LLSDType.Array:
             SerializeBinaryArray( stream, (LLSDArray)llsd );
             break;
         case LLSDType.Map:
             SerializeBinaryMap( stream, (LLSDMap)llsd );
             break;
         default:
             throw new LLSDException( "Binary serialization: Not existing element discovered." );
                     
     }
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:58,代码来源:BinaryLLSD.cs


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