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


C# BinaryTokenStreamReader.ReadString方法代码示例

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


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

示例1: Deserialize

 private static object Deserialize(Type expected, BinaryTokenStreamReader stream)
 {
     DeserializeCounter++;
     var result = new ClassWithCustomSerializer();
     result.IntProperty = stream.ReadInt();
     result.StringProperty = stream.ReadString();
     return result;
 }
开发者ID:PaulNorth,项目名称:orleans,代码行数:8,代码来源:CustomSerializerTests.cs

示例2: Deserialize

        /// <summary>
        /// Deserializes an object from a binary stream
        /// </summary>
        /// <param name="expectedType">The type that is expected to be deserialized</param>
        /// <param name="reader">The <see cref="BinaryTokenStreamReader"/></param>
        /// <returns>The deserialized object</returns>
        public object Deserialize(Type expectedType, BinaryTokenStreamReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            var str = reader.ReadString();
            return JsonConvert.DeserializeObject(str, expectedType, settings);
        }
开发者ID:cuteant,项目名称:orleans,代码行数:16,代码来源:OrleansJsonSerializer.cs

示例3: Deserializer

            public static System.Object Deserializer(System.Type expected,  BinaryTokenStreamReader stream)
            {
                var result = new HeadersContainer();
                Orleans.Serialization.DeserializationContext.Current.RecordObject(result);
                var headers = (Headers)stream.ReadInt();

                if ((headers & Headers.CACHE_INVALIDATION_HEADER) != Headers.NONE)
                {
                    var n = stream.ReadInt();
                    if (n > 0)
                    {
                       var list = result.CacheInvalidationHeader = new List<ActivationAddress>(n);
                        for (int i = 0; i < n; i++)
                        {
                            list.Add((ActivationAddress)ReadObj(typeof(ActivationAddress), stream));
                        }
                    }
                }

                if ((headers & Headers.CATEGORY) != Headers.NONE)
                    result.Category = (Categories)stream.ReadByte();

                if ((headers & Headers.DEBUG_CONTEXT) != Headers.NONE)
                    result.DebugContext = stream.ReadString();

                if ((headers & Headers.DIRECTION) != Headers.NONE)
                    result.Direction = (Message.Directions)stream.ReadByte();

                if ((headers & Headers.EXPIRATION) != Headers.NONE)
                    result.Expiration = stream.ReadDateTime();

                if ((headers & Headers.FORWARD_COUNT) != Headers.NONE)
                    result.ForwardCount = stream.ReadInt();

                if ((headers & Headers.GENERIC_GRAIN_TYPE) != Headers.NONE)
                    result.GenericGrainType = stream.ReadString();

                if ((headers & Headers.CORRELATION_ID) != Headers.NONE)
                    result.Id = (Orleans.Runtime.CorrelationId)ReadObj(typeof(Orleans.Runtime.CorrelationId), stream);

                if ((headers & Headers.ALWAYS_INTERLEAVE) != Headers.NONE)
                    result.IsAlwaysInterleave = ReadBool(stream);

                if ((headers & Headers.IS_NEW_PLACEMENT) != Headers.NONE)
                    result.IsNewPlacement = ReadBool(stream);

                if ((headers & Headers.READ_ONLY) != Headers.NONE)
                    result.IsReadOnly = ReadBool(stream);

                if ((headers & Headers.IS_UNORDERED) != Headers.NONE)
                    result.IsUnordered = ReadBool(stream);

                if ((headers & Headers.NEW_GRAIN_TYPE) != Headers.NONE)
                    result.NewGrainType = stream.ReadString();

                if ((headers & Headers.REJECTION_INFO) != Headers.NONE)
                    result.RejectionInfo = stream.ReadString();

                if ((headers & Headers.REJECTION_TYPE) != Headers.NONE)
                    result.RejectionType = (RejectionTypes)stream.ReadByte();

                if ((headers & Headers.REQUEST_CONTEXT) != Headers.NONE)
                {
                    var c = stream.ReadInt();
                    var requestData = new Dictionary<string, object>(c);
                    for (int i = 0; i < c; i++)
                    {
                        requestData[stream.ReadString()] = SerializationManager.DeserializeInner(null, stream);
                    }
                    result.RequestContextData = requestData;
                }

                if ((headers & Headers.RESEND_COUNT) != Headers.NONE)
                    result.ResendCount = stream.ReadInt();

                if ((headers & Headers.RESULT) != Headers.NONE)
                    result.Result = (Orleans.Runtime.Message.ResponseTypes)stream.ReadByte();

                if ((headers & Headers.SENDING_ACTIVATION) != Headers.NONE)
                    result.SendingActivation = stream.ReadActivationId();

                if ((headers & Headers.SENDING_GRAIN) != Headers.NONE)
                    result.SendingGrain = stream.ReadGrainId();

                if ((headers & Headers.SENDING_SILO) != Headers.NONE)
                    result.SendingSilo = stream.ReadSiloAddress();

                if ((headers & Headers.TARGET_ACTIVATION) != Headers.NONE) 
                    result.TargetActivation = stream.ReadActivationId();

                if ((headers & Headers.TARGET_GRAIN) != Headers.NONE)
                    result.TargetGrain = stream.ReadGrainId();

                if ((headers & Headers.TARGET_OBSERVER) != Headers.NONE)
                    result.TargetObserverId = (Orleans.Runtime.GuidId)ReadObj(typeof(Orleans.Runtime.GuidId), stream);

                if ((headers & Headers.TARGET_SILO) != Headers.NONE)
                    result.TargetSilo = stream.ReadSiloAddress();

                return (HeadersContainer)result;
//.........这里部分代码省略.........
开发者ID:osjimenez,项目名称:orleans,代码行数:101,代码来源:Message.cs

示例4: Deserialize

 internal static object Deserialize(Type unused, BinaryTokenStreamReader stream)
 {
     var target = stream.ReadString();            
     var message = MessageEnvelope.Serializer.Deserialize(stream);
     return new RequestEnvelope(target, message);
 }
开发者ID:fjsnogueira,项目名称:Orleankka,代码行数:6,代码来源:RequestEnvelope.cs

示例5: ReadType

 private Type ReadType(SerializationTokenType token, BinaryTokenStreamReader reader, Type expectedType)
 {
     switch (token)
     {
         case SerializationTokenType.ExpectedType:
             return expectedType;
         case SerializationTokenType.NamedType:
             return Type.GetType(reader.ReadString(), throwOnError: true);
         default:
             throw new NotSupportedException($"{nameof(SerializationTokenType)} of {token} is not supported.");
     }
 }
开发者ID:osjimenez,项目名称:orleans,代码行数:12,代码来源:ILBasedFallbackSerializer.cs

示例6: Deserialize

 /// <summary>
 /// Deserializes an event sequence token
 /// </summary>
 /// <param name="expected">The expected type.</param>
 /// <param name="reader">The binary stream to read from.</param>
 /// <returns></returns>
 public static object Deserialize(Type expected, BinaryTokenStreamReader reader)
 {
     var deserialized = new EventHubSequenceTokenV2(reader.ReadString(), reader.ReadLong(), reader.ReadInt());
     DeserializationContext.Current.RecordObject(deserialized);
     return deserialized;
 }
开发者ID:Carlm-MS,项目名称:orleans,代码行数:12,代码来源:EventHubSequenceTokenV2.cs


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