Example #1
0
        private static Asker GetAsker(string p, bool is25 = true)
        {
            Asker Result = new Asker("", "");

            if (Ques_.IsAnonymousQues(p))
            {
                string   s1 = "", s2 = "", s3 = "", s4 = "";
                string[] pcs = new string[] { };
                if (is25)
                {
                    s4 = "</a></span>";
                    s3 = "\" class=\"link-blue\" dir=\"rtl\">";
                    s2 = "\" class=\"link-blue\" dir=\"ltr\">";
                    s1 = "class=\"author nowrap\">&nbsp;&nbsp;<a href=\"/";
                }
                else
                {     //class=\"author nowrap\">&nbsp;&nbsp;<a href=\"/MostafaEssam115\" class=\"link-blue\" dir=\"ltr\">Mostafa Essam</a></span>\n
                    s4 = "";
                    s3 = "\\\" class=\\\"link-blue\\\" dir=\\\"rtl\\\">";
                    s2 = "\\\" class=\\\"link-blue\\\" dir=\\\"ltr\\\">";
                    s1 = "class=\\\"author nowrap\\\">&nbsp;&nbsp;<a href=\\\"/";
                }
                pcs = p.Split(new string[] { s1, s2, s3, s4 }, StringSplitOptions.RemoveEmptyEntries);
                return(new Asker(pcs[2], pcs[1]));
            }
            return(new Asker());
        }
Example #2
0
 private static int GetFans(string q, bool Is25)
 {
     if (Is25)
     {
         return(Ques_.GetFans25(q));
     }
     else
     {
         return(Ques_.GetFansM(q));
     }
 }
Example #3
0
 private static string GetAnswer(string p)
 {
     if (Ques_.IsSingleAnswer(p))
     {
         if (p.Contains("\n"))
         {
             string[] x = p.Split(new char[] { '\n' });
             return(x[1]);
         }
         else
         {
             return(p);
         }
     }
     else if (p.Contains('\n'))
     {
         string[] byN = p.Split(new char[] { '\n' });
         return(byN[1]);
     }
     else
     {
         return(p);
     }
 }
Example #4
0
        public static Ques_ Create(string q, int i, bool ___25__ = true)
        {
            Ques_ __obj = new Ques_(q);

            __obj.AnalyzDirections();
            __obj.InDex = i;
            __obj._25   = ___25__;
            string[] pieces = q.Split(new string[] { "<div" }, StringSplitOptions.RemoveEmptyEntries);

            __obj.ID    = Ques_.GetId(pieces[0]);
            __obj.Quest = Ques_.GetQuest(pieces[1]).HTML_to_TEXT();
            __obj.Fans  = Ques_.GetFans25(pieces[8]);

            if (pieces[1].Contains("span class=\"author nowrap\">"))
            {
                __obj.setAsker(Ques_.GetAsker(q));
            }

            __obj.AskingTime = Ques_.GetTime(pieces[4]);
            __obj.Answer     = Ques_.GetAnswer(pieces[3]);

            __obj.Decode();
            return(__obj);
        }
Example #5
0
 internal static string GetQuest(Ques_ q)
 {
     string[] pcs = q.COde.Split(new string[] { "<span dir=\"rtl\">", "<span dir=\"ltr\">", "</span>" }, StringSplitOptions.RemoveEmptyEntries);
     return(pcs[1]);
 }
