Exemplo n.º 1
0
        public void Check() // Вызывается при необходимости после загрузки ревизий
        {
            try
            {
                ns = Convert.ToInt32(page.ns);
            }
            catch (Exception) { error = true; return; }
            String allowed_ns = StreamConfig.GetNamespaces();

            if (!allowed_ns.Contains("|" + ns + "|") && !allowed_ns.StartsWith(ns + "|") && !allowed_ns.EndsWith("|" + ns) && !allowed_ns.Equals(page.ns))
            {
                delete_me = true; skip_me = true; return;
            }
            if (page.flagged_size != -1)
            {
                diff_size = page.last_size - page.flagged_size;
            }
            else
            {
                diff_size = -1; page_size = page.last_size;
            }
            if (Math.Abs(diff_size) > StreamConfig.GetParamMax())
            {
                delete_me = true; skip_me = true; return;
            }
            stable_id = page.flagged_rev;
            curr_id   = page.maxid;
            if (curr_id == stable_id)
            {
                this.reviewed = true; delete_me = true; skip_me = true; return;
            }

            if (stable_id < 1 && !StreamConfig.IsArticlesEnabled())
            {
                delete_me = true; return;
            }
            if (stable_id > 0 && !StreamConfig.IsDiffsEnabled())
            {
                delete_me = true; return;
            }
        }
Exemplo n.º 2
0
        public void SaveConfig()
        {
            int mode = tabControl.SelectedIndex;

            // стандартные
            StreamConfig.SetOption("mode", mode);

            List <String> ns = new List <string>();

            if (ns0.Checked)
            {
                ns.Add("0");
            }
            if (ns6.Checked)
            {
                ns.Add("6");
            }
            if (ns10.Checked)
            {
                ns.Add("10");
            }
            if (ns14.Checked)
            {
                ns.Add("14");
            }
            StreamConfig.SetOption("ns", String.Join("|", ns.ToArray()));

            if (articles.Checked)
            {
                StreamConfig.SetOption("art", 1);
            }
            else
            {
                StreamConfig.SetOption("art", 0);
            }
            if (articles.Checked)
            {
                StreamConfig.SetOption("art", 1);
            }
            else
            {
                StreamConfig.SetOption("art", 0);
            }

            if (dir_old.Checked == true)
            {
                StreamConfig.SetOption("dir", 0);
            }
            else if (dir_auto.Checked == true)
            {
                StreamConfig.SetOption("dir", 2);
            }
            else
            {
                StreamConfig.SetOption("dir", 1);
            }

            StreamConfig.SetOption("max_diff", maxdiff.Text);

            if (show_articles.Checked)
            {
                StreamConfig.SetOption("show_articles", 1);
            }
            else
            {
                StreamConfig.SetOption("show_articles", 0);
            }

            if (show_diffs.Checked)
            {
                StreamConfig.SetOption("show_diffs", 1);
            }
            else
            {
                StreamConfig.SetOption("show_diffs", 0);
            }

            // сохраняем изменения в только открытом режиме

            switch (mode)
            {
            case 0:
                break;

            case 1:
                mode = -1;

                if (mode0.Checked)
                {
                    mode = 0;
                }
                if (mode1.Checked)
                {
                    mode = 1;
                }
                if (mode2.Checked)
                {
                    mode = 2;
                }
                if (mode3.Checked)
                {
                    mode = 3;
                }
                if (mode4.Checked)
                {
                    mode = 4;
                }
                if (mode5.Checked)
                {
                    mode = 5;
                }

                StreamConfig.SetOption("smode_1", mode);

                StreamConfig.SetOption("start_1", textBox1.Text);
                StreamConfig.SetOption("category", textBox2.Text);
                break;

            case 2:
                mode = -1;

                if (m1_m0.Checked)
                {
                    mode = 0;
                }
                if (m1_m1.Checked)
                {
                    mode = 1;
                }

                StreamConfig.SetOption("smode_2", mode);

                StreamConfig.SetOption("start_2", textBox3.Text);
                break;

            case 3:
                StreamConfig.list.Clear();
                foreach (String tmp in list.Lines)
                {
                    if (tmp.Trim().Length > 1)
                    {
                        StreamConfig.list.Add(tmp.Trim());
                    }
                }
                break;

            case 4:
                mode = -1;

                if (m2_m0.Checked)
                {
                    mode = 0;
                }
                if (m2_m1.Checked)
                {
                    mode = 1;
                }

                StreamConfig.SetOption("smode_4", mode);
                StreamConfig.SetOption("user", textBox4.Text);
                StreamConfig.SetOption("user_time", textBox5.Text);
                break;
            }
            StreamConfig.SaveOptions();
        }
