示例#1
0
        static public void ReadSelect(List <string> Read)
        {
            ///ret[0] = ["font"]);
            ///ret[1] = ["message"]);
            ///ret[2] = ["message_id"]);
            ///ret[3] = ["message_type"]);
            ///ret[4] = ["post_type"]);
            ///ret[5] = ["raw_message"]);
            ///ret[6] = ["self_id"]);
            ///ret[7] = ["sub_type"]);
            ///ret[8] = ["time"]);
            ///ret[9] = ["user_id"]);
            ///
            CQ     cq     = new CQ();
            Main   main   = new Main();
            Helper helper = new Helper();

            if (Read != null)
            {
                if (Read[Read.IndexOf("message_type") + 1] == "private")//私聊
                {
                    switch (Read[Read.IndexOf("message") + 1])
                    {
                    case "help":
                        cq.HttpSendMsg(Read[Read.IndexOf("message_type") + 1], int.Parse(Read[Read.IndexOf("user_id") + 1]), helper.CQSetHelp(), get: false);
                        break;
                    }

                    if (Read[Read.IndexOf("message") + 1].Contains("type=>"))
                    {
                        Info[0] = Read[Read.IndexOf("message") + 1].Replace("type=>", "");
                        cq.HttpSendMsg(Read[Read.IndexOf("message_type") + 1], int.Parse(Read[Read.IndexOf("user_id") + 1]), "Now Type=>" + Info[0], get: false);
                        ;
                    }
                }
                if (Read[Read.IndexOf("message_type") + 1] == "group")//群聊
                {
                    cq.HttpSendMsg(Read[Read.IndexOf("message_type") + 1], int.Parse(Read[Read.IndexOf("group_id") + 1]), helper.CQSetHelp(), get: false);
                }
            }
        }
示例#2
0
        public void Start(List <string> ApiIdList)
        {
            Console.WriteLine("Start()", Color.Yellow);
            Other other     = new Other();
            CQ    cq        = new CQ();
            bool  totalflg1 = true;

            if (Total == 0 && Total == -1)
            {
                totalflg1 = false;
            }



            string name    = string.Empty;
            string code    = string.Empty;
            string url     = string.Empty;
            var    count   = new List <string>();
            var    Delname = new List <string>();

            count.Add("Img Start Date:" + DateTime.Now.ToString("yyyy-MM-dd"));
            if (!totalflg1)
            {
                for (int i = 0; i < ApiIdList.Count; i++)
                {
                    url = other.PixivCat(ApiIdList[i]);
                    Console.WriteLine(i + "\r\n" + url, Color.Yellow);
                    name = other.DownloadImg(url, path: Path);
                    Delname.Add(name);
                    code = other.CqCodeMsg("image", "file", name);
                    count.Add(code);
                    count.Add("\r\nid=" + ApiIdList[i] + "\r\n");
                }

                Console.WriteLine("Img Start", Color.Yellow);
                count.Add("END Count:" + ApiIdList.Count);
                code = string.Concat(count.ToArray());

                cq.HttpSendMsg(Type, Id, code, get: false);
            }
            else
            {
                for (int i = 0; i < Total; i++)
                {
                    url = other.PixivCat(ApiIdList[i]);
                    Console.WriteLine(i + "\r\n" + url);
                    name = other.DownloadImg(url, path: Path);
                    Delname.Add(name);
                    code = other.CqCodeMsg("image", "file", name);
                    count.Add("\r\n" + code);
                    count.Add("\r\nid=" + ApiIdList[i]);
                }

                Console.WriteLine("Img Start", Color.Yellow);
                count.Add("\nEND Count:" + Total);
                code = string.Concat(count.ToArray());

                cq.HttpSendMsg(Type, Id, code, get: false);
            }


            Console.WriteLine("END", Color.Yellow);
            Console.WriteLine(DateTime.Now.ToString(), Color.Yellow);

            other.Wait(10);
            foreach (var item in Delname)
            {
                other.DelFile(item, Path);
            }

            return;
        }