Example #6
0
        private static Ques_ CreateMore(string q, int i,bool Is25=true)
        {
            Ques_ obj = new Ques_();
            obj._25 = Is25;
            obj.AnalyzDirections( );
            obj.InDex = i;

            int DateIndex = 11;
            if (q.Length > 0)
            {
                if (q.Contains("\\"))
                {
                    string[] pcs = q.Split(new string[] { "/questions/", "/report", "\\\">\\n\\n    <div class=\\\"question", "id=\\\"question_box_", "\\\">\\n\\n    <div class=\\\"question\\\" dir=\\\"ltr\\\">", "<span class=\\\"text-bold\\\"><span dir=\\\"ltr\\\">", "</span></span>\\n    </div>", "<div class=\\\"answer\\\" dir=\\\"ltr\\\">", "</div>\\n\\n    <div class", "data-rlt-aid=\\\"answer_time\\\" hint=\\\"", "ago</a></div>", "div class=\\\"likeList people-like-block\\\"><a href", "likes this</div>" }, StringSplitOptions.RemoveEmptyEntries);
                    if (pcs.Length > 1)
                    {
                        obj.ID = long.Parse(pcs[1]);

                        if (obj.IsLeft_to_left())
                        {
                            obj.Quest = (pcs[3]);
                            obj.Answer = Ques_.GetAnswerM_LTR(pcs[9]).Trim();
                        }

                        else if (obj.ISLeft_to_right())
                        {
                            obj.Quest = (pcs[3]);
                            obj.Answer = Ques_.GetAnswerM_RTL(pcs[5]);
                        }

                        else if (obj.IsRight_to_Left())
                        {
                            obj.Quest = Ques_.GetQuestM_RTL(pcs[2]);
                            obj.Answer = Ques_.GetAnswerM_LTR(pcs[9]).Trim();

                        }

                        else if (obj.IsRight_to_Right())
                        {
                            obj.Quest = Ques_.GetQuestM_RTL(pcs[2]);
                            obj.Answer = Ques_.GetAnswerM_RTL(pcs[7]);
                            DateIndex = 9;

                        }
                        obj.AskingTime = pcs[DateIndex].Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries)[0];
                        obj.Fans = Ques_.GetFans(q, false);

                        obj.setAsker(Ques_.GetAsker(q, false));
                    }

                    /*/"\" id=\\\"question_box_123427359647\\\">\\n\\n
                    <div class=\\\"question\\\" dir=\\\"rtl\\\">\\n
                     * <span class=\\\"text-bold\\\"><span dir=\\\"rtl\\\">
                     *    \\u0625\\u0641\\u062a\\u062d \\u0627\\u0644\\u0631\\u0622\\u0628\\u0637\\u060c
                     *    \\u0645\\u0647\\u0645\\u064f : [
                     *    <a class=\\\"link-blue\\\" target=\\\"_blank\\\" rel=\\\"nofollow\\\" href=\\\"http://l.ask.fm/goto/50aiCb_tfaGMFH48iDvC_Y0ooQiD-umJvjzvofOy0CuNNxFsDJ0BLVa3_hYCQm4-WViAct81_FXWtpQnpRwaj2FTMGVyol3Ob3S0xfA,\\\">http://ask.fm/AbdulrahmanBedaiwi/answer/122031348826</a>
                     *    ]\\u060c \\u0648\\u0645\\u0648 \\u0644\\u0627\\u0632\\u0645 \\u064a\\u0646\\u0632\\u0644.
                     *    </span></span>\\u200f<span class=\\\"author nowrap\\\">&nbsp;&nbsp;<a href=\\\"/AbdulrahmanBedaiwi\\\" class=\\\"link-blue\\\" dir=\\\"rtl\\\">\\u00b1\\u062f.\\u0639\\u0628\\u062f\\u0651\\u0627\\u0644\\u0631\\u062d\\u0645\\u0651\\u0646 \\u2639\\u2716\\ue035.</a></span>\\n    </div>\\n\\n    \\n    \\n    <div class=\\\"reportFlagBox \\\">\\n  <a href=\\\"/a7medbenladen1/questions/123427359647/report_answer\\\" class=\\\"reportFlag hintable\\\" hint=\\\"Report\\\" onclick=\\\"RLTLogger.execute(&quot;CtxPointer&quot;, &quot;Complain.mark&quot;);$.colorbox({href:&quot;/a7medbenladen1/questions/123427359647/report_answer&quot;,title:&quot;Report&quot;}); return false\\\"></a>\\n</div>\\n\\n\\n    \\n    \\n\\n    <div class=\\\"answer\\\" dir=\\\"ltr\\\">\\n      <a class=\\\"link-blue\\\" target=\\\"_blank\\\" rel=\\\"nofollow\\\" href=\\\"http://l.ask.fm/goto/50aiCb_tfaGMFH48iDvo-po1rAyP_eyJvk26_M72lh7jOAxoHoovM1W2-BQGQGgzV1SF\\\">http://ask.fm/keshavmohan309</a> follow him and like his 50 answers nd in return he will give 100\\n    </div>\\n\\n    <div class=\\\"time\\\"><a href=\\\"/a7medbenladen1/answer/123427359647\\\" class=\\\"link-time hintable inverse\\\" data-rlt-aid=\\\"answer_time\\\" hint=\\\"December 31, 2014 17:23:16 GMT\\\">10 months ago</a></div>\\n\\n    <div class=\\\"likeCombo\\\" id=\\\"like_box_123427359647\\\">\\n  \\n    <div class=\\\"likeBox\\\">\\n      <div class=\\\" ghostLink\\\">\\n        <a href=\\\"/likes/a7medbenladen1/question/123427359647/mobile_prompt\\\" class=\\\"like hintable\\\" hint=\\\"Like\\\" onclick=\\\"$.colorbox({href:&quot;/likes/a7medbenladen1/question/123427359647/quick_prompt&quot;,title:&quot;create account or log in&quot;}); return false\\\"></a>\\n      </div>\\n    </div>\\n    <div class=\\\"likeList people-like-block\\\"><a class=\\\"link-blue\\\" href=\\\"/likes/a7medbenladen1/question/123427359647/people\\\" onclick=\\\"$.colorbox({title:&quot;People Who Like This&quot;,onComplete:Likes.onPeopleOpening,onCleanup:Likes.onPeopleClosing,href:&quot;/likes/a7medbenladen1/question/123427359647/people&quot;}); return false\\\">1 person</a> likes this</div>\\n    \\n</div>\\n\\n    \\n  </div>\\n\\n  \\n    \\n  \\n\\n\\n\");\n$(\"#questions_page\").val(2);\n$(\"#more-container\").hide();"
                */
                }
            }
            return obj;
        }
