Skip to content
This repository has been archived by the owner on Aug 2, 2020. It is now read-only.

Commit

Permalink
更新Json文件及其模板文件
Browse files Browse the repository at this point in the history
  • Loading branch information
Jie2GG committed Oct 14, 2019
1 parent c5c81cd commit 5fd0a69
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 81 deletions.
38 changes: 19 additions & 19 deletions Native.Csharp/App/Core/LibExport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private static string AppInfo ()
{
// 请勿随意修改
//
Common.AppName = "酷Q样例应用 for C#";
Common.AppName = "酷Q样例应用";
Common.AppVersion = Version.Parse ("1.0.0");

//
Expand Down Expand Up @@ -223,25 +223,25 @@ private static void ResolveAppbackcall ()
}

/*
* Id: 8
* Id: 11
* Name: 好友添加请求处理
*/
if (Common.UnityContainer.IsRegistered<IReceiveFriendAddRequest> ("好友添加请求处理") == true)
{
ReceiveFriendAdd_8 = Common.UnityContainer.Resolve<IReceiveFriendAddRequest> ("好友添加请求处理").ReceiveFriendAddRequest;
ReceiveFriendAdd_11 = Common.UnityContainer.Resolve<IReceiveFriendAddRequest> ("好友添加请求处理").ReceiveFriendAddRequest;
}

/*
* Id: 9
* Id: 12
* Name: 群添加请求处理
*/
if (Common.UnityContainer.IsRegistered<IReceiveAddGroupRequest> ("群添加请求处理") == true)
{
ReceiveAddGroupRequest_9 = Common.UnityContainer.Resolve<IReceiveAddGroupRequest> ("群添加请求处理").ReceiveAddGroupRequest;
ReceiveAddGroupRequest_12 = Common.UnityContainer.Resolve<IReceiveAddGroupRequest> ("群添加请求处理").ReceiveAddGroupRequest;
}
if (Common.UnityContainer.IsRegistered<IReceiveAddGroupBeInvitee> ("群添加请求处理") == true)
{
ReceiveAddGroupBeInvitee_9 = Common.UnityContainer.Resolve<IReceiveAddGroupBeInvitee> ("群添加请求处理").ReceiveAddGroupBeInvitee;
ReceiveAddGroupBeInvitee_12 = Common.UnityContainer.Resolve<IReceiveAddGroupBeInvitee> ("群添加请求处理").ReceiveAddGroupBeInvitee;
}

/*
Expand Down Expand Up @@ -536,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<CqAddFriendRequestEventArgs> ReceiveFriendAdd_8;
public static event EventHandler<CqAddFriendRequestEventArgs> 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<CqAddGroupRequestEventArgs> ReceiveAddGroupRequest_9;
public static event EventHandler<CqAddGroupRequestEventArgs> ReceiveAddGroupBeInvitee_9;
public static event EventHandler<CqAddGroupRequestEventArgs> ReceiveAddGroupRequest_12;
public static event EventHandler<CqAddGroupRequestEventArgs> 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);
Expand Down
46 changes: 35 additions & 11 deletions Native.Csharp/App/Core/MenuExport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,21 @@ static MenuExport ()
private static void ResolveAppbackcall ()
{
/*
* Name: 打开控制台
* Function: _eventOpenConsole
* Name: 设置A
* Function: _menuA
*/
if (Common.UnityContainer.IsRegistered<ICallMenu> ("打开控制台") == true)
if (Common.UnityContainer.IsRegistered<ICallMenu> ("设置A") == true)
{
Menu__eventOpenConsole = Common.UnityContainer.Resolve<ICallMenu> ("打开控制台").CallMenu;
Menu__menuA = Common.UnityContainer.Resolve<ICallMenu> ("设置A").CallMenu;
}

/*
* Name: 设置B
* Function: _menuB
*/
if (Common.UnityContainer.IsRegistered<ICallMenu> ("设置B") == true)
{
Menu__menuB = Common.UnityContainer.Resolve<ICallMenu> ("设置B").CallMenu;
}


Expand All @@ -46,16 +55,31 @@ private static void ResolveAppbackcall ()

