Exemple #1
0
        public static void send(CmsForm cmsForm, string content, string content_img, ArrayList imgList, string content_org, int url_type, int goods_type)
        {
            string   out_log = "";
            GStruct0 gStruct0;

            try
            {
                if (cmsForm.radioButton_fasong_weixin_fashi_houtai.Checked)
                {
                    WeixinUtil.login(cmsForm);
                    WeixinUtil.send_houtai(cmsForm, content, content_img, imgList);
                    return;
                }

                if (cmsForm.appBean.weixin_list == null || cmsForm.appBean.weixin_list.Count == 0)
                {
                    LogUtil.log_call(cmsForm, "没有微信群!");
                    return;
                }
                //this.string_50 = this.method_151(cmsForm);
                //᝚.ᜃ(this.string_50);
                //ContentItem contentItem = WeixinUtil.get_weixin_content(cmsForm,content,out out_log);
                //LogUtil.log_call(cmsForm, gClass27.content);
                int i = 0;
                while (i < cmsForm.appBean.weixin_list.Count)
                {
                    if (!cmsForm.appBean.send_status && !cmsForm.appBean.qunfa_genfa_qunfa_status)
                    {
                        out_log = "群发被强制停止";
                        return;
                    }
                    else
                    {
                        string item = (string)cmsForm.appBean.weixin_list[i];

                        string weiba_all  = QqUtil.weiba(cmsForm, out out_log);
                        string weiba      = "";
                        string weixin_pid = PidUtil.get_weixin_pid_qun(cmsForm, item, cmsForm.appBean.member_id, out weiba);
                        if (!string.IsNullOrEmpty(weixin_pid))
                        {
                            if (goods_type != 2)
                            {
                                ContentItem contentItem_qun = UrlUtil.parseContent(cmsForm, content_org, weixin_pid, cmsForm.checkBox_qunfa_pid.Checked, false, url_type);
                                UrlUtil.parseContent_weixin(cmsForm, contentItem_qun, weixin_pid, cmsForm.checkBox_qunfa_pid.Checked);
                                UrlUtil.template_qq(cmsForm, contentItem_qun, weixin_pid, cmsForm.checkBox_qunfa_pid.Checked, cmsForm.appBean.weixin_template);

                                content     = contentItem_qun.content_weixin;
                                content_img = contentItem_qun.content_weixin_img;
                                imgList     = contentItem_qun.imgList;
                                weiba_all   = weiba;
                            }
                            else
                            {
                                ContentItem contentItem_qun = UrlHptUtil.parseContent(cmsForm, content_org, weixin_pid, cmsForm.checkBox_qunfa_pid.Checked, false, url_type);
                                UrlUtil.parseContent_weixin(cmsForm, contentItem_qun, weixin_pid, false);

                                content = contentItem_qun.content_send;
                                content = WeixinUtil.remove_img(content);

                                LogUtil.log_call(cmsForm, content);
                                content_img = contentItem_qun.content_weixin_img;
                                imgList     = contentItem_qun.imgList;
                                weiba_all   = weiba;
                            }
                        }
                        else
                        {
                            if (goods_type != 2)
                            {
                            }
                            else
                            {
                                content = WeixinUtil.remove_img(content);
                            }
                        }

                        IntPtr intPtr = CmsForm.FindWindow(null, item);
                        if (intPtr == IntPtr.Zero)
                        {
                            out_log = string.Concat("微信群【", item, "】窗口没有打开,软件自动拖动微信群成为独立的窗口!");
                            CmsForm.EnumWindows(new GDelegate66(cmsForm.method_121), IntPtr.Zero);
                            if (!WeixinUtil.method_120(cmsForm.appBean.weixin_win_id))
                            {
                                LogUtil.log_call(cmsForm, "微信没有打开!");
                                goto Label2;
                            }
                            LogUtil.log_call(cmsForm, "微信已经打开!正在拖动。。。。");
                            CmsForm.ShowWindowAsync(cmsForm.appBean.weixin_win_id, GClass13.int_13);
                            Thread.Sleep(150);
                            CmsForm.SetForegroundWindow(cmsForm.appBean.weixin_win_id);
                            Thread.Sleep(150);
                            CmsForm.GetWindowRect(cmsForm.appBean.weixin_win_id, out gStruct0);
                            MouseUtil.smethod_9(cmsForm.appBean.weixin_win_id, gStruct0.int_0 + 100, gStruct0.int_1 + 25);
                            Thread.Sleep(200);
                            SendKeys.SendWait("{BACKSPACE}");
                            Thread.Sleep(200);
                            SendKeys.SendWait(item);
                            Thread.Sleep(200);
                            SendKeys.SendWait("{ENTER}");
                            Thread.Sleep(250);
                            MouseUtil.smethod_13(gStruct0.int_0 + 100, gStruct0.int_1 + 75, gStruct0.int_0 + 400);
                            Thread.Sleep(150);
                        }
                        intPtr = CmsForm.FindWindow(null, item);
                        if (intPtr != IntPtr.Zero)
                        {
                            CmsForm.ShowWindowAsync(intPtr, GClass13.int_13);
                            Thread.Sleep(150);
                            CmsForm.SetForegroundWindow(intPtr);
                            Thread.Sleep(150);
                            CmsForm.GetWindowRect(intPtr, out gStruct0);
                            MouseUtil.smethod_9(intPtr, gStruct0.int_2 - 60, gStruct0.int_3 - 70);
                            if (content_img != null && !"".Equals(content_img))
                            {
                                //LogUtil.log_call(cmsForm, content_img);

                                //CommonUtil.clipboard(content_img, out out_log);
                                QqUtil.copy_content(cmsForm, content_img, out out_log);
                                Thread.Sleep(1000);
                                MouseUtil.paste();     //粘贴消息
                                Thread.Sleep(1000);
                                MouseUtil.enter();     // 回车
                                Thread.Sleep(1000);
                                LogUtil.log_call(cmsForm, "发送图片结束");
                                try
                                {
                                    Thread.Sleep(int.Parse(cmsForm.textBox_qunfa_weixin_fatu_times.Text.Trim()));
                                }
                                catch (Exception)
                                {
                                    Thread.Sleep(1000);
                                }
                            }
                            if ((content != null && !content.Equals("")))
                            {
                                //CommonUtil.clipboard(string.Concat(content, QqUtil.weiba(cmsForm, out out_log)), out out_log);
                                QqUtil.copy_content(cmsForm, string.Concat(content, weiba_all), out out_log);
                                Thread.Sleep(1000);
                                MouseUtil.paste();     //粘贴消息
                                Thread.Sleep(1000);
                                MouseUtil.enter();     // 回车
                                Thread.Sleep(1000);
                            }
                            Thread.Sleep(1000);
                        }
                        else
                        {
                            LogUtil.log_call(cmsForm, string.Concat("微信群【", item, "】窗口没有打开,软件拖动失败,跳过跟发!"));
                        }
Label2:
                        i = i + 1;
                    }
                }
                //this.bool_34 = false;
                //this.string_76 = "";
                //this.int_26 = 0;
                if (!cmsForm.checkBox_qunfa_qq_zuixiaohua.Checked)
                {
                    QqUtil.method_167(cmsForm, out out_log);
                }
                else
                {
                    QqUtil.method_168(cmsForm, out out_log);
                }
                //QqUtil.method_156(cmsForm);
                //QqUtil.method_134(cmsForm);
                LogUtil.log_call(cmsForm, "微信群发完成!");
            }
            catch (Exception exception)
            {
                LogUtil.log_call(cmsForm, string.Concat("[autoSendWeixin]出错:", exception.ToString()));
            }
            return;
        }
Exemple #2
0
        public static void send(CmsForm cmsForm, string content, string content_org, int user_type, int goods_type)
        {
            try
            {
                int i = 0;
                //LogUtil.log_call(cmsForm, "发送的群数目:" + cmsForm.appBean.qqqun_list.Count);
                if (cmsForm.appBean.qqqun_list.Count > 0)
                {
                    string out_log = "";
                    //CommonUtil.clipboard(string.Concat(content, QqUtil.weiba(cmsForm, out out_log)), out out_log);
                    //LogUtil.log_call(cmsForm, out_log);
                    QqUtil.copy_content(cmsForm, string.Concat(content, QqUtil.weiba(cmsForm, out out_log)).ToString(), out out_log);
                    //CommonUtil.clipboard_brows(cmsForm,string.Concat(content, QqUtil.weiba(cmsForm, out out_log)), out out_log);
                    //LogUtil.log_call(cmsForm, out_log);
                }
                while (i < cmsForm.appBean.qqqun_list.Count)
                {
                    if (!cmsForm.appBean.send_status && !cmsForm.appBean.qunfa_genfa_qunfa_status)
                    {
                        LogUtil.log_call(cmsForm, "群发被强制停止");
                        return;
                    }
                    else
                    {
                        string weiba  = "";
                        string item   = (string)cmsForm.appBean.qqqun_list[i];
                        string qq_pid = PidUtil.get_qq_pid_qun(cmsForm, item, cmsForm.appBean.member_id, out weiba);
                        if (!string.IsNullOrEmpty(qq_pid))
                        {
                            string content_send = "";
                            if (goods_type != 2)
                            {
                                ContentItem contentItem_qun = UrlUtil.parseContent(cmsForm, content_org, qq_pid, cmsForm.checkBox_qunfa_pid.Checked, false, user_type);
                                content_send = contentItem_qun.content_send;
                                content_send = UrlUtil.template_qq(cmsForm, contentItem_qun, qq_pid, cmsForm.checkBox_qunfa_pid.Checked, cmsForm.appBean.qq_template);
                            }
                            else
                            {
                                ContentItem contentItem_qun = UrlHptUtil.parseContent(cmsForm, content_org, qq_pid, cmsForm.checkBox_qunfa_pid.Checked, false, user_type);
                                content_send = contentItem_qun.content_send;
                            }
                            string out_log = "";
                            QqUtil.copy_content(cmsForm, string.Concat(content_send, weiba).ToString(), out out_log);
                        }
                        else
                        {
                            string out_log = "";
                            QqUtil.copy_content(cmsForm, string.Concat(content, QqUtil.weiba(cmsForm, out out_log)).ToString(), out out_log);
                        }
                        IntPtr intPtr = CmsForm.FindWindow(null, item);
                        if (intPtr == IntPtr.Zero)
                        {
                            string str = string.Concat(cmsForm.appBean.qqquan_path, "\\", item, ".lnk");
                            if (!File.Exists(str))
                            {
                                goto Label1;
                            }
                            try
                            {
                                Process.Start(str);
                            }
                            catch
                            {
                                LogUtil.log_call(cmsForm, string.Concat("自动打开QQ群快捷方式有问题,请手动打开!【", str, "】"));
                            }
                            Thread.Sleep(1000);
                            intPtr = CmsForm.FindWindow(null, item);
                            if (intPtr == IntPtr.Zero)
                            {
                            }
                        }
                        StringBuilder stringBuilder = new StringBuilder(256);
                        CmsForm.GetClassName(intPtr, stringBuilder, 500);
                        if (!"ChatWnd".Equals(stringBuilder.ToString()))
                        {
                            CmsForm.SetForegroundWindow(intPtr);
                            try
                            {
                                Thread.Sleep(int.Parse(cmsForm.textBox_qunfa_qq_peizhi_zhantietimes.Text.Trim()));
                            }
                            catch (Exception)
                            {
                                Thread.Sleep(1000);
                            }
                            MouseUtil.paste();  //粘贴消息
                            try
                            {
                                Thread.Sleep(int.Parse(cmsForm.textBox_qunfa_qq_peizhi_fasong_times.Text.Trim()));
                            }
                            catch (Exception)
                            {
                                Thread.Sleep(1000);
                            }
                            if (cmsForm.radioButton_qunfa_qq_enter.Checked)
                            {
                                MouseUtil.enter(); // 回车
                            }
                            else
                            {
                                MouseUtil.ctrl_enter();
                                //MouseUtil.smethod_2();
                                //MouseUtil.smethod_3();
                                //MouseUtil.smethod_6(); //Ctrl+回车
                            }
                            try
                            {
                                Thread.Sleep(int.Parse(cmsForm.textBox_qunfa_qq_peizhi_qiehuan_times.Text.Trim()));
                            }
                            catch (Exception)
                            {
                                Thread.Sleep(1000);
                            }
                            if (cmsForm.checkBox_qunfa_qq_guanbi.Checked)
                            {
                                MouseUtil.close(); //关闭窗口
                                Thread.Sleep(100);
                            }
                        }
                        else
                        {
                            //this.method_149(intPtr);
                        }
Label1:
                        i = i + 1;
                    }
                }
            }
            catch (Exception)
            {
                //out_log = "";
            }
        }