Example #7
0
        public static Ques_ Create(string q, int i, bool ___25__=true)
        {
            Ques_ __obj = new Ques_(q);
            __obj.AnalyzDirections();
            __obj.InDex = i;
            __obj._25 = ___25__;
            string[] pieces = q.Split(new string[] { "<div" }, StringSplitOptions.RemoveEmptyEntries);

            __obj.ID = Ques_.GetId(pieces[0]);
            __obj.Quest = Ques_.GetQuest(pieces[1]).HTML_to_TEXT();
            __obj.Fans = Ques_.GetFans25(pieces[8]);

            if (pieces[1].Contains("span class=\"author nowrap\">"))
                __obj.setAsker(Ques_.GetAsker(q));

            __obj.AskingTime = Ques_.GetTime(pieces[4]);
            __obj.Answer = Ques_.GetAnswer(pieces[3]);

            __obj.Decode();
            return __obj;
        }
Example #8
0
 private void AddNewQuest(Ques_ qui)
 {
     try
     {
         foreach (Ques_ q in this._Quests)
             if (q.ID == qui.ID)
                 return;
         if (this._Quests.Count < this._CurrentAnswers)
             this._Quests.Add(qui);
     }
     catch { }
 }
Example #9
0
        private void DisplayQuest(Ques_ q )
        {
            lblAsker.Text = this.rtxbxques.Text = lblTime.Text = rtxbxAnswer.DocumentText = ______lblINDEX.Text = "";
            if (q == null)
                return;

            lblAsker.Text = q. AskedBy.Name;
            this.rtxbxques.Text = q.Quest.Replace('\n', ' ');;
            this.lblTime.Text = q.AskingTime;
            this.richTextBoxAnswer.Text= q.Answer;
            ______lblINDEX .Text=( q.InDex+1).ToString()+" of " + this._Quests.Count;
            labelLikers.Text = q.Fans.ToString();

            this.Text = this._currentSearchIndex.ToString();
            QuestLabel.Text = "Quest[" + (q.InDex+1) + "]";
        }