#region --导出方法--
/*
* Name: 打开控制台
* Function: _eventOpenConsole
* Name: 设置A
* Function: _menuA
*/
public static event EventHandler<CqCallMenuEventArgs> 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<CqCallMenuEventArgs> Menu__eventOpenConsole;
[DllExport (ExportName = "_eventOpenConsole", CallingConvention = CallingConvention.StdCall)]
private static int Evnet__eventOpenConsole ()
public static event EventHandler<CqCallMenuEventArgs> 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;
}
Expand Down
26 changes: 13 additions & 13 deletions Native.Csharp/App/Core/StatusExport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ static StatusExport ()
private static void ResolveAppbackcall ()
{
/*
* Name: CPU使用率
* Function: _statusCPU
* Name: 运行时间
* Function: _statusUptime
*/
if (Common.UnityContainer.IsRegistered<ICqStatus> ("CPU使用率") == true)
if (Common.UnityContainer.IsRegistered<ICqStatus> ("运行时间") == true)
{
Status_CPU = Common.UnityContainer.Resolve<ICqStatus> ("CPU使用率").CqStatus;
Status_UPTIME = Common.UnityContainer.Resolve<ICqStatus> ("运行时间").CqStatus;
}


Expand All @@ -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<CqStatusEventArgs> Status_CPU;
[DllExport (ExportName = "_statusCPU", CallingConvention = CallingConvention.StdCall)]
private static string Evnet__statusCPU ()
public static event EventHandler<CqStatusEventArgs> 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;
}
Expand Down
83 changes: 45 additions & 38 deletions Native.Csharp/Native.Csharp.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
// 酷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#", // 应用名称
"name": "酷Q样例应用", // 应用名称
"version": "1.0.0", // 应用版本
"version_id": 1, // 应用顺序版本(每次发布时至少+1)
"author": "JieGG", // 应用作者
"description": "酷Q样例应用 for C# (V9应用机制)",
"author": "Example", // 应用作者
"description": "酷Q样例应用(V9应用机制)",
"event": [ // 事件列表,同一事件类型可重复定义(发布前请删除无用事件)
{
"id": 1, // 事件ID
"type": 21, // 事件类型
"name": "私聊消息处理", // 事件名称
"function": "_eventPrivateMsg", // 事件对应函数
"priority": 30000 // 事件优先级(参见 cq.im/deveventpriority)
"priority": 30000 // 事件优先级(参见 https://cqp.im/deveventpriority )
},
{
"id": 2,
Expand Down Expand Up @@ -74,14 +75,14 @@
"priority": 30000
},
{
"id": 8,
"id": 11,
"type": 301,
"name": "好友添加请求处理",
"function": "_eventRequest_AddFriend",
"priority": 30000
},
{
"id": 9,
"id": 12,
"type": 302,
"name": "群添加请求处理",
"function": "_eventRequest_AddGroup",
Expand Down Expand Up @@ -118,42 +119,48 @@
],
"menu": [ // 设置菜单(发布前请删除无用菜单,如果无需设置菜单请全部删除)
{
"name": "打开控制台", // 菜单名称
"function": "_eventOpenConsole" // 菜单对应函数
"name": "设置A", //菜单名称
"function": "_menuA" //菜单对应函数
},
{
"name": "设置B",
"function": "_menuB"
}
],
"status": [ // 悬浮窗状态
"status": [ // 悬浮窗状态(见 com.example.status 样例)
{
"id": 1, // 悬浮窗ID
"name": "CPU使用率", // 名称 (显示在酷Q菜单中的名称)
"title": "CPU", // 悬浮窗标题
"function": "_statusCPU", // 回调函数
"period": "1000" // 刷新时间 (单位: ms, 目前只能 1000ms 一次)
"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, //取群成员信息 getGroupMemberInfoV2 / getGroupMemberInfo
131, //取陌生人信息 getStrangerInfo
140, //置讨论组退出 setDiscussLeave
150, //置好友添加请求 setFriendAddRequest
151, //置群添加请求 setGroupAddRequest
160, //取群成员列表 getGroupMemberList
161, //取群列表 getGroupList
180 //撤回消息 deleteMsg
//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
]
}

0 comments on commit 5fd0a69

Please sign in to comment.