当前位置: 首页>>代码示例>>C#>>正文


C# clsDBQueryManager.InsertMessageData方法代码示例

本文整理汇总了C#中BaseLib.clsDBQueryManager.InsertMessageData方法的典型用法代码示例。如果您正苦于以下问题:C# clsDBQueryManager.InsertMessageData方法的具体用法?C# clsDBQueryManager.InsertMessageData怎么用?C# clsDBQueryManager.InsertMessageData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseLib.clsDBQueryManager的用法示例。


在下文中一共展示了clsDBQueryManager.InsertMessageData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DirectMessage

        public string DirectMessage(string Screen_name)
        {
            string ReturnString = string.Empty;
            try
            {
                string MessageText = string.Empty;
                string PostedMessage = string.Empty;

                lock (locker_DirectMessage)
                {
                    if (que_DirectMessage.Count > 0)
                    {
                        MessageText = que_DirectMessage.Dequeue();
                    }
                    else
                    {
                        Log("[ " + DateTime.Now + " ] => [All Loaded Reply Messages Used ]");
                    }
                }

                string PageSource = globusHttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/#!/followers"), "", "");
                string PostAuthenticityToken = string.Empty;
                try
                {
                    int startIndex = PageSource.IndexOf("\"postAuthenticityToken\"");
                    if (startIndex > 0)
                    {
                        string Start = PageSource.Substring(startIndex);
                        int endIndex = Start.IndexOf("\"})");
                        string End = Start.Substring(0, endIndex).Replace("\"postAuthenticityToken\"", "").Replace(":", "").Replace("\"", "");
                        PostAuthenticityToken = End;
                    }
                    startIndex = PageSource.IndexOf("formAuthenticityToken");
                    if (startIndex > 0)
                    {
                        string start = PageSource.Substring(startIndex).Replace("formAuthenticityToken", "");
                        int endIndex = start.IndexOf("\",");
                        string end = start.Substring(0, endIndex).Replace("\"", "").Replace(":", "");
                        PostAuthenticityToken = end;
                    }

                }
                catch (Exception ex)
                {
                    ReturnString = "Error";
                    return ReturnString;
                }
                string Post = "https://api.twitter.com/1/direct_messages/new.json";
                string PostData = string.Empty;
                if (!NumberHelper.ValidateNumber(Screen_name))
                {
                    PostData = "screen_name=" + Screen_name + "&text=" + MessageText;
                }
                else
                {
                    PostData = "user_id=" + userID + "&text=" + MessageText;
                }

                string pageSource = globusHttpHelper.postFormData(new Uri(Post), PostData, "", string.Empty, "", "true", "");
                if (pageSource.Contains("sender\":") && pageSource.Contains(MessageText))
                {
                    ReturnString = "Success: " + MessageText;
                    clsDBQueryManager DataBase = new clsDBQueryManager();
                    string dbTweetMessage = StringEncoderDecoder.Encode(MessageText);
                    string OtherUser = Screen_name;
                    if (string.IsNullOrEmpty(Screen_name))
                    {
                        OtherUser = userID;
                    }

                    DataBase.InsertMessageData(Username, "Message", OtherUser, dbTweetMessage);
                }
            }
            catch (Exception ex)
            {
                ReturnString = "Error";
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager -- DirectMessage() --> " + ex.Message, Globals.Path_DMErroLog);
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager -- DirectMessage() -- " + Username + " --> " + ex.Message, Globals.Path_TweetAccountManager);
            }
            return ReturnString;
        }
开发者ID:ahmetDostr,项目名称:twtboard,代码行数:81,代码来源:TweetAccountManager.cs

示例2: Tweet


