예제 #1
0
        private void Auto()
        {
            DataTable dtTable1 = WebStep.GetByIDWeb(long.Parse(lookUpEditPage.EditValue.ToString()));
            int       i        = 0;

            while (i < dtTable1.Rows.Count)
            {
                DataRow dtRow       = dtTable1.Rows[i];
                string  processStep = dtRow["Action"].ToString();
                if (processStep.IndexOf("Exists") < 0)
                {
                    processStep = processStep.Replace("{UserName}", forum.UserName);
                    processStep = processStep.Replace("{Password}", forum.Password);
                    processStep = processStep.Replace("{Url}", forum.UrlPost);
                    processStep = processStep.Replace("{IDTopic}", forum.IDTopic);
                    processStep = processStep.Replace("{Content}", "Up phụ nè");
                    string s = MyCore.ProcessStep(processStep, ie);
                    if (s != String.Empty)
                    {
                        if (dtRow["Message"] != null && dtRow["Message"].ToString().Trim() != "")
                        {
                            MessageBox.Show(dtRow["Message"].ToString());
                            return;
                        }
                    }
                    i++;
                }
                else
                {
                    try
                    {
                        string[] a           = processStep.Split('(');
                        string   processType = a[0].Trim();
                        string   processText = a[1].Trim(')');
                        string[] b           = processText.Split('|');
                        string   text        = b[0].Trim();
                        int      stepYes     = int.Parse(b[1]);
                        int      stepNo      = int.Parse(b[2]);
                        if (MyCore.Exist(text, ie))
                        {
                            i = stepYes - 1;
                        }
                        else
                        {
                            i = stepNo - 1;
                        }
                    }
                    catch
                    {
                        i++;
                    }
                }
            }
            MessageBox.Show("Hoàn thành");
        }
예제 #2
0
 private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         dialogWatcher.CloseUnhandledDialogs = true;
         if (proccessStep.IndexOf("Exists") < 0)
         {
             proccessStep = proccessStep.Replace("{UserName}", forum.UserName);
             proccessStep = proccessStep.Replace("{Password}", forum.Password);
             proccessStep = proccessStep.Replace("{Url}", forum.UrlPost);
             proccessStep = proccessStep.Replace("{IDTopic}", forum.IDTopic);
             result       = MyCore.ProcessStep(proccessStep, ie);
         }
         else
         {
             try
             {
                 type   = 2;
                 result = String.Empty;
                 string[] a           = proccessStep.Split('(');
                 string   processType = a[0].Trim();
                 string   processText = a[1].Trim(')');
                 string[] b           = processText.Split('|');
                 string   text        = b[0].Trim();
                 int      stepYes     = int.Parse(b[1]);
                 int      stepNo      = int.Parse(b[2]);
                 if (MyCore.Exist(text, ie))
                 {
                     nextStep = stepYes - 1;
                 }
                 else
                 {
                     nextStep = stepNo - 1;
                 }
             }
             catch
             {
                 type = 1;
             }
         }
     }
     catch { }
 }