public static object DemarshalObject(this ITypeMarshaler marshaler, byte[] data)
 {
     using (MemoryStream memoryStream = new MemoryStream(data))
     {
         return(marshaler.DemarshalObject(memoryStream));
     }
 }
Ejemplo n.º 2
0
        public object ReadResult(Type returnType)
        {
            object result;

            byte[] data = ByteArrayMarshaler.Demarshal(InputStream);
            using (MemoryStream stream = new MemoryStream(data))
            {
                ITypeMarshaler marshaler = MarshalingManager.GetMarshaler(returnType);
                result = marshaler.DemarshalObject(stream);
            }
            return(result);
        }
Ejemplo n.º 3
0
        public object DemarshalObject(Stream stream)
        {
            int   count = Int32Marshaler.Demarshal(stream);
            IList list  = (IList)Activator.CreateInstance(ManagedType);

            for (int i = 0; i < count; i++)
            {
                object element = _elementMarshaler.DemarshalObject(stream);
                list.Add(element);
            }
            return(list);
        }
Ejemplo n.º 4
0
        public object DemarshalObject(Stream stream)
        {
            int   count       = Int32Marshaler.Demarshal(stream);
            Type  elementType = _elementMarshaler.ManagedType;
            Array array       = Array.CreateInstance(elementType, count);

            for (int i = 0; i < count; i++)
            {
                object element = _elementMarshaler.DemarshalObject(stream);
                array.SetValue(element, i);
            }
            return(array);
        }
Ejemplo n.º 5
0
        public object DemarshalObject(Stream stream)
        {
            List <UniqueSettings> collection = new List <UniqueSettings>();
            int count = Int32Marshaler.Demarshal(stream);

            for (int i = 0; i < count; i++)
            {
                UniqueSettings element = (UniqueSettings)_elementMarshaler.DemarshalObject(stream);
                collection.Add(element);
            }
            DynamicSettings settings = (DynamicSettings)Activator.CreateInstance(ManagedType, collection);

            return(settings);
        }
Ejemplo n.º 6
0
 public object[] ReadArguments(Type[] signature)
 {
     object[] arguments = new object[signature.Length];
     byte[]   data      = ByteArrayMarshaler.Demarshal(InputStream);
     using (MemoryStream stream = new MemoryStream(data))
     {
         for (int i = 0; i < arguments.Length; i++)
         {
             Type           type      = signature[i];
             ITypeMarshaler marshaler = MarshalingManager.GetMarshaler(type);
             arguments[i] = marshaler.DemarshalObject(stream);
         }
     }
     return(arguments);
 }
Ejemplo n.º 7
0
        public object DemarshalObject(Stream stream)
        {
            object value = _underlyingMarshaler.DemarshalObject(stream);

            return(value);
        }
        public static object Demarshal(Type targetType, Stream stream)
        {
            ITypeMarshaler marshaler = GetMarshaler(targetType);

            return(marshaler.DemarshalObject(stream));
        }