[fix]Config创建默认配置文件的开关Runtime.CreateConfigOnMissing,仅需对自动创建生效,而不应该阻止用户主动Save
智能大石头 编写于 2024-08-09 00:30:41 石头 提交于 2024-08-10 14:22:24
X
using NewLife.Data;

namespace NewLife.Http;

public class ByteArrayContent : HttpContent
{
    #region 属性
    public Packet Data { get; set; }
    #endregion

    #region 构造
    public ByteArrayContent(Packet packet) => Data = packet;

    public ByteArrayContent(Byte[] data) => Data = data;

    public ByteArrayContent(Byte[] data, Int32 offset, Int32 length) => Data = new Packet(data, offset, length);
    #endregion

    #region 方法
    public override Task<Byte[]> ReadAsByteArrayAsync(CancellationToken cancellationToken) => Task.FromResult(Data.ReadBytes());
    #endregion
}