//.........这里部分代码省略.........
                                    if (que_TweetMessages_Hashtags.Count > 0)
                                    {
                                        try
                                        {
                                            Hashtags = que_TweetMessages_Hashtags.Dequeue();
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartTweetingMultithreaded() -- Tweet -- que_TweetMessages_Hashtags --> " + ex.Message, Globals.Path_TweetingErroLog);
                                            GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  Tweet -- que_TweetMessages_Hashtags  --> " + ex.Message, Globals.Path_TweetAccountManager);
                                        }
                                    }
                                    else
                                    {
                                        Log("[ " + DateTime.Now + " ] => [ All Loaded Hash Tags Are Used ]");
                                        //break;
                                    }
                                }
                            }
                            if (!string.IsNullOrEmpty(Hashtags))
                            {
                                tweetMessage = Hashtags + " " + tweetMessage;
                            }

                            tweeter.Tweet(ref globusHttpHelper, postAuthenticityToken, tweetMessage, out tweetStatus);

                            if (tweetStatus == "posted")
                            {
                                try
                                {
                                    Log("[ " + DateTime.Now + " ] => [ >> Tweeted >> " + tweetMessage + " by " + Username + " ]");
                                    clsDBQueryManager DataBase = new clsDBQueryManager();
                                    string dbTweetMessage = StringEncoderDecoder.Encode(tweetMessage);
                                    DataBase.InsertMessageData(Username, "Tweet", "null", dbTweetMessage);
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword + ":" + tweetMessage, Globals.path_SuccessfullyTweetAccounts);
                                    //Log("[ " + DateTime.Now + " ] => [ Tweet Delayed for " + delay + " Seconds ]");
                                    try
                                    {
                                        RemoveFollwerFromTxtFile(FileTweetPath, tweetMessage);
                                    }
                                    catch { }
                                    //Thread.Sleep(delay * 1000);
                                    counter_Tweet++;
                                    AlreadyTweeted++;
                                    Globals.totalcountTweet++;
                                }
                                catch (Exception ex)
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> StartTweetingMultithreaded() -- tweetStatus --> " + ex.Message, Globals.Path_TweetingErroLog);
                                    GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  Tweet()  -- " + Username + " --> " + ex.Message, Globals.Path_TweetAccountManager);
                                }
                            }
                            else
                            {
                                if (UseHashTags)
                                {
                                    que_TweetMessages_Hashtags.Enqueue(Hashtags);
                                    que_TweetMessages.Enqueue(tweetMessage);
                                }
                                else
                                {
                                    que_TweetMessages.Enqueue(tweetMessage);
                                }
                                Log("[ " + DateTime.Now + " ] => [ >>Couldn't Post >> " + tweetMessage + " by " + Username + " ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword + ":" + tweetMessage, Globals.path_FailedToTweetAccounts);
                                //Thread.Sleep(delay * 1000);
开发者ID:ahmetDostr,项目名称:twtboard,代码行数:67,代码来源:TweetAccountManager.cs

示例3: StartWaitAndReply


//.........这里部分代码省略.........
                                //}
                                #endregion

                                lock (locker_que_TweetMessages_WaitAndReply)
                                {
                                    if (que_TweetMessages_WaitAndReply.Count > 0)
                                    {
                                        try
                                        {
                                            tweetMessage = que_TweetMessages_WaitAndReply.Dequeue();
                                            ImagePath = que_ImagePath_WaitAndReply.Dequeue();
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager -- locker_que_TweetMessages_WaitAndReply --  --> " + ex.Message, Globals.Path_WaitNreplyErroLog);
                                            GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  StartWaitAndReply() -- locker_que_TweetMessages_WaitAndReply -- " + Username + " --> " + ex.Message, Globals.Path_TweetAccountManager);
                                        }
                                    }
                                    else
                                    {
                                        Log("[ " + DateTime.Now + " ] => [All Loaded Tweet Messages Used ]");
                                        break;
                                    }
                                }

                                if (IsTweetWithImage)
                                {
                                    tweeter.TweetMessageWithImage(ref globusHttpHelper, postAuthenticityToken, tweetMessage, ImagePath, out tweetStatus);
                                    if (tweetStatus == "posted")
                                    {
                                        Log("[ " + DateTime.Now + " ] => [ Tweeted : " + tweetMessage + " with image:"+ImagePath+" by " + Username + " ]");
                                        clsDBQueryManager DataBase = new clsDBQueryManager();
                                        string dbTweetMessage = StringEncoderDecoder.Encode(tweetMessage);
                                        DataBase.InsertMessageData(Username, "Tweet", "", dbTweetMessage);
                                        GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword+":"+tweetMessage, Globals.path_SuccessfullyTweetAccounts);
                                        countTweetsSent++;
                                        if (!waitAndReplyIsIntervalInsec)
                                        {
                                            Log("[ " + DateTime.Now + " ] => [ Delay For : " + TimeSpan.FromMilliseconds(interval).Minutes + " Minutes ]");
                                            Thread.Sleep(interval);
                                        }
                                        else
                                        {
                                            try
                                            {
                                                interval = RandomNumberGenerator.GenerateRandom(waitAndReplyMinInterval, waitAndReplyMaxInterval);
                                            }
                                            catch { }
                                            Log("[ " + DateTime.Now + " ] => [ Delay For : " + interval + " seconds. ]");
                                            interval = interval * 1000;
                                            Thread.Sleep(interval);
                                        }
                                    }
                                    else
                                    {
                                        Log("[ " + DateTime.Now + " ] => [ Couldn't Post : " + tweetMessage + " with image:"+ImagePath+" by " + Username + " ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword + ":" + tweetMessage, Globals.path_FailedToTweetAccounts);
                                        countTweetsSent++;
                                        //Log("[ " + DateTime.Now + " ] => [ Delay For : " + TimeSpan.FromMilliseconds(interval).Minutes + " Minutes ]");
                                        //Thread.Sleep(interval);
                                        if (!waitAndReplyIsIntervalInsec)
                                        {
                                            Log("[ " + DateTime.Now + " ] => [ Delay For : " + TimeSpan.FromMilliseconds(interval).Minutes + " Minutes ]");
                                            Thread.Sleep(interval);
                                        }
                                        else
开发者ID:ahmetDostr,项目名称:twtboard,代码行数:67,代码来源:TweetAccountManager.cs

示例4: ReTweetDivideRetweet

        public void ReTweetDivideRetweet(List<TwitterDataScrapper.StructTweetIDs> lst_DivideTweets, int minDelay, int maxDelay)
        {
            try
            {
                if (!IsLoggedIn)
                {
                    Login();
                }

                if (IsNotSuspended)
                {
                    if (IsLoggedIn)
                    {

                        int counter_Retweet = 0;

                        //TwitterDataScrapper.StructTweetIDs item = new TwitterDataScrapper.StructTweetIDs();
                        //while (que_lst_Struct_TweetData.Count > 0)
                        foreach (var item in lst_DivideTweets)
                        {
                            //foreach (TwitterDataScrapper.StructTweetIDs item in static_lst_Struct_TweetData)
                            //{
                            if (!RetweetPerDay)
                            {
                                if (counter_Retweet >= noOfRetweets)
                                {
                                    Log("[ " + DateTime.Now + " ] => [ " + counter_Retweet + " ReTweets Done For " + Username + " ]");
                                    break;
                                }
                            }
                            else if (RetweetPerDay)
                            {
                                if (AlreadyRetweeted >= NoOFRetweetPerDay)
                                {
                                    Log("[ " + DateTime.Now + " ] => [ Already Tweeted " + AlreadyRetweeted + " ]");
                                    break;
                                }
                            }

                            lock (locker_qque_lst_Struct_TweetData)
                            {
                                //if (que_lst_Struct_TweetData.Count > 0)
                                //{
                                //    item = que_lst_Struct_TweetData.Dequeue();
                                //}
                                //else
                                //{

                                //}

                            }

                            string tweetStatus;

                            int delay = 10 * 1000;

                            try
                            {
                                //delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                if (Globals.IsGlobalDelay && Globals.IsCheckValueOfDelay)
                                {
                                    delay = RandomNumberGenerator.GenerateRandom(Globals.MinGlobalDelay, Globals.MaxGlobalDelay);
                                }
                                else
                                {
                                    delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                                }
                            }
                            catch (Exception ex)
                            {
                                delay = 10;
                                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  ReTweet()  -- " + Username + " --> " + ex.Message, Globals.Path_TweetAccountManager);
                            }

                            tweeter.ReTweet(ref globusHttpHelper, pgSrc_Profile, postAuthenticityToken, item.ID_Tweet, "", out tweetStatus);

                            if (tweetStatus == "posted")
                            {
                                counter_Retweet++;
                                AlreadyRetweeted++;
                                clsDBQueryManager DataBase = new clsDBQueryManager();
                                string dbTweetMessage = StringEncoderDecoder.Encode(item.wholeTweetMessage);
                                DataBase.InsertMessageData(Username, "ReTweet", item.ID_Tweet, dbTweetMessage);
                                Log("[ " + DateTime.Now + " ] => [ Retweeted " + counter_Retweet + ": >> " + item.username__Tweet_User + " by " + Username + " ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(item.username__Tweet_User + " by " + Username, Globals.path_RetweetInformation);
                            }
                            else
                            {
                                Log("[ " + DateTime.Now + " ] => [ >>Couldn't Retweet >> " + item.ID_Tweet_User + " by " + Username + " ]");
                                //GlobusFileHelper.AppendStringToTextfileNewLine("Retweeted " + counter_Retweet + ": >> " + item.username__Tweet_User + " by " + Username, Globals.path_RetweetInformation);
                            }

                            Log("[ " + DateTime.Now + " ] => [ Retweet Delayed for " + delay + " Seconds ]");
                            Thread.Sleep(delay * 1000);
                        }

                        Log("[ " + DateTime.Now + " ] => [ Finished Retweeting with : " + Username + " ]");
                        Log("------------------------------------------------------------------------------------------------------------------------------------------");
                    }
                    else
//.........这里部分代码省略.........
开发者ID:ahmetDostr,项目名称:twtboard,代码行数:101,代码来源:TweetAccountManager.cs

示例5: Reply

        public void Reply(List<string> list_tweetMessages, int minDelay, int maxDelay)
        {
            //Login();

            //if (true)

            if (!IsLoggedIn)
            {
                Login();
            }

            if (IsNotSuspended)
            {
                if (IsLoggedIn)
                {
                    int counter_Retweet = 0;

                    foreach (TwitterDataScrapper.StructTweetIDs item in static_lst_Struct_TweetData)
                    {
                        if (counter_Retweet >= noOfRetweets)
                        {
                            //Log("Finished Replying with : " + Username);
                            break;
                        }

                        string tweetStatus;

                        int delay = 10 * 1000;
                        try
                        {
                            delay = RandomNumberGenerator.GenerateRandom(minDelay, maxDelay);
                        }
                        catch { }

                        string tweetMessage = "";
                        try
                        {
                            tweetMessage = list_tweetMessages[RandomNumberGenerator.GenerateRandom(0, list_tweetMessages.Count - 1)];
                        }
                        catch (Exception ex)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TweetAccountManager --  Reply() -- tweetMessage -- " + Username + " --> " + ex.Message, Globals.Path_TweetAccountManager);
                        }

                        tweeter.Reply(ref globusHttpHelper, pgSrc_Profile, postAuthenticityToken, item.ID_Tweet, item.username__Tweet_User, tweetMessage, out tweetStatus);

                        if (tweetStatus == "posted")
                        {
                            counter_Retweet++;
                            clsDBQueryManager DataBase = new clsDBQueryManager();
                            string dbTweetMessage = string.Empty;
                            try
                            {
                                dbTweetMessage = StringEncoderDecoder.Encode(tweetMessage);
                            }
                            catch { }
                            DataBase.InsertMessageData(Username, "Reply", item.ID_Tweet, dbTweetMessage);
                            Log("[ " + DateTime.Now + " ] => [ >> Replied : " + counter_Retweet + " : " + tweetMessage + " by " + Username + " ]");
                            //GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_SuccessfullyFollowAccounts);
                        }
                        else
                        {
                            Log("[ " + DateTime.Now + " ] => [ >>Couldn't Reply >> " + tweetMessage + " by " + Username + " ]");
                            //GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_FailedToFollowAccounts);
                        }

                        Log("[ " + DateTime.Now + " ] => [ Reply Delayed for " + delay + " Seconds ]");
                        Thread.Sleep(delay * 1000);
                    }

                    Log("[ " + DateTime.Now + " ] => [ Finished Replying with : " + Username + " ]");
                    Log("------------------------------------------------------------------------------------------------------------------------------------------");
                }
                else
                {
                    Log("[ " + DateTime.Now + " ] => [ Couldn't log in with " + Username + " ]");
                    GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_FailedLoginAccounts);
                }
            }
        }
开发者ID:ahmetDostr,项目名称:twtboard,代码行数:80,代码来源:TweetAccountManager.cs


注:本文中的BaseLib.clsDBQueryManager.InsertMessageData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。