示例#1
0
        public void Deserialize <TInput>(ref Reader <TInput> reader, Exception value)
        {
            uint      fieldId                = 0;
            string    message                = null;
            string    stackTrace             = null;
            Exception innerException         = null;
            Dictionary <object, object> data = null;
            int hResult = 0;

            while (true)
            {
                var header = reader.ReadFieldHeader();
                if (header.IsEndBaseOrEndObject)
                {
                    break;
                }

                fieldId += header.FieldIdDelta;
                switch (fieldId)
                {
                case 0:
                    message = StringCodec.ReadValue(ref reader, header);
                    break;

                case 1:
                    stackTrace = StringCodec.ReadValue(ref reader, header);
                    break;

                case 2:
                    innerException = ReadValue(ref reader, header);
                    break;

                case 3:
                    hResult = Int32Codec.ReadValue(ref reader, header);
                    break;

                case 4:
                    data = _dictionaryCodec.ReadValue(ref reader, header);
                    break;

                default:
                    reader.ConsumeUnknownField(header);
                    break;
                }
            }

            SetBaseProperties(value, message, stackTrace, innerException, hResult, data);
        }
示例#2
0
        public SiloAddress ReadValue <TReaderInput>(ref Reader <TReaderInput> reader, Field field)
        {
            if (field.WireType == WireType.Reference)
            {
                return(ReferenceCodec.ReadReference <SiloAddress, TReaderInput>(ref reader, field));
            }

            ReferenceCodec.MarkValueField(reader.Session);
            int        id         = 0;
            Field      header     = default;
            IPEndPoint endpoint   = default;
            int        generation = default;

            while (true)
            {
                id = OrleansGeneratedCodeHelper.ReadHeader(ref reader, ref header, id);
                if (id == 0)
                {
                    endpoint = IPEndPointCodec.ReadValue(ref reader, header);
                    id       = OrleansGeneratedCodeHelper.ReadHeader(ref reader, ref header, id);
                }

                if (id == 1)
                {
                    generation = Int32Codec.ReadValue(ref reader, header);
                    id         = OrleansGeneratedCodeHelper.ReadHeaderExpectingEndBaseOrEndObject(ref reader, ref header, id);
                }

                if (id == -1)
                {
                    break;
                }

                reader.ConsumeUnknownField(header);
            }

            return(SiloAddress.New(endpoint, generation));
        }