Example #10
0
 public void AnalyzDirections()
 {
     this.Right_to_Left_QUEST  = Ques_.IsQuest_RTL(this.COde);
     this.Right_to_Left_Answer = Ques_.isAnswer_RTL(this.COde);
 }
Example #11
0
        private static Ques_ CreateMore(string q, int i, bool Is25 = true)
        {
            Ques_ obj = new Ques_();

            obj._25 = Is25;
            obj.AnalyzDirections( );
            obj.InDex = i;

            int DateIndex = 11;

            if (q.Length > 0)
            {
                if (q.Contains("\\"))
                {
                    string[] pcs = q.Split(new string[] { "/questions/", "/report", "\\\">\\n\\n    <div class=\\\"question", "id=\\\"question_box_", "\\\">\\n\\n    <div class=\\\"question\\\" dir=\\\"ltr\\\">", "<span class=\\\"text-bold\\\"><span dir=\\\"ltr\\\">", "</span></span>\\n    </div>", "<div class=\\\"answer\\\" dir=\\\"ltr\\\">", "</div>\\n\\n    <div class", "data-rlt-aid=\\\"answer_time\\\" hint=\\\"", "ago</a></div>", "div class=\\\"likeList people-like-block\\\"><a href", "likes this</div>" }, StringSplitOptions.RemoveEmptyEntries);
                    if (pcs.Length > 1)
                    {
                        obj.ID = long.Parse(pcs[1]);

                        if (obj.IsLeft_to_left())
                        {
                            obj.Quest  = (pcs[3]);
                            obj.Answer = Ques_.GetAnswerM_LTR(pcs[9]).Trim();
                        }

                        else if (obj.ISLeft_to_right())
                        {
                            obj.Quest  = (pcs[3]);
                            obj.Answer = Ques_.GetAnswerM_RTL(pcs[5]);
                        }

                        else if (obj.IsRight_to_Left())
                        {
                            obj.Quest  = Ques_.GetQuestM_RTL(pcs[2]);
                            obj.Answer = Ques_.GetAnswerM_LTR(pcs[9]).Trim();
                        }

                        else if (obj.IsRight_to_Right())
                        {
                            obj.Quest  = Ques_.GetQuestM_RTL(pcs[2]);
                            obj.Answer = Ques_.GetAnswerM_RTL(pcs[7]);
                            DateIndex  = 9;
                        }
                        obj.AskingTime = pcs[DateIndex].Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries)[0];
                        obj.Fans       = Ques_.GetFans(q, false);

                        obj.setAsker(Ques_.GetAsker(q, false));
                    }

                    /*/"\" id=\\\"question_box_123427359647\\\">\\n\\n
                     * <div class=\\\"question\\\" dir=\\\"rtl\\\">\\n
                     * <span class=\\\"text-bold\\\"><span dir=\\\"rtl\\\">
                     *    \\u0625\\u0641\\u062a\\u062d \\u0627\\u0644\\u0631\\u0622\\u0628\\u0637\\u060c
                     *    \\u0645\\u0647\\u0645\\u064f : [
                     *    <a class=\\\"link-blue\\\" target=\\\"_blank\\\" rel=\\\"nofollow\\\" href=\\\"http://l.ask.fm/goto/50aiCb_tfaGMFH48iDvC_Y0ooQiD-umJvjzvofOy0CuNNxFsDJ0BLVa3_hYCQm4-WViAct81_FXWtpQnpRwaj2FTMGVyol3Ob3S0xfA,\\\">http://ask.fm/AbdulrahmanBedaiwi/answer/122031348826</a>
                     *    ]\\u060c \\u0648\\u0645\\u0648 \\u0644\\u0627\\u0632\\u0645 \\u064a\\u0646\\u0632\\u0644.
                     *    </span></span>\\u200f<span class=\\\"author nowrap\\\">&nbsp;&nbsp;<a href=\\\"/AbdulrahmanBedaiwi\\\" class=\\\"link-blue\\\" dir=\\\"rtl\\\">\\u00b1\\u062f.\\u0639\\u0628\\u062f\\u0651\\u0627\\u0644\\u0631\\u062d\\u0645\\u0651\\u0646 \\u2639\\u2716\\ue035.</a></span>\\n    </div>\\n\\n    \\n    \\n    <div class=\\\"reportFlagBox \\\">\\n  <a href=\\\"/a7medbenladen1/questions/123427359647/report_answer\\\" class=\\\"reportFlag hintable\\\" hint=\\\"Report\\\" onclick=\\\"RLTLogger.execute(&quot;CtxPointer&quot;, &quot;Complain.mark&quot;);$.colorbox({href:&quot;/a7medbenladen1/questions/123427359647/report_answer&quot;,title:&quot;Report&quot;}); return false\\\"></a>\\n</div>\\n\\n\\n    \\n    \\n\\n    <div class=\\\"answer\\\" dir=\\\"ltr\\\">\\n      <a class=\\\"link-blue\\\" target=\\\"_blank\\\" rel=\\\"nofollow\\\" href=\\\"http://l.ask.fm/goto/50aiCb_tfaGMFH48iDvo-po1rAyP_eyJvk26_M72lh7jOAxoHoovM1W2-BQGQGgzV1SF\\\">http://ask.fm/keshavmohan309</a> follow him and like his 50 answers nd in return he will give 100\\n    </div>\\n\\n    <div class=\\\"time\\\"><a href=\\\"/a7medbenladen1/answer/123427359647\\\" class=\\\"link-time hintable inverse\\\" data-rlt-aid=\\\"answer_time\\\" hint=\\\"December 31, 2014 17:23:16 GMT\\\">10 months ago</a></div>\\n\\n    <div class=\\\"likeCombo\\\" id=\\\"like_box_123427359647\\\">\\n  \\n    <div class=\\\"likeBox\\\">\\n      <div class=\\\" ghostLink\\\">\\n        <a href=\\\"/likes/a7medbenladen1/question/123427359647/mobile_prompt\\\" class=\\\"like hintable\\\" hint=\\\"Like\\\" onclick=\\\"$.colorbox({href:&quot;/likes/a7medbenladen1/question/123427359647/quick_prompt&quot;,title:&quot;create account or log in&quot;}); return false\\\"></a>\\n      </div>\\n    </div>\\n    <div class=\\\"likeList people-like-block\\\"><a class=\\\"link-blue\\\" href=\\\"/likes/a7medbenladen1/question/123427359647/people\\\" onclick=\\\"$.colorbox({title:&quot;People Who Like This&quot;,onComplete:Likes.onPeopleOpening,onCleanup:Likes.onPeopleClosing,href:&quot;/likes/a7medbenladen1/question/123427359647/people&quot;}); return false\\\">1 person</a> likes this</div>\\n    \\n</div>\\n\\n    \\n  </div>\\n\\n  \\n    \\n  \\n\\n\\n\");\n$(\"#questions_page\").val(2);\n$(\"#more-container\").hide();"
                     */
                }
            }
            return(obj);
        }
Example #12
0
 internal static string GetQuest(Ques_ q)
 {
     string[] pcs = q.COde.Split(new string[] { "<span dir=\"rtl\">", "<span dir=\"ltr\">","</span>" }, StringSplitOptions.RemoveEmptyEntries);
         return pcs[1];
 }