Akka.Remote.Serialization.MessageContainerSerializer.FromBinary C# (CSharp) Метод

FromBinary() публичный Метод

Deserializes a byte array into an object of type type.
Unknown SelectionEnvelope.Elements.Type
public FromBinary ( byte bytes, Type type ) : object
bytes byte The array containing the serialized object
type System.Type The type of object contained in the array
Результат object
        public override object FromBinary(byte[] bytes, Type type)
        {
            SelectionEnvelope selectionEnvelope = SelectionEnvelope.ParseFrom(bytes);
            Type msgType = null;
            if (selectionEnvelope.HasMessageManifest)
            {
                msgType = Type.GetType(selectionEnvelope.MessageManifest.ToStringUtf8());
            }
            int serializerId = selectionEnvelope.SerializerId;
            object msg = Deserialize(selectionEnvelope.EnclosedMessage, msgType, serializerId);
            SelectionPathElement[] elements = selectionEnvelope.PatternList.Select<Selection, SelectionPathElement>(p =>
            {
                if (p.Type == PatternType.PARENT)
                    return new SelectParent();
                if (p.Type == PatternType.CHILD_NAME)
                    return new SelectChildName(p.Matcher);
                if (p.Type == PatternType.CHILD_PATTERN)
                    return new SelectChildPattern(p.Matcher);
                throw new NotSupportedException("Unknown SelectionEnvelope.Elements.Type");
            }).ToArray();
            return new ActorSelectionMessage(msg, elements);
        }
    }