public static object DemarshalObject(this ITypeMarshaler marshaler, byte[] data) { using (MemoryStream memoryStream = new MemoryStream(data)) { return(marshaler.DemarshalObject(memoryStream)); } }
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); }
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); }
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); }
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); }
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); }
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)); }