namespace StockSharp.Messages;
///
/// Remove file message (upload or download).
///
public class RemoteFileMessage : BaseSubscriptionIdMessage, ITransactionIdMessage, ISecurityIdMessage, IFileMessage
{
///
/// Initializes a new instance of the .
///
public RemoteFileMessage()
: base(MessageTypes.RemoteFile)
{
}
///
[DataMember]
public long TransactionId { get; set; }
private byte[] _body = [];
///
/// File body.
///
[DataMember]
public byte[] Body
{
get => _body;
set => _body = value ?? throw new ArgumentNullException(nameof(value));
}
///
[DataMember]
public SecurityId SecurityId { get; set; }
///
/// Market data type.
///
[DataMember]
public DataType FileDataType { get; set; }
///
/// Date.
///
[DataMember]
public DateTimeOffset Date { get; set; }
///
/// Storage format.
///
[DataMember]
public int Format { get; set; }
///
/// Copy the message into the .
///
/// The object, to which copied information.
public override void CopyTo(RemoteFileMessage destination)
{
base.CopyTo(destination);
destination.TransactionId = TransactionId;
destination.Body = Body;
destination.SecurityId = SecurityId;
destination.FileDataType = FileDataType?.TypedClone();
destination.Date = Date;
destination.Format = Format;
}
///
/// Create a copy of .
///
/// Copy.
public override Message Clone()
{
var clone = new RemoteFileMessage();
CopyTo(clone);
return clone;
}
///
public override DataType DataType => DataType.RemoteFile;
///
public override string ToString()
{
return base.ToString() + $",SecId={SecurityId},DT={FileDataType},Date={Date},Fmt={Format},BodyLen={Body.Length}";
}
}