コード例 #1
0
ファイル: HashTag.cs プロジェクト: workad009/gramboard
        public void CommentOnSnapsVideos(ref InstagramAccountManager accountManager, string url)
        {
            Comments objComments = new Comments();
            InstagramPhotoLike objInstagramPhotoLike = new InstagramPhotoLike();
            string message = string.Empty;
            ClGlobul.checkHashTagComment = true;
            string user = accountManager.Username;
            string commentStatus = string.Empty;
            string likeStatus = string.Empty;
            try
            {
                try
                {
                    if (ClGlobul.HashCommentMessage.Count == ClGlobul.NumberofSnapsVideosToComment)
                    {
                        message = ClGlobul.HashCommentMessage[i];
                        i++;
                    }
                    else
                    {
                        message = ClGlobul.HashCommentMessage[RandomNumberGenerator.GenerateRandom(0, ClGlobul.HashCommentMessage.Count)];
                    }
                }
                catch (Exception ex)
                { }
                try
                {
                    try
                    {
                        DataSet commentDS = DataBaseHandler.SelectQuery("select comment_status from comment_hash_tag where account_holder ='" + user + "' and photo_id = '" + url.Replace("http://websta.me/p/", string.Empty) + "'", "comment_hash_tag");
                        if (commentDS.Tables[0].Rows.Count != 0)
                        {
                            commentStatus = commentDS.Tables[0].Rows[0].ItemArray[0].ToString();
                        }
                    }
                    catch(Exception ex)
                    { }
                    try
                    {
                        DataSet likeDS = DataBaseHandler.SelectQuery("select like_status from liker_hash_tag where account_holder ='" + user + "' and photo_id ='" + url.Replace("http://websta.me/p/", string.Empty) + "'", "liker_hash_tag");
                        if (likeDS.Tables[0].Rows.Count != 0)
                        {
                            likeStatus = likeDS.Tables[0].Rows[0].ItemArray[0].ToString();
                        }
                    }
                    catch (Exception ex)
                    { }

                }
                catch(Exception ex)
                {}

                if (!(commentStatus == "Success"))
                {
                    if (!(counterComment == ClGlobul.NumberofSnapsVideosToComment))
                    {
                        string status = objComments.Comment(url, message, ref accountManager);
                        Thread.Sleep(ClGlobul.hashTagDelay * 1000);
                        if (status == "Success")
                        {
                            Log("[ " + DateTime.Now + "] " + "[ Commented on snap/video with url : " + url + " with this message : " + message + " ]");
                        }
                        else
                        {
                            Log("[ " + DateTime.Now + "] " + "[ Could not comment on snap/video with url : " + url + " ]");
                        }

                        if (ClGlobul.isCommentAndLikeChecked == true)
                        {
                            if (!(likeStatus == "LIKED"))
                            {
                                ClGlobul.checkHashTagLiker = true;
                                string photoStatus = objInstagramPhotoLike.photolike(url, ref accountManager);
                                Thread.Sleep(ClGlobul.hashTagDelay * 1000);
                                if (photoStatus == "LIKED")
                                {
                                    Log("[ " + DateTime.Now + "] " + "[ Snap/Video liked with url : " + url + " ]");
                                }
                                else
                                {
                                    Log("[ " + DateTime.Now + "] " + "[ Snap/Video not liked with url : " + url + " ]");
                                }
                            }
                            else
                            {
                                Log("[ " + DateTime.Now + "] " + "[ Snap/video with url : " + url + " is already liked. ]");
                            }
                        }
                        counterComment++;
                    }
                    else
                    {
                        ClGlobul.isCommentLimitReached = true;
                        Log("[ " + DateTime.Now + "] " + "[ Commented on " + ClGlobul.NumberofSnapsVideosToLike + " snaps/videos. ");
                        return;
                    }
                }
            }
            catch (Exception ex)
            { }
        }
