本文整理汇总了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." );
}
}