Exemplo n.º 3
0
        public void LoadConfig()
        {
            int mode = StreamConfig.GetOptionInt("mode");

            tabControl.SelectedIndex = mode;
            // общие
            String[] ns;
            String   ss = StreamConfig.GetOption("ns");

            ns = ss.Split('|');

            ns0.Checked = false; ns6.Checked = false; ns10.Checked = false; ns14.Checked = false;
            foreach (String s in ns)
            {
                switch (s)
                {
                case "0": ns0.Checked = true; break;

                case "6": ns6.Checked = true; break;

                case "10": ns10.Checked = true; break;

                case "14": ns14.Checked = true; break;
                }
            }
            articles.Checked  = false;
            redirects.Checked = false;

            if (StreamConfig.GetOptionInt("redir") == 1)
            {
                redirects.Checked = true;
            }
            else
            {
                redirects.Checked = false;
            }
            if (StreamConfig.GetOptionInt("art") == 1)
            {
                articles.Checked = true;
            }
            else
            {
                redirects.Checked = false;
            }

            maxdiff.Text = StreamConfig.GetOption("max_diff");


            int dir = StreamConfig.GetOptionInt("dir");

            if (dir == 0)
            {
                dir_old.Checked = true;
            }
            else if (dir == 2)
            {
                dir_auto.Checked = true;
            }
            else
            {
                dir_new.Checked = true;
            }

            show_articles.Checked = StreamConfig.GetOptionInt("show_articles") == 1? true : false;
            show_diffs.Checked    = StreamConfig.GetOptionInt("show_diffs") == 1 ? true : false;

            // режим 0


            // режим 1

            mode = StreamConfig.GetOptionInt("smode_1");

            if (mode == 0)
            {
                mode0.Checked = true;
            }
            else if (mode == 1)
            {
                mode1.Checked = true;
            }
            else if (mode == 2)
            {
                mode2.Checked = true;
            }
            else if (mode == 3)
            {
                mode3.Checked = true;
            }
            else if (mode == 4)
            {
                mode4.Checked = true;
            }
            else if (mode == 5)
            {
                mode5.Checked = true;
            }

            textBox1.Text = StreamConfig.GetOption("start_1");
            textBox2.Text = StreamConfig.GetOption("category");


            // режим 2

            mode = StreamConfig.GetOptionInt("smode_2");

            if (mode == 0)
            {
                m1_m0.Checked = true;
            }
            else if (mode == 1)
            {
                m1_m1.Checked = true;
            }

            textBox3.Text = StreamConfig.GetOption("start_2");


            // режим 3


            // режим 4

            mode = StreamConfig.GetOptionInt("smode_4");

            if (mode == 0)
            {
                m2_m0.Checked = true;
            }
            else if (mode == 1)
            {
                m2_m1.Checked = true;
            }

            textBox4.Text = StreamConfig.GetOption("user");
            textBox5.Text = StreamConfig.GetOption("user_time");
        }
Exemplo n.º 4
0
        public bool CheckMode(int mode)
        {
            switch (mode)
            {
            case 0:
                //return false;
                return(true);

                break;

            case 1:
                if (!mode0.Checked && !mode1.Checked && !mode2.Checked && !mode3.Checked && !mode4.Checked && !mode5.Checked)
                {
                    MessageBox.Show(T("You haven't chosen a mode!")); return(false);
                }                                                                                                                                                                                     //Не выбран ни один режим!

                if (mode2.Checked && !StreamConfig.IsValidDate(textBox1.Text))
                {
                    MessageBox.Show(T("Incorrect date!")); return(false);
                }                                                                                                                           //Неверно введена дата!
                if (textBox2.Text.Contains("|"))
                {
                    MessageBox.Show(T("Incorrect category!")); return(false);
                }                                                                                                 //Неверно введена категория!

                break;

            case 2:
                if (!m1_m0.Checked && !m1_m1.Checked)
                {
                    MessageBox.Show(T("You haven't chosen a mode!")); return(false);
                }                                                                                                             //Не выбран ни один режим!
                if (m1_m1.Checked && (textBox3.Text.Equals("") || textBox3.Text.Contains("|")))
                {
                    MessageBox.Show(T("Incorrect page name!")); return(false);
                }                                                                                                                                                 //Неверно введена статья!

                break;

            case 3:
                int c = 0;
                foreach (String tmp in list.Lines)
                {
                    if (tmp.Trim().Length > 1)
                    {
                        c++;
                    }
                }
                if (c < 1)
                {
                    MessageBox.Show(T("The list is empty!")); return(false);
                }                                                                          //Список пуст!
                break;

            case 4:
                if (!m2_m0.Checked && !m2_m1.Checked)
                {
                    MessageBox.Show(T("You haven't chosen a mode!")); return(false);
                }                                                                                                           //Не выбран ни один режим!
                if (textBox4.Text.Equals("") || textBox4.Text.Contains("|"))
                {
                    MessageBox.Show(T("Incorrect user!")); return(false);
                }                                                                                                                         //Неверно введен пользователь!
                if (m2_m1.Checked && !StreamConfig.IsValidDate(textBox5.Text))
                {
                    MessageBox.Show(T("Incorrect date!")); return(false);
                }                                                                                                                           //Неверно введена дата!
                break;
            }
            return(true);
        }