コード例 #2
0
ファイル: frm_stagram.cs プロジェクト: workad009/gramboard
        public void getComment(ref InstagramManager.Classes.InstagramAccountManager accountManager, string CommentIdsForMSG_item)
        {
            Queue<string> CommentIdQueue = new Queue<string>();
            Queue<string> MsgQueue = new Queue<string>();

            InstagramManager.Classes.Comments ObjComments = new Comments();
            InstagramManager.Classes.InstagramPhotoLike ObjPotoLike = new InstagramPhotoLike();
            try
            {
                //Fill MSg's In Queue List ...
                //foreach (string commentMsgList_item in ClGlobul.commentMsgList)
                //{
                //    MsgQueue.Enqueue(commentMsgList_item);
                //}

                string photoLikeresult = string.Empty;

                //If the user Choose somment all given Id from every login Accounts ...
                //Then will be choose check bOx ...
                //if (chk_MsgAllCommentId.Checked == true)
                //{
                //foreach (string CommentIdsForMSG_item in ClGlobul.CommentIdsForMSG)
                //{
                photoLikeresult = string.Empty;
                //string message = MsgQueue.Dequeue();
                string message = ClGlobul.commentMsgList[RandomNumberGenerator.GenerateRandom(0, ClGlobul.commentMsgList.Count)];
                try
                {
                    string status = ObjComments.Comment(CommentIdsForMSG_item, message, ref accountManager);
                    if (status == "success")
                    {
                        //AddToCommentLogger("[ " + DateTime.Now + " ] => [ comment is successfully posted from " + accountManager.Username + " ]");
                        AddToCommentLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + "  comment is successfully posted from " + CommentIdsForMSG_item + " ]");
                    }
                    else
                    {
                        //AddToCommentLogger("[ " + DateTime.Now + " ] => [ comment is successfully posted from " + accountManager.Username + " ]");
                        //AddToCommentLogger("[ " + DateTime.Now + " ] => [ Failed for  posted from " + accountManager.Username + " ]");
                        AddToCommentLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + "  comment is successfully posted from This Id " + CommentIdsForMSG_item + " ]");
                    }

                    if (chk_CommentWithLike.Checked == true)
                    {
                        try
                        {
                            //Get Photo like if user is required ....
                            photoLikeresult = ObjPotoLike.photolike(CommentIdsForMSG_item, ref accountManager);
                        }
                        catch (Exception ex)
                        {
                            //AddToCommentLogger(DateTime.Now + ":=> Methode Name :- GetComment ()- Photo like :-  " + ex.Message);
                            GramBoardProFileHelper.AppendStringToTextfileNewLine((DateTime.Now + ":=> Methode Name :- GetComment ()- Photo like :- " + ex.Message), GramBoardProFileHelper.ErrorLogFilePathForComment);
                        }

                        //Print statuse in logger
                        printStatus(accountManager.Username, status, CommentIdsForMSG_item, photoLikeresult);
                    }
                    else
                    {
                        //Print statuse in logger
                        printStatus(accountManager.Username, status, CommentIdsForMSG_item);
                    }

                    if (!string.IsNullOrEmpty(txtmindelayComment.Text) && NumberHelper.ValidateNumber(txtmindelayComment.Text))
                    {
                        mindelay = Convert.ToInt32(txtmindelayComment.Text);
                    }
                    if (!string.IsNullOrEmpty(txtmaxdelayComments.Text) && NumberHelper.ValidateNumber(txtmaxdelayComments.Text))
                    {
                        maxdelay = Convert.ToInt32(txtmaxdelayComments.Text);
                    }

                    int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                    AddToCommentLogger("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds For " + accountManager.Username + " ]");
                    Thread.Sleep(delay * 1000);
                }
                catch (Exception ex)
                {
                    //AddToCommentLogger(DateTime.Now + ":=> Methode Name => GetComment () :=> " + ex.Message);
                    GramBoardProFileHelper.AppendStringToTextfileNewLine("---------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
                    GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetPhotolike ()  :=> comment Error :-  " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment);
                    GramBoardProFileHelper.AppendStringToTextfileNewLine("---------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
                }

                //if (MsgQueue.Count == 0)
                //{
                //    break;
                //}
                //}

                //}

                #region From Queue
                //else
                //{
                //    /// When user is choosend single comment in single Photo Id's
                //    /// then program is Full fill this condion
                //    /// and which is Commented in one Id and one MSg
                //    /// also try to avoid duplicacy for it.
                //    if (CommentIdQueue.Count==0)
                //    {
                //        foreach (string CommentIdsForMSG_item in ClGlobul.CommentIdsForMSG)
                //        {
                //            CommentIdQueue.Enqueue(CommentIdsForMSG_item);
                //        }
                //    }

                //    while (true)
                //    {
                //        Thread.Sleep(1000);
                //        photoLikeresult = string.Empty;
                //        string CommentIdForMSG = CommentIdQueue.Dequeue();
                //        string message = "";
                //        message = MsgQueue.Dequeue();
                //        try
                //        {
                //            string status = ObjComments.Comment(CommentIdForMSG, message, ref accountManager);

                //            if (chk_CommentWithLike.Checked == true)
                //            {
                //                try
                //                {
                //                    ///..get photo like from given Id
                //                    photoLikeresult = ObjPotoLike.photolike(CommentIdForMSG, ref accountManager);
                //                }
                //                catch (Exception)
                //                {
                //                    photoLikeresult = "All ready Like";
                //                }
                //                //Print statuse in logger
                //                printStatus(accountManager.Username, status, CommentIdForMSG, photoLikeresult);
                //            }
                //            else
                //            {
                //                //Print statuse in logger
                //                printStatus(accountManager.Username, status, CommentIdForMSG);
                //            }
                //        }
                //        catch (Exception ex)
                //        {
                //            AddTophotoLogger(" Methode Name => GetLoginForComment (2) :=> " + ex.Message);
                //            AddTophotoLogger(accountManager.Username+"is not Comment to "+CommentIdForMSG);
                //            GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetLoginForComment (2) :=> " + ex.Message, GlobusFileHelper.ErrorLogFilePathForComment);
                //            GlobusFileHelper.AppendStringToTextfileNewLine(accountManager.ClientId + ":" + accountManager.Password + ":" + CommentIdForMSG, GlobusFileHelper.NotCommentedFilePath);
                //        }

                //        //if MESSAGE and Photo ID's are finished
                //        // Then break the while loop ...
                //        if (CommentIdQueue.Count == 0 || MsgQueue.Count==0)
                //        {
                //            if (CommentIdQueue.Count == 0 && MsgQueue.Count == 0)
                //            {
                //            }
                //            else if (CommentIdQueue.Count == 0)
                //                AddToCommentLogger("Photo id's are Finished ");
                //            else if (MsgQueue.Count == 0)
                //                AddToCommentLogger("Messages are Finished ");

                //            break;
                //        }

                //    }
                //}
                #endregion
            }
            catch (Exception ex)
            {
                //AddToCommentLogger(DateTime.Now + ":=> Methode Name => GetComment () :=> " + ex.Message);
                GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
                GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetPhotolike (2)  :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment);
                GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
            }
            finally
            {
                AddToCommentLogger("[ " + DateTime.Now + " ] => [ Comment is Finished From Account : " + accountManager.Username + " ]");
            }
        }
コード例 #3
0
ファイル: HashTag.cs プロジェクト: workad009/gramboard
        public void LikeSnapsVideos(ref InstagramAccountManager accountManager, string url)
        {
            string user = accountManager.Username;
            string likeStatus = string.Empty;
            ClGlobul.checkHashTagLiker = true;
            InstagramPhotoLike objInstagramPhotoLike = new InstagramPhotoLike();
            try
            {
                DataSet DS = DataBaseHandler.SelectQuery("select like_status from liker_hash_tag where account_holder ='" + user + "' and photo_id ='" + url.Replace("http://websta.me/p/", string.Empty) + "'", "liker_hash_tag");
                if (DS.Tables[0].Rows.Count != 0)
                {
                    likeStatus = DS.Tables[0].Rows[0].ItemArray[0].ToString();
                }
            }
            catch(Exception ex)
            { }
            try
            {
                if (!(likeStatus == "LIKED"))
                {
                    if (!(counterLike == ClGlobul.NumberofSnapsVideosToLike))
                    {
                        string response = objInstagramPhotoLike.photolike(url, ref accountManager);
                        Thread.Sleep(ClGlobul.hashTagDelay * 1000);
                        counterLike++;
                        if (response == "LIKED")
                        {
                            Log("[ " + DateTime.Now + "] " + "[ Snap/Video liked with url : " + url + " ]");

                        }
                        else
                        {
                            Log("[ " + DateTime.Now + "] " + "[ Snap/Video not liked with url : " + url + " ]");
                        }
                    }
                    else
                    {
                        ClGlobul.isLikeLimitReached = true;
                        Log("[ " + DateTime.Now + "] " + " [ " + ClGlobul.NumberofSnapsVideosToLike + " snaps/videos liked ]");
                        return;
                    }
                }

            }
            catch(Exception ex)
            {
            }
        }
コード例 #4
0
ファイル: frm_stagram.cs プロジェクト: workad009/gramboard
        public void getPhotoLike(ref InstagramManager.Classes.InstagramAccountManager accountManager)
        {
            InstagramManager.Classes.InstagramPhotoLike InstagramPhotoLike = new InstagramManager.Classes.InstagramPhotoLike();
            try
            {
                foreach (string PhotoList_item in ClGlobul.PhotoList)
                {

                    string query = "select * from LikeInfo where UseName='" + accountManager.Username + "' and LikePhotoId='" + PhotoList_item + "'";
                    DataSet ds = DataBaseHandler.SelectQuery(query, "LikeInfo");
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        try
                        {
                            string LikeName = PhotoList_item;
                            // string Result = InstagramPhotoLike.photolike(LikeName, ref accountManager);
                            string photoId = string.Empty;

                            if (PhotoList_item.Contains("\0"))
                            {
                                photoId = PhotoList_item.Replace("\0", string.Empty).Trim();
                            }
                            else
                            {
                                photoId = PhotoList_item;
                            }
                            string Result = string.Empty;
                            try
                            {
                                Result = InstagramPhotoLike.photolike(photoId, ref accountManager);
                            }
                            catch { }

                            if (Result.Contains("LIKED") && !Result.Contains("All ready LIKED"))
                            {
                                try
                                {
                                    //QueryExecuter.insertPhotoId(accountManager.Username, photoId);
                                    QueryExecuter.insertLikeStatus(photoId, accountManager.Username, 1);

                                }
                                catch (Exception ex)
                                {
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getPhotoLike :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                }

                                try
                                {
                                    if (!ClGlobul.photoLikesCompletedList.Contains(accountManager.Username))// + ":" + accountManager.Password + ":" + accountManager.proxyAddress + ":" + accountManager.proxyPort + ":" + accountManager.proxyUsername + ":" + accountManager.proxyPassword))
                                    {
                                        ClGlobul.photoLikesCompletedList.Add(accountManager.Username);// + ":" + accountManager.Password + ":" + accountManager.proxyAddress + ":" + accountManager.proxyPort + ":" + accountManager.proxyUsername + ":" + accountManager.proxyPassword);
                                    }
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(accountManager.Username + ":" + photoId, GramBoardProFileHelper.LikePhotoAccountIdFilePath);
                                    // QueryExecuter.UpdateStatusPhotoId(accountManager.Username, photoId);

                                }
                                catch (Exception ex)
                                {
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getPhotoLike :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);

                                }
                                try
                                {
                                    AddTophotoLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + "   LIKED : " + PhotoList_item + " ]");
                                }
                                catch
                                {
                                    AddTophotoLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + "   All ready LIKED : " + PhotoList_item + " ]");

                                }
                            }
                            else if (Result.Contains("All ready LIKED"))
                            {
                                try
                                {
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(accountManager.Username + ":" + photoId, GramBoardProFileHelper.AllReadylikePhotoAccountIdFilePath);
                                }
                                catch (Exception ex)
                                {
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getPhotoLike :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                }

                                AddTophotoLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + " All ready LIKED :  " + PhotoList_item + " ]");
                            }
                            else
                            {
                                try
                                {
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(accountManager.Username + ":" + photoId, GramBoardProFileHelper.NotlikePhotoAccountIdFilePath);
                                }
                                catch (Exception ex)
                                {
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getPhotoLike :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                }

                                AddTophotoLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + " is Not LIKED : " + PhotoList_item + " ]");
                            }

                            if (!string.IsNullOrEmpty(txtdelaymin.Text) && NumberHelper.ValidateNumber(txtdelaymin.Text))
                            {
                                mindelay = Convert.ToInt32(txtdelaymin.Text);
                            }
                            if (!string.IsNullOrEmpty(txtdelaymax.Text) && NumberHelper.ValidateNumber(txtdelaymax.Text))
                            {
                                maxdelay = Convert.ToInt32(txtdelaymax.Text);
                            }

                            lock (_lockObject)
                            {
                                Random rn = new Random();
                                int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                delay = rn.Next(mindelay,maxdelay);
                                AddTophotoLogger("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds For " + accountManager.Username + " ]");
                                Thread.Sleep(delay * 1000);
                            }
                        }
                        catch (Exception ex)
                        {

                            GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetPhotolike (1) :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike);

                        }
                    }
                    else
                    {
                        AddTophotoLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + " All ready LIKED :  " + PhotoList_item + " ]");
                    }
                }
            }
            catch (Exception ex)
            {

                GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetPhotolike (2)  :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike);

            }
            finally
            {
                AddTophotoLogger("--------------------------------------------------------------------------------------------");
                AddTophotoLogger("[ " + DateTime.Now + " ] => [ Photo Like is Finished From =>" + accountManager.Username + " ]");
                AddTophotoLogger("--------------------------------------------------------------------------------------------");
            }
        }