Sry.Framework.Web/Message.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sry.Framework.Web
{
    public class Message : IBinaryParse
    {
        public int Length { get; set; }
        public long CRC { get; set; }
        public string AppKey { get; set; }
        public string Recret { get; set; }
        public string SessionKey { get; set; }
        public string Callback { get; set; }
        public bool IsAsync { get; set; }
        public bool MustResponse { get; set; }
        public int ByteTotal { get; set; }
        public byte[] Bytes { get; set; }
        public int Count { get; set; }
        public List<MessageBody> Items { get; set; }


        public void Read(System.IO.BinaryReader reader)
        {
            this.AppKey = reader.ReadString();
            this.Recret = reader.ReadString();
            this.SessionKey = reader.ReadString();
            this.Callback = reader.ReadString();
            this.IsAsync = reader.ReadBoolean();
            this.MustResponse = reader.ReadBoolean();
            this.Count = reader.ReadInt32();
            this.ByteTotal = reader.ReadInt32();
            this.Bytes = reader.ReadBytes(this.ByteTotal);
            
        }

        public void Write(System.IO.BinaryWriter writer)
        {
            writer.Write(this.AppKey ?? "");
            writer.Write(this.Recret ?? "");
            writer.Write(this.SessionKey ?? "");
            writer.Write(this.Callback ?? "");
            writer.Write(this.IsAsync);
            writer.Write(this.MustResponse);
            
            if (Items != null && Items.Count > 0)
            {
                using (var stream = new MemoryStream())
                {
                    using (var bodyWriter = new BinaryWriter(stream))
                    {
                        foreach (MessageBody body in Items)
                        {
                            body.Write(bodyWriter);
                        }
                        this.ByteTotal = (int)stream.Length;
                        this.Bytes = stream.ToArray();
后面还有 32 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。