/// <summary> /// Deserializes a byte array into an object of type <paramref name="type"/>. /// </summary> /// <param name="bytes">The array containing the serialized object</param> /// <param name="type">The type of object contained in the array</param> /// <returns>The object contained in the array</returns> /// <exception cref="TypeLoadException"> /// Could not find type on the remote system. /// Ensure that the remote system has an assembly that contains the type in its assembly search path. /// </exception> public override object FromBinary(byte[] bytes, Type type) { var proto = DaemonMsgCreateData.ParseFrom(bytes); Type clazz; try { clazz = Type.GetType(proto.Props.Clazz, true); } catch (TypeLoadException ex) { var msg = string.Format( "Could not find type '{0}' on the remote system. " + "Ensure that the remote system has an assembly that contains the type {0} in its assembly search path", proto.Props.Clazz); throw new TypeLoadException(msg, ex); } var args = GetArgs(proto); var props = new Props(GetDeploy(proto.Props.Deploy), clazz, args); return(new DaemonMsgCreate( props, GetDeploy(proto.Deploy), proto.Path, DeserializeActorRef(proto.Supervisor))); }
public override object FromBinary(byte[] bytes, Type type) { var proto = DaemonMsgCreateData.ParseFrom(bytes); var clazz = Type.GetType(proto.Props.Clazz); var args = GetArgs(proto); var props = new Props(GetDeploy(proto.Props.Deploy), clazz, args); return(new DaemonMsgCreate( props, GetDeploy(proto.Deploy), proto.Path, DeserializeActorRef(proto.Supervisor))); }