Exemple #1
0
        /// <summary>
        /// 获取匿名信息
        /// </summary>
        /// <param name="source">匿名参数</param>
        /// <returns></returns>
        public GroupAnonymous GetAnonymous(string source)
        {
            BinaryReader   binary    = new BinaryReader(new MemoryStream(Convert.FromBase64String(source)));
            GroupAnonymous anonymous = new GroupAnonymous();

            anonymous.Id       = binary.ReadInt64_Ex();
            anonymous.CodeName = binary.ReadString_Ex();
            anonymous.Token    = binary.ReadToken_Ex();
            return(anonymous);
        }
Exemple #2
0
        /// <summary>
        /// 获取匿名信息
        /// </summary>
        /// <param name="source">匿名参数</param>
        /// <returns></returns>
        public GroupAnonymous GetAnonymous(string source)
        {
            UnPack         unPack    = new UnPack(Convert.FromBase64String(source));
            GroupAnonymous anonymous = new GroupAnonymous();

            anonymous.Id       = unPack.GetInt64();
            anonymous.CodeName = unPack.GetString(Encoding.GetEncoding("GB18030"));
            anonymous.Token    = unPack.GetToken();
            return(anonymous);
        }
Exemple #3
0
        private static int Evnet__eventGroupMsg(int subType, int msgId, long fromGroup, long fromQQ, string fromAnonymous, IntPtr msg, int font)
        {
            GroupAnonymous anonymous = null;

            if (fromQQ == 80000000 && !string.IsNullOrEmpty(fromAnonymous))
            {
                anonymous = Common.CqApi.GetAnonymous(fromAnonymous);
            }
            CqGroupMessageEventArgs args = new CqGroupMessageEventArgs(2, msgId, fromGroup, fromQQ, anonymous, msg.ToString(_defaultEncoding));

            if (subType == 1)
            {
                if (ReceiveGroupMessage_2 != null)
                {
                    ReceiveGroupMessage_2(null, args);
                }
            }
            return(Convert.ToInt32(args.Handler));
        }
Exemple #4
0
        public override bool Interpret(TaskContext context)
        {
            if (context is GroupMessageTaskContext groupContext)
            {
                GroupMessageType subType     = groupContext.SubType;
                Message          msg         = groupContext.Message;
                Group            fromGroup   = groupContext.FromGroup;
                QQ             fromQQ        = groupContext.FromQQ;
                GroupAnonymous fromAnonymous = groupContext.FromAnonymous;
                IntPtr         font          = groupContext.Font;

                // 存入消息列表
                this.Simulator.DataPool.MessageCollection.Add(msg);

                // 调用app
                this.Simulator.PushGroupMessage(subType, msg.Id, fromGroup, fromQQ, fromAnonymous == null ? string.Empty : fromAnonymous.ToBase64String(), msg, font);
            }
            return(false);
        }
 /// <summary>
 /// 初始化 <see cref="CqGroupMessageEventArgs"/> 类的一个新实例
 /// </summary>
 /// <param name="id">事件ID</param>
 /// <param name="name">事件名称</param>
 /// <param name="msgId">消息ID</param>
 /// <param name="fromGroup">来源群组</param>
 /// <param name="fromQQ">来源QQ</param>
 /// <param name="anonymous">来源匿名</param>
 /// <param name="msg">消息</param>
 public CqGroupMessageEventArgs(int id, string name, int msgId, long fromGroup, long fromQQ, GroupAnonymous anonymous, string msg)
 {
     base.Id            = id;
     base.Name          = name;
     this.MsgId         = msgId;
     this.FromGroup     = fromGroup;
     this.FromQQ        = fromQQ;
     this.FromAnonymous = anonymous;
     this.Message       = msg;
 }
 public GroupMessageTaskContext(GroupMessageType subType, Group fromGroup, QQ fromQQ, GroupAnonymous fromAnonymous, Message msg, IntPtr font)
     : base(2)
 {
     base.SetValue(KeySubType, subType);
     base.SetValue(KeyFromGroup, fromGroup);
     base.SetValue(KeyFromQQ, fromQQ);
     base.SetValue(KeyFromAnonymous, fromAnonymous);
     base.SetValue(KeyMessage, msg);
     base.SetValue(KeyFont, font);
 }