コード例 #1
0
        //emial发送计时
        private void EmailTimer_Tick(object sender, EventArgs e)
        {
            if (AppConfigRWTool.ReadSetting("EmailRportChoose").Equals("true") &&
                Convert.ToInt32(AppConfigRWTool.ReadSetting("EmailReportTime")) == DateTime.Now.Hour)
            {
                string message = String.Format("<h2>当前正在运行的微博账号共有{0}个</h2><br/>", this.panel1.Controls.Count);

                for (int i = 1; i <= this.panel1.Controls.Count; i++)
                {
                    message += (i + ".<br/>");
                    message += ((UserLable)this.panel1.Controls[i - 1]).GetHtmlEmailMessage();
                    message += "<br/>";
                }

                EMailTool.SendMail("微博管家日报告", message);
            }
        }
コード例 #2
0
        //更新cookie事件
        private void UpdateCookiesEvent(object sender)
        {
            string username = ((UserLable)sender).UserName;
            string password = ((UserLable)sender).Password;

            WeiboLogin login = new WeiboLogin(username, password, false);

            string result = login.UpdateCookies(out bool IsSuccess);

            if (IsSuccess)
            {
                ((UserLable)sender).Cookies = login.MyCookies;
            }
            else
            {
                EMailTool.SendMail("更新cookies失败", String.Format("账号【{0}({1})】更新cookies失败,请检查服务器运行状态!", username, ((UserLable)sender).DisplayName));
            }
            //记录日志
            UserLog.WriteNormalLog(((UserLable)sender).DisplayName, result);
        }
コード例 #3
0
        //获取用户名
        private string GetDisplayName()
        {
            try
            {
                var userHomePageTxt = HttpHelper.Get("https://weibo.com", this.myCookies, true);
                //获取用户uid
                int indexStart = userHomePageTxt.IndexOf("$CONFIG['uid']='") + "$CONFIG['uid']='".Length;
                userHomePageTxt = userHomePageTxt.Substring(indexStart);
                this.UserId     = userHomePageTxt.Substring(0, userHomePageTxt.IndexOf("';"));

                indexStart = userHomePageTxt.IndexOf("$CONFIG['nick']='") + "$CONFIG['nick']='".Length;

                userHomePageTxt = userHomePageTxt.Substring(indexStart);

                return(userHomePageTxt.Substring(0, userHomePageTxt.IndexOf("';")));
            }
            catch (Exception ex)
            {
                UserLog.WriteNormalLog("", this.Username + ":获取昵称失败,可能是账号异常!");
                EMailTool.SendMail("运行错误", this.Username + ":获取昵称失败,可能是账号操作频繁引起的异常,请检查是否需要解除锁定");
            }
            return("");
        }
コード例 #4
0
        //发布一条图文微博
        private void PublishAnImageWeibo(UserLable userLable)
        {
            if (SqliteTool.GetLaveWeiboCount(SqliteTool.WeiboType.ImageWeibo, userLable.DisplayName) != 0)
            {
                ImageWeibo weibo = SqliteTool.GetARandomImageWeiboIsNotPublished(SqliteTool.WeiboType.ImageWeibo, userLable.DisplayName);

                if (weibo.Pictures == null || weibo.Pictures.Length == 0)
                {
                    UserLog.WriteNormalLog(userLable.DisplayName, "获取微博失败,类型不明确");
                    return;
                }

                //设置tags
                string weiboText = userLable.IsFrontTagsSet ?
                                   userLable.Tags + weibo.WeiboMessage :
                                   weibo.WeiboMessage + userLable.Tags;
                WeiboOperateTool.SendAnImageWeibo(userLable.Cookies, weiboText, weibo.Pictures);
            }
            else
            {
                this.richTextBox1.Text = this.richTextBox1.Text + userLable.DisplayName + " 微博库已空\n";
                EMailTool.SendMail("微博库已空", String.Format("用户昵称:{0}<br/>登录账号:{1}", userLable.DisplayName, userLable.UserName));
            }
        }
コード例 #5
0
 //发送邮件事件
 private void SendEmailEvent(object sender, string message)
 {
     EMailTool.SendMail(((UserLable)sender).DisplayName + " 运行错误", message);
 }