diff --git a/Native.Csharp.Sdk/Cqp/Core/CQP.cs b/Native.Csharp.Sdk/Cqp/Core/CQP.cs index fa4bae63..7b5006c9 100644 --- a/Native.Csharp.Sdk/Cqp/Core/CQP.cs +++ b/Native.Csharp.Sdk/Cqp/Core/CQP.cs @@ -13,6 +13,13 @@ internal static class CQP * * V9 应用机制内的变动(即 V9.x 内的变动)通常**不会**影响已发布的应用,但有可能需要开发者在更新旧版本应用时,对代码进行细微调整。 * + * V9.25 (2019-10-8) + * ----------------- + * 新增 取群信息 Api + * * 支持获取群当前人数与人数上限。如果您此前使用其他方式获取,建议迁移至本接口。 + * + * 新增 群禁言事件 + * * V9.23 (2019-9-3) * ---------------- * 新增 扩展 Cookies 适用范围 @@ -142,6 +149,12 @@ internal static class CQP [DllImport (DllName, EntryPoint = "CQ_getImage")] public static extern string CQ_getImage (int authCode, string file); - #endregion - } + + [DllImport(DllName, EntryPoint = "CQ_getGroupInfo")] + public static extern string CQ_getGroupInfo(int authCode, long groupId, bool notCache); + + [DllImport (DllName, EntryPoint = "CQ_getFriendList")] + public static extern string CQ_getFriendList (int authCode, bool reserved); + #endregion + } } diff --git a/Native.Csharp.Sdk/Cqp/CqApi.cs b/Native.Csharp.Sdk/Cqp/CqApi.cs index 69977606..56c4e379 100644 --- a/Native.Csharp.Sdk/Cqp/CqApi.cs +++ b/Native.Csharp.Sdk/Cqp/CqApi.cs @@ -595,7 +595,7 @@ public List GetMemberList (long groupId) /// /// 获取发送语音支持 /// - /// + /// 获取成功则返回 true, 否则返回 false public bool GetSendRecordSupport () { return CQP.CQ_canSendRecord (_authCode) > 0; @@ -604,11 +604,92 @@ public bool GetSendRecordSupport () /// /// 获取发送图片支持 /// - /// + /// 获取成功则返回 true, 否则返回 false public bool GetSendImageSupport () { return CQP.CQ_canSendImage (_authCode) > 0; } + + /// + /// 获取群信息 + /// + /// 群号码 + /// 不使用缓存, 通常为 false, 仅在必要时使用 + /// 如果成功返回 , 若失败返回 null + public GroupInfo GetGroupInfo (long groupId, bool notCache = false) + { + string result = CQP.CQ_getGroupInfo (_authCode, groupId, false); + if (string.IsNullOrEmpty (result)) + { + return null; + } + #region --其他_转换_文本到群信息-- + using (BinaryReader reader = new BinaryReader (new MemoryStream (Convert.FromBase64String (result)))) + { + if (reader.Length () < 18) + { + return null; + } + + GroupInfo info = new GroupInfo (); + info.Id = reader.ReadInt64_Ex (); + info.Name = reader.ReadString_Ex (_defaultEncoding); + info.CurrentNumber = reader.ReadInt32_Ex (); + info.MaximumNumber = reader.ReadInt32_Ex (); + return info; + } + #endregion + } + + /// + /// 获取好友列表 + /// + /// 获取成功返回 , 否则返回 null + public List GetFriendList () + { + string result = CQP.CQ_getFriendList (_authCode, false); + if (string.IsNullOrEmpty (result)) + { + return null; + } + + #region --其他_转换_文本到好友列表信息a-- + using (BinaryReader reader = new BinaryReader (new MemoryStream (Convert.FromBase64String (result)))) + { + if (reader.Length () < 4) + { + return null; + } + + List friends = new List (); + for (int i = 0, len = reader.ReadInt32_Ex (); i < len; i++) + { + FriendInfo temp = new FriendInfo (); + if (reader.Length () <= 0) + { + return null; + } + + #region --其他_转换_ansihex到好友信息-- + using (BinaryReader tempReader = new BinaryReader (new MemoryStream (reader.ReadToken_Ex ()))) + { + if (tempReader.Length () < 12) + { + return null; + } + + temp.Id = tempReader.ReadInt64_Ex (); + temp.Nick = tempReader.ReadString_Ex (_defaultEncoding); + temp.Note = tempReader.ReadString_Ex (_defaultEncoding); + } + #endregion + + friends.Add (temp); + } + return friends; + } + #endregion + } #endregion #region --日志-- diff --git a/Native.Csharp.Sdk/Cqp/EventArgs/CqGroupBanEventArgs.cs b/Native.Csharp.Sdk/Cqp/EventArgs/CqGroupBanEventArgs.cs new file mode 100644 index 00000000..d0e4f717 --- /dev/null +++ b/Native.Csharp.Sdk/Cqp/EventArgs/CqGroupBanEventArgs.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Native.Csharp.Sdk.Cqp.EventArgs +{ + /// + /// 表示群禁言事件参数的类 + /// + public class CqGroupBanEventArgs : CqEventArgsBase + { + /// + /// 表示当前事件的类型 + /// + public override int Type { get { return 104; } } + + /// + /// 获取当前事件触发时间 + /// + public DateTime SendTime { get; private set; } + + /// + /// 获取当前消息的来源群组号 + /// + public long FromGroup { get; private set; } + + /// + /// 操作者QQ + /// + public long FromQQ { get; private set; } + + /// + /// 获取当前事件触发时的目标QQ + /// + public long BeingOperateQQ { get; private set; } + + /// + /// 禁言时长 + /// + public TimeSpan Duration { get; private set; } + + /// + /// 获取或设置一个值, 指示当前是否处理过此事件. 若此值为 True 将停止处理后续事件 + /// + public bool Handler { get; set; } + + /// + /// 初始化 类的新实例 + /// + /// + /// + /// + /// + /// + /// + /// + public CqGroupBanEventArgs (int id, string name, DateTime sendTime, long fromGroup, long fromQQ, long beingOperateQQ, TimeSpan duration) + { + this.Id = id; + this.Name = name; + this.SendTime = sendTime; + this.FromGroup = fromGroup; + this.FromQQ = fromQQ; + this.BeingOperateQQ = beingOperateQQ; + this.Duration = duration; + } + } +} diff --git a/Native.Csharp.Sdk/Cqp/Interface/IReceiveRemoveGroupBan.cs b/Native.Csharp.Sdk/Cqp/Interface/IReceiveRemoveGroupBan.cs new file mode 100644 index 00000000..16dac000 --- /dev/null +++ b/Native.Csharp.Sdk/Cqp/Interface/IReceiveRemoveGroupBan.cs @@ -0,0 +1,22 @@ +using Native.Csharp.Sdk.Cqp.EventArgs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Native.Csharp.Sdk.Cqp.Interface +{ + /// + /// Type=104 群解除禁言事件接口 + /// + public interface IReceiveRemoveGroupBan + { + /// + /// 当在派生类中重写时, 处理收到的群解除禁言 + /// + /// 事件的触发对象 + /// 事件的附加参数 + void ReceiveRemoveGroupBan (object sender, CqGroupBanEventArgs e); + } +} diff --git a/Native.Csharp.Sdk/Cqp/Interface/IReceiveSetGroupBan.cs b/Native.Csharp.Sdk/Cqp/Interface/IReceiveSetGroupBan.cs new file mode 100644 index 00000000..cabca4be --- /dev/null +++ b/Native.Csharp.Sdk/Cqp/Interface/IReceiveSetGroupBan.cs @@ -0,0 +1,22 @@ +using Native.Csharp.Sdk.Cqp.EventArgs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Native.Csharp.Sdk.Cqp.Interface +{ + /// + /// Type=104 群禁言事件接口 + /// + public interface IReceiveSetGroupBan + { + /// + /// 当在派生类中重写时, 处理收到的群禁言 + /// + /// 事件的触发对象 + /// 事件的附加参数 + void ReceiveSetGroupBan (object sender, CqGroupBanEventArgs e); + } +} diff --git a/Native.Csharp.Sdk/Cqp/Model/FriendInfo.cs b/Native.Csharp.Sdk/Cqp/Model/FriendInfo.cs new file mode 100644 index 00000000..69a16092 --- /dev/null +++ b/Native.Csharp.Sdk/Cqp/Model/FriendInfo.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Native.Csharp.Sdk.Cqp.Model +{ + /// + /// 描述 QQ 好友信息的类 + /// + public class FriendInfo + { + /// + /// QQ帐号 + /// + public long Id { get; set; } + + /// + /// QQ昵称 + /// + public string Nick { get; set; } + + /// + /// 备注信息 + /// + public string Note { get; set; } + } +} diff --git a/Native.Csharp.Sdk/Cqp/Model/GroupInfo.cs b/Native.Csharp.Sdk/Cqp/Model/GroupInfo.cs index 0c946200..d02577f3 100644 --- a/Native.Csharp.Sdk/Cqp/Model/GroupInfo.cs +++ b/Native.Csharp.Sdk/Cqp/Model/GroupInfo.cs @@ -18,5 +18,13 @@ public class GroupInfo /// 群名字 /// public string Name { get; set; } - } + /// + /// 当前成员数量, 由 方法获取 + /// + public int CurrentNumber { get; set; } + /// + /// 获取最大成员数量, 由 方法获取 + /// + public int MaximumNumber { get; set; } + } } diff --git a/Native.Csharp.Sdk/Native.Csharp.Sdk.csproj b/Native.Csharp.Sdk/Native.Csharp.Sdk.csproj index 0991482f..47192901 100644 --- a/Native.Csharp.Sdk/Native.Csharp.Sdk.csproj +++ b/Native.Csharp.Sdk/Native.Csharp.Sdk.csproj @@ -69,6 +69,7 @@ + @@ -100,8 +101,11 @@ + + + diff --git a/Native.Csharp.Sdk/Properties/AssemblyInfo.cs b/Native.Csharp.Sdk/Properties/AssemblyInfo.cs index 02986424..812ad647 100644 --- a/Native.Csharp.Sdk/Properties/AssemblyInfo.cs +++ b/Native.Csharp.Sdk/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion ("2.5.1.0906")] -[assembly: AssemblyFileVersion ("2.5.1.0906")] +[assembly: AssemblyVersion ("2.6.0.1013")] +[assembly: AssemblyFileVersion ("2.6.0.1013")] diff --git a/Native.Csharp/App/Core/LibExport.cs b/Native.Csharp/App/Core/LibExport.cs index 620ae4fd..3fd37740 100644 --- a/Native.Csharp/App/Core/LibExport.cs +++ b/Native.Csharp/App/Core/LibExport.cs @@ -57,7 +57,7 @@ private static string AppInfo () { // ���������޸� // - Common.AppName = "��Q����Ӧ�� for C#"; + Common.AppName = "��Q����Ӧ��"; Common.AppVersion = Version.Parse ("1.0.0"); // @@ -200,6 +200,19 @@ private static void ResolveAppbackcall () ReceiveMemberBeInvitee_7 = Common.UnityContainer.Resolve ("Ⱥ��Ա�����¼�����").ReceiveGroupMemberBeInvitee; } + /* + * Id: 8 + * Name: Ⱥ�����¼����� + */ + if (Common.UnityContainer.IsRegistered ("Ⱥ�����¼�����") == true) + { + ReceiveSetGroupBan_8 = Common.UnityContainer.Resolve ("Ⱥ�����¼�����").ReceiveSetGroupBan; + } + if (Common.UnityContainer.IsRegistered ("Ⱥ�����¼�����") == true) + { + ReceiveRemoveGroupBan_8 = Common.UnityContainer.Resolve ("Ⱥ�����¼�����").ReceiveRemoveGroupBan; + } + /* * Id: 10 * Name: �����������¼����� @@ -210,25 +223,25 @@ private static void ResolveAppbackcall () } /* - * Id: 8 + * Id: 11 * Name: �������������� */ if (Common.UnityContainer.IsRegistered ("��������������") == true) { - ReceiveFriendAdd_8 = Common.UnityContainer.Resolve ("��������������").ReceiveFriendAddRequest; + ReceiveFriendAdd_11 = Common.UnityContainer.Resolve ("��������������").ReceiveFriendAddRequest; } /* - * Id: 9 + * Id: 12 * Name: Ⱥ���������� */ if (Common.UnityContainer.IsRegistered ("Ⱥ����������") == true) { - ReceiveAddGroupRequest_9 = Common.UnityContainer.Resolve ("Ⱥ����������").ReceiveAddGroupRequest; + ReceiveAddGroupRequest_12 = Common.UnityContainer.Resolve ("Ⱥ����������").ReceiveAddGroupRequest; } if (Common.UnityContainer.IsRegistered ("Ⱥ����������") == true) { - ReceiveAddGroupBeInvitee_9 = Common.UnityContainer.Resolve ("Ⱥ����������").ReceiveAddGroupBeInvitee; + ReceiveAddGroupBeInvitee_12 = Common.UnityContainer.Resolve ("Ⱥ����������").ReceiveAddGroupBeInvitee; } /* @@ -472,6 +485,35 @@ private static int Evnet__eventSystem_GroupMemberIncrease (int subType, int send return Convert.ToInt32 (args.Handler); } + /* + * Id: 8 + * Type: 104 + * Name: Ⱥ�����¼����� + * Function: _eventSystem_GroupBan + */ + public static event EventHandler ReceiveSetGroupBan_8; + public static event EventHandler ReceiveRemoveGroupBan_8; + [DllExport (ExportName = "_eventSystem_GroupBan", CallingConvention = CallingConvention.StdCall)] + private static int Evnet__eventSystem_GroupBan (int subType, int sendTime, long fromGroup, long fromQQ, long beingOperateQQ, long duration) + { + CqGroupBanEventArgs args = new CqGroupBanEventArgs (8, "Ⱥ�����¼�����", sendTime.ToDateTime (), fromGroup, fromQQ, beingOperateQQ, new TimeSpan (duration * 10000000)); + if (subType == 1) + { + if (ReceiveSetGroupBan_8 != null) + { + ReceiveSetGroupBan_8 (null, args); + } + } + else if (subType == 2) + { + if (ReceiveRemoveGroupBan_8 != null) + { + ReceiveRemoveGroupBan_8 (null, args); + } + } + return Convert.ToInt32 (args.Handler); + } + /* * Id: 10 * Type: 201 @@ -494,50 +536,50 @@ private static int Evnet__eventFriend_Add (int subType, int sendTime, long fromQ } /* - * Id: 8 + * Id: 11 * Type: 301 * Name: �������������� * Function: _eventRequest_AddFriend */ - public static event EventHandler ReceiveFriendAdd_8; + public static event EventHandler ReceiveFriendAdd_11; [DllExport (ExportName = "_eventRequest_AddFriend", CallingConvention = CallingConvention.StdCall)] private static int Evnet__eventRequest_AddFriend (int subType, int sendTime, long fromQQ, IntPtr msg, string responseFlag) { - CqAddFriendRequestEventArgs args = new CqAddFriendRequestEventArgs (8, "��������������", sendTime.ToDateTime (), fromQQ, msg.ToString (_defaultEncoding), responseFlag); + CqAddFriendRequestEventArgs args = new CqAddFriendRequestEventArgs (11, "��������������", sendTime.ToDateTime (), fromQQ, msg.ToString (_defaultEncoding), responseFlag); if (subType == 1) { - if (ReceiveFriendAdd_8 != null) + if (ReceiveFriendAdd_11 != null) { - ReceiveFriendAdd_8 (null, args); + ReceiveFriendAdd_11 (null, args); } } return Convert.ToInt32 (args.Handler); } /* - * Id: 9 + * Id: 12 * Type: 302 * Name: Ⱥ���������� * Function: _eventRequest_AddGroup */ - public static event EventHandler ReceiveAddGroupRequest_9; - public static event EventHandler ReceiveAddGroupBeInvitee_9; + public static event EventHandler ReceiveAddGroupRequest_12; + public static event EventHandler ReceiveAddGroupBeInvitee_12; [DllExport (ExportName = "_eventRequest_AddGroup", CallingConvention = CallingConvention.StdCall)] private static int Evnet__eventRequest_AddGroup (int subType, int sendTime, long fromGroup, long fromQQ, IntPtr msg, string responseFlag) { - CqAddGroupRequestEventArgs args = new CqAddGroupRequestEventArgs (9, "Ⱥ����������", sendTime.ToDateTime (), fromGroup, fromQQ, msg.ToString (_defaultEncoding), responseFlag); + CqAddGroupRequestEventArgs args = new CqAddGroupRequestEventArgs (12, "Ⱥ����������", sendTime.ToDateTime (), fromGroup, fromQQ, msg.ToString (_defaultEncoding), responseFlag); if (subType == 1) { - if (ReceiveAddGroupRequest_9 != null) + if (ReceiveAddGroupRequest_12 != null) { - ReceiveAddGroupRequest_9 (null, args); + ReceiveAddGroupRequest_12 (null, args); } } else if (subType == 2) { - if (ReceiveAddGroupBeInvitee_9 != null) + if (ReceiveAddGroupBeInvitee_12 != null) { - ReceiveAddGroupBeInvitee_9 (null, args); + ReceiveAddGroupBeInvitee_12 (null, args); } } return Convert.ToInt32 (args.Handler); diff --git a/Native.Csharp/App/Core/LibExport.tt b/Native.Csharp/App/Core/LibExport.tt index e82fd556..d6c8098c 100644 --- a/Native.Csharp/App/Core/LibExport.tt +++ b/Native.Csharp/App/Core/LibExport.tt @@ -436,6 +436,31 @@ namespace Native.Csharp.App.Core temp.AppendLine ("\t\t\treturn Convert.ToInt32 (args.Handler);"); temp.AppendLine ("\t\t}"); break; + case 104: + temp.AppendLine (string.Format ("\t\tpublic static event EventHandler ReceiveSetGroupBan_{0};", token["id"].Value ())); + temp.AppendLine (string.Format ("\t\tpublic static event EventHandler ReceiveRemoveGroupBan_{0};", token["id"].Value ())); + + temp.AppendLine (string.Format ("\t\t[DllExport (ExportName = \"{0}\", CallingConvention = CallingConvention.StdCall)]", token["function"].Value ())); + temp.AppendLine (string.Format ("\t\tprivate static int Evnet_{0} (int subType, int sendTime, long fromGroup, long fromQQ, long beingOperateQQ, long duration)", token["function"].Value ())); + temp.AppendLine ("\t\t{"); + temp.AppendLine (string.Format ("\t\t\tCqGroupBanEventArgs args = new CqGroupBanEventArgs ({0}, \"{1}\", sendTime.ToDateTime (), fromGroup, fromQQ, beingOperateQQ, new TimeSpan (duration * 10000000));", token["id"].Value (), token["name"].Value ())); + temp.AppendLine ("\t\t\tif (subType == 1)"); + temp.AppendLine ("\t\t\t{"); + temp.AppendLine (string.Format ("\t\t\t\tif (ReceiveSetGroupBan_{0} != null)", token["id"].Value ())); + temp.AppendLine ("\t\t\t\t{"); + temp.AppendLine (string.Format ("\t\t\t\t\tReceiveSetGroupBan_{0} (null, args);", token["id"].Value ())); + temp.AppendLine ("\t\t\t\t}"); + temp.AppendLine ("\t\t\t}"); + temp.AppendLine ("\t\t\telse if (subType == 2)"); + temp.AppendLine ("\t\t\t{"); + temp.AppendLine (string.Format ("\t\t\t\tif (ReceiveRemoveGroupBan_{0} != null)", token["id"].Value ())); + temp.AppendLine ("\t\t\t\t{"); + temp.AppendLine (string.Format ("\t\t\t\t\tReceiveRemoveGroupBan_{0} (null, args);", token["id"].Value ())); + temp.AppendLine ("\t\t\t\t}"); + temp.AppendLine ("\t\t\t}"); + temp.AppendLine ("\t\t\treturn Convert.ToInt32 (args.Handler);"); + temp.AppendLine ("\t\t}"); + break; case 201: temp.AppendLine (string.Format ("\t\tpublic static event EventHandler ReceiveFriendIncrease_{0};", token["id"].Value ())); @@ -618,6 +643,16 @@ namespace Native.Csharp.App.Core temp.AppendLine (string.Format ("\t\t\t\tReceiveMemberBeInvitee_{0} = Common.UnityContainer.Resolve (\"{1}\").ReceiveGroupMemberBeInvitee;", token["id"].Value (), token["name"].Value ())); temp.AppendLine ("\t\t\t}"); break; + case 104: + temp.AppendLine (string.Format ("\t\t\tif (Common.UnityContainer.IsRegistered (\"{0}\") == true)", token["name"].Value ())); + temp.AppendLine ("\t\t\t{"); + temp.AppendLine (string.Format ("\t\t\t\tReceiveSetGroupBan_{0} = Common.UnityContainer.Resolve (\"{1}\").ReceiveSetGroupBan;", token["id"].Value (), token["name"].Value ())); + temp.AppendLine ("\t\t\t}"); + temp.AppendLine (string.Format ("\t\t\tif (Common.UnityContainer.IsRegistered (\"{0}\") == true)", token["name"].Value ())); + temp.AppendLine ("\t\t\t{"); + temp.AppendLine (string.Format ("\t\t\t\tReceiveRemoveGroupBan_{0} = Common.UnityContainer.Resolve (\"{1}\").ReceiveRemoveGroupBan;", token["id"].Value (), token["name"].Value ())); + temp.AppendLine ("\t\t\t}"); + break; case 201: temp.AppendLine (string.Format ("\t\t\tif (Common.UnityContainer.IsRegistered (\"{0}\") == true)", token["name"].Value ())); temp.AppendLine ("\t\t\t{"); diff --git a/Native.Csharp/App/Core/MenuExport.cs b/Native.Csharp/App/Core/MenuExport.cs index 7864a7bd..56999928 100644 --- a/Native.Csharp/App/Core/MenuExport.cs +++ b/Native.Csharp/App/Core/MenuExport.cs @@ -32,12 +32,21 @@ static MenuExport () private static void ResolveAppbackcall () { /* - * Name: �򿪿���̨ - * Function: _eventOpenConsole + * Name: ����A + * Function: _menuA */ - if (Common.UnityContainer.IsRegistered ("�򿪿���̨") == true) + if (Common.UnityContainer.IsRegistered ("����A") == true) { - Menu__eventOpenConsole = Common.UnityContainer.Resolve ("�򿪿���̨").CallMenu; + Menu__menuA = Common.UnityContainer.Resolve ("����A").CallMenu; + } + + /* + * Name: ����B + * Function: _menuB + */ + if (Common.UnityContainer.IsRegistered ("����B") == true) + { + Menu__menuB = Common.UnityContainer.Resolve ("����B").CallMenu; } @@ -46,16 +55,31 @@ private static void ResolveAppbackcall () #region --��������-- /* - * Name: �򿪿���̨ - * Function: _eventOpenConsole + * Name: ����A + * Function: _menuA + */ + public static event EventHandler Menu__menuA; + [DllExport (ExportName = "_menuA", CallingConvention = CallingConvention.StdCall)] + private static int Evnet__menuA () + { + if (Menu__menuA != null) + { + Menu__menuA (null, new CqCallMenuEventArgs ("����A")); + } + return 0; + } + + /* + * Name: ����B + * Function: _menuB */ - public static event EventHandler Menu__eventOpenConsole; - [DllExport (ExportName = "_eventOpenConsole", CallingConvention = CallingConvention.StdCall)] - private static int Evnet__eventOpenConsole () + public static event EventHandler Menu__menuB; + [DllExport (ExportName = "_menuB", CallingConvention = CallingConvention.StdCall)] + private static int Evnet__menuB () { - if (Menu__eventOpenConsole != null) + if (Menu__menuB != null) { - Menu__eventOpenConsole (null, new CqCallMenuEventArgs ("�򿪿���̨")); + Menu__menuB (null, new CqCallMenuEventArgs ("����B")); } return 0; } diff --git a/Native.Csharp/App/Core/StatusExport.cs b/Native.Csharp/App/Core/StatusExport.cs index d9076f44..f4cd99f2 100644 --- a/Native.Csharp/App/Core/StatusExport.cs +++ b/Native.Csharp/App/Core/StatusExport.cs @@ -32,12 +32,12 @@ static StatusExport () private static void ResolveAppbackcall () { /* - * Name: CPUʹ���� - * Function: _statusCPU + * Name: ����ʱ�� + * Function: _statusUptime */ - if (Common.UnityContainer.IsRegistered ("CPUʹ����") == true) + if (Common.UnityContainer.IsRegistered ("����ʱ��") == true) { - Status_CPU = Common.UnityContainer.Resolve ("CPUʹ����").CqStatus; + Status_UPTIME = Common.UnityContainer.Resolve ("����ʱ��").CqStatus; } @@ -47,19 +47,19 @@ private static void ResolveAppbackcall () #region --��������-- /* * Id: 1 - * Name: CPUʹ���� - * Title: CPU - * Function: _statusCPU + * Name: ����ʱ�� + * Title: UPTIME + * Function: _statusUptime * Period: 1000 */ - public static event EventHandler Status_CPU; - [DllExport (ExportName = "_statusCPU", CallingConvention = CallingConvention.StdCall)] - private static string Evnet__statusCPU () + public static event EventHandler Status_UPTIME; + [DllExport (ExportName = "_statusUptime", CallingConvention = CallingConvention.StdCall)] + private static string Evnet__statusUptime () { - CqStatusEventArgs args = new CqStatusEventArgs (1, "CPUʹ����", "CPU", 1000); - if (Status_CPU != null) + CqStatusEventArgs args = new CqStatusEventArgs (1, "����ʱ��", "UPTIME", 1000); + if (Status_UPTIME != null) { - Status_CPU (null, args); + Status_UPTIME (null, args); } return args.FloatWindowData; } diff --git a/Native.Csharp/Native.Csharp.json b/Native.Csharp/Native.Csharp.json index 7033a4cb..192026fd 100644 --- a/Native.Csharp/Native.Csharp.json +++ b/Native.Csharp/Native.Csharp.json @@ -1,152 +1,166 @@ // 酷Q 的Json文件支持以 // 开头的注释。 -// 打包前,应用的 .dll, .json 的文件名须以appid命名,应用AppInfo返回的内容须改为appid -// 如 appid=com.example.demo, 则dll及json文件需分别命名为 com.example.demo.dll、com.example.demo.json +// 开发模式下,应用的 app.dll 及 app.json 文件须放在 dev/[appid]/ 目录下,应用 AppInfo 函数返回的内容须改为 appid +// 如 appid=com.example.demo, 则dll及json文件需分别放在 dev/com.example.demo/app.dll、dev/com.example.demo/app.json +// [重要] appid 规则见 https://cqp.im/v9/appid { - "ret": 1, // 返回码,固定为1 - "apiver": 9, // Api版本,本SDK为9 - "name": "酷Q样例应用 for C#", // 应用名称 - "version": "1.0.0", // 应用版本 - "version_id": 1, // 应用顺序版本(每次发布时至少+1) - "author": "JieGG", // 应用作者 - "description": "酷Q样例应用 for C# (V9应用机制)", - "event": [ // 事件列表,同一事件类型可重复定义(发布前请删除无用事件) - { - "id": 1, // 事件ID - "type": 21, // 事件类型 - "name": "私聊消息处理", // 事件名称 - "function": "_eventPrivateMsg", // 事件对应函数 - "priority": 30000 // 事件优先级(参见 cq.im/deveventpriority) - }, - { - "id": 2, - "type": 2, - "name": "群消息处理", - "function": "_eventGroupMsg", - "priority": 30000 - }, - { - "id": 3, - "type": 4, - "name": "讨论组消息处理", - "function": "_eventDiscussMsg", - "priority": 30000 - }, - { - "id": 4, - "type": 11, - "name": "群文件上传事件处理", - "function": "_eventGroupUpload", - "priority": 30000 - }, - { - "id": 5, - "type": 101, - "name": "群管理变动事件处理", - "function": "_eventSystem_GroupAdmin", - "priority": 30000 - }, - { - "id": 6, - "type": 102, - "name": "群成员减少事件处理", - "function": "_eventSystem_GroupMemberDecrease", - "priority": 30000 - }, - { - "id": 7, - "type": 103, - "name": "群成员增加事件处理", - "function": "_eventSystem_GroupMemberIncrease", - "priority": 30000 - }, - { - "id": 10, - "type": 201, - "name": "好友已添加事件处理", - "function": "_eventFriend_Add", - "priority": 30000 - }, - { - "id": 8, - "type": 301, - "name": "好友添加请求处理", - "function": "_eventRequest_AddFriend", - "priority": 30000 - }, - { - "id": 9, - "type": 302, - "name": "群添加请求处理", - "function": "_eventRequest_AddGroup", - "priority": 30000 - }, - { - "id": 1001, - "type": 1001, - "name": "酷Q启动事件", - "priority": 30000, - "function": "_eventStartup" - }, - { - "id": 1002, - "type": 1002, - "name": "酷Q关闭事件", - "priority": 30000, - "function": "_eventExit" - }, - { - "id": 1003, - "type": 1003, - "name": "应用已被启用", - "priority": 30000, - "function": "_eventEnable" - }, - { - "id": 1004, - "type": 1004, - "name": "应用将被停用", - "priority": 30000, - "function": "_eventDisable" - } - ], - "menu": [ // 设置菜单(发布前请删除无用菜单,如果无需设置菜单请全部删除) - { - "name": "打开控制台", // 菜单名称 - "function": "_eventOpenConsole" // 菜单对应函数 - } - ], - "status": [ // 悬浮窗状态 - { - "id": 1, // 悬浮窗ID - "name": "CPU使用率", // 名称 (显示在酷Q菜单中的名称) - "title": "CPU", // 悬浮窗标题 - "function": "_statusCPU", // 回调函数 - "period": "1000" // 刷新时间 (单位: ms, 目前只能 1000ms 一次) - } - ], - "auth": [ // 应用权限(发布前请删除无用权限) - //20, //[敏感]取Cookies getCookies / getCsrfToken - //30, //接收语音 getRecord - 101, //发送群消息 sendGroupMsg - 103, //发送讨论组消息 sendDiscussMsg - 106, //发送私聊消息 sendPrivateMsg - 110, //发送赞 sendLike - 120, //置群员移除 setGroupKick - 121, //置群员禁言 setGroupBan - 122, //置群管理员 setGroupAdmin - 123, //置全群禁言 setGroupWholeBan - 124, //置匿名群员禁言 setGroupAnonymousBan - 125, //置群匿名设置 setGroupAnonymous - 126, //置群成员名片 setGroupCard - //127, //[敏感]置群退出 setGroupLeave - 128, //置群成员专属头衔 setGroupSpecialTitle - 130, //取群成员信息 getGroupMemberInfoV2 / getGroupMemberInfo - 131, //取陌生人信息 getStrangerInfo - 140, //置讨论组退出 setDiscussLeave - 150, //置好友添加请求 setFriendAddRequest - 151, //置群添加请求 setGroupAddRequest - 160, //取群成员列表 getGroupMemberList - 161, //取群列表 getGroupList - 180 //撤回消息 deleteMsg - ] + "ret": 1, // 返回码,固定为1 + "apiver": 9, // Api版本,本SDK为9 + "name": "酷Q样例应用", // 应用名称 + "version": "1.0.0", // 应用版本 + "version_id": 1, // 应用顺序版本(每次发布时至少+1) + "author": "Example", // 应用作者 + "description": "酷Q样例应用(V9应用机制)", + "event": [ // 事件列表,同一事件类型可重复定义(发布前请删除无用事件) + { + "id": 1, // 事件ID + "type": 21, // 事件类型 + "name": "私聊消息处理", // 事件名称 + "function": "_eventPrivateMsg", // 事件对应函数 + "priority": 30000 // 事件优先级(参见 https://cqp.im/deveventpriority ) + }, + { + "id": 2, + "type": 2, + "name": "群消息处理", + "function": "_eventGroupMsg", + "priority": 30000 + }, + { + "id": 3, + "type": 4, + "name": "讨论组消息处理", + "function": "_eventDiscussMsg", + "priority": 30000 + }, + { + "id": 4, + "type": 11, + "name": "群文件上传事件处理", + "function": "_eventGroupUpload", + "priority": 30000 + }, + { + "id": 5, + "type": 101, + "name": "群管理变动事件处理", + "function": "_eventSystem_GroupAdmin", + "priority": 30000 + }, + { + "id": 6, + "type": 102, + "name": "群成员减少事件处理", + "function": "_eventSystem_GroupMemberDecrease", + "priority": 30000 + }, + { + "id": 7, + "type": 103, + "name": "群成员增加事件处理", + "function": "_eventSystem_GroupMemberIncrease", + "priority": 30000 + }, + { + "id": 8, + "type": 104, + "name": "群禁言事件处理", + "function": "_eventSystem_GroupBan", + "priority": 30000 + }, + { + "id": 10, + "type": 201, + "name": "好友已添加事件处理", + "function": "_eventFriend_Add", + "priority": 30000 + }, + { + "id": 11, + "type": 301, + "name": "好友添加请求处理", + "function": "_eventRequest_AddFriend", + "priority": 30000 + }, + { + "id": 12, + "type": 302, + "name": "群添加请求处理", + "function": "_eventRequest_AddGroup", + "priority": 30000 + }, + { + "id": 1001, + "type": 1001, + "name": "酷Q启动事件", + "priority": 30000, + "function": "_eventStartup" + }, + { + "id": 1002, + "type": 1002, + "name": "酷Q关闭事件", + "priority": 30000, + "function": "_eventExit" + }, + { + "id": 1003, + "type": 1003, + "name": "应用已被启用", + "priority": 30000, + "function": "_eventEnable" + }, + { + "id": 1004, + "type": 1004, + "name": "应用将被停用", + "priority": 30000, + "function": "_eventDisable" + } + ], + "menu": [ // 设置菜单(发布前请删除无用菜单,如果无需设置菜单请全部删除) + { + "name": "设置A", //菜单名称 + "function": "_menuA" //菜单对应函数 + }, + { + "name": "设置B", + "function": "_menuB" + } + ], + "status": [ // 悬浮窗状态(见 com.example.status 样例) + { + "id": 1, // 悬浮窗ID + "name": "运行时间", // 名称 + "title": "UPTIME", // 英文名称 + "function": "_statusUptime", // 数据更新对应函数 + "period": "1000" // 更新间隔(单位ms(毫秒),目前仅支持1000ms(1秒)) + } + ], + "auth": [ // 应用权限(发布前请删除无用权限) + //20, //[敏感]取Cookies getCookies / getCsrfToken + //30, //接收语音 getRecord + 101, //发送群消息 sendGroupMsg + 103, //发送讨论组消息 sendDiscussMsg + 106, //发送私聊消息 sendPrivateMsg + //110, //[敏感]发送赞 sendLike + 120, //置群员移除 setGroupKick + 121, //置群员禁言 setGroupBan + 122, //置群管理员 setGroupAdmin + 123, //置全群禁言 setGroupWholeBan + 124, //置匿名群员禁言 setGroupAnonymousBan + 125, //置群匿名设置 setGroupAnonymous + 126, //置群成员名片 setGroupCard + //127, //[敏感]置群退出 setGroupLeave + 128, //置群成员专属头衔 setGroupSpecialTitle + 130, //取群成员信息 getGroupMemberInfo + 131, //取陌生人信息 getStrangerInfo + 132, //取群信息 getGroupInfo + 140, //置讨论组退出 setDiscussLeave + 150, //置好友添加请求 setFriendAddRequest + 151, //置群添加请求 setGroupAddRequest + 160, //取群成员列表 getGroupMemberList + 161, //取群列表 getGroupList + 162, //取好友列表 getFriendList + 180 //撤回消息 deleteMsg + ] } diff --git a/Native.Csharp/Properties/AssemblyInfo.cs b/Native.Csharp/Properties/AssemblyInfo.cs index 49fe3ba4..d19689bb 100644 --- a/Native.Csharp/Properties/AssemblyInfo.cs +++ b/Native.Csharp/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion ("3.2.1.0906")] -[assembly: AssemblyFileVersion ("3.2.1.0906")] +[assembly: AssemblyVersion ("3.4.0.1013")] +[assembly: AssemblyFileVersion ("3.4.0.1013")] diff --git a/README.md b/README.md index 218516bc..81a8f4d7 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ ## Native.SDK 更新日志 -https://github.com/Jie2GG/Native.Csharp.Frame/blob/Final/UPDATE.md +### [查看更新日志](UPDATE.md) ## 关于打赏 diff --git a/UPDATE.md b/UPDATE.md index 24348b7d..e7a78356 100644 --- a/UPDATE.md +++ b/UPDATE.md @@ -1,4 +1,11 @@ # Native.SDK ������־ +> 2019��10��13�� �汾: V3.4.0.1013 + + 1. ���� Ⱥ�����¼� (Type: 104), ������ LibExport.tt Ϊ�°汾 + 2. ���� ��ȡȺ��Ϣ�ӿ�, ֧�ֻ�ȡ��ǰ������������� + 3. ���� ��ȡ�����б��ӿ� + 4. �޸� һЩ���ȶ����� + > 2019��09��15�� �汾: V3.3.0.0915 1. ת�� App �µ� Interface �� EventArgs �� Sdk ��Ŀ��