示例#1
0
        // 显示分页结果
        protected void ShowPage(User user, CqGroupMessageEventArgs e, string groupPath, string iniName, int page = 1)
        {
            List <string> items = iniTool.IniReadSectionKey(groupPath, iniName, e.FromQQ.ToString());

            int nowPage = (int)Math.Ceiling(Convert.ToDouble(items.Count) / Convert.ToDouble(pageSize));

            page -= 1;

            if (nowPage < page + 1)
            {
                Common.CqApi.SendGroupMessage(e.FromGroup, "[" + user.Name + "的" + iniName.Substring(0, 2) + "] :" + "第" + (page + 1).ToString() + "页 没有任何物品");
                return;
            }

            int startPage = page * pageSize;

            string res = "[" + user.Name + "的" + iniName.Substring(0, 2) + "] 共" + nowPage + "页 当前页数:" + (page + 1).ToString() + Environment.NewLine;

            for (int i = startPage; i < items.Count; i++)
            {
                if (i - startPage > 9)
                {
                    break;
                }
                string itemNum = iniTool.IniReadValue(groupPath, iniName, e.FromQQ.ToString(), items[i]);

                res += items[i] + ":" + itemNum + Environment.NewLine;
            }

            Common.CqApi.SendGroupMessage(e.FromGroup, SubRN(res));
            return;
        }