namespace SHNDecrypt
{
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class rowFilter : Form
    {
        private Button btnClear;
        private Button btnMove;
        private ComboBox cmbMoveAfter;
        private ComboBox cmbToMove;
        private IContainer components;
        private Label label1;
        private Label label2;
        private Label label3;
        private frmMain main;
        private ProgressBar progressBar1;
        private TextBox txtOutput;
        private TextBox txtSearch;

        public rowFilter(frmMain mainfrm)
        {
            this.main = mainfrm;
            this.InitializeComponent();
            this.init();
        }

        private void btnClear_Click(object sender, EventArgs e)
        {
            this.txtOutput.Text = "";
        }

        private void btnMove_Click(object sender, EventArgs e)
        {
            this.txtOutput.Text = "";
            int num = this.main.file.getColIndex(this.cmbToMove.Text);
            int num2 = this.main.file.getColIndex(this.cmbMoveAfter.Text);
            this.progressBar1.Value = 0;
            this.progressBar1.Maximum = this.main.file.table.Rows.Count - 1;
            for (int i = 0; i < this.main.file.table.Rows.Count; i++)
            {
                if (this.main.file.table.Rows[i][num2].ToString().Contains(this.txtSearch.Text))
                {
                    this.txtOutput.Text = this.txtOutput.Text + this.main.file.table.Rows[i][num].ToString() + "\r\n";
                }
                this.progressBar1.Value = i;
            }
            this.main.SQLStatus.Text = "Output list done.";
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        public void init()
        {
            if (this.main.file.table != null)
            {
                this.cmbToMove.Items.Clear();
                for (int i = 0; i < this.main.file.table.Columns.Count; i++)
                {
                    this.cmbToMove.Items.Add(this.main.file.table.Columns[i].ColumnName);
                    this.cmbMoveAfter.Items.Add(this.main.file.table.Columns[i].ColumnName);
                }
                this.cmbToMove.SelectedIndex = 0;
                this.cmbMoveAfter.SelectedIndex = 0;
            }
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(rowFilter));
            this.cmbToMove = new ComboBox();
            this.label1 = new Label();
            this.label2 = new Label();
            this.cmbMoveAfter = new ComboBox();
            this.btnMove = new Button();
            this.label3 = new Label();
            this.txtSearch = new TextBox();
            this.txtOutput = new TextBox();
            this.btnClear = new Button();
            this.progressBar1 = new ProgressBar();
            base.SuspendLayout();
            this.cmbToMove.DropDownStyle = ComboBoxStyle.DropDownList;
            this.cmbToMove.FormattingEnabled = true;
            this.cmbToMove.Location = new Point(0x4a, 12);
            this.cmbToMove.Name = "cmbToMove";
            this.cmbToMove.Size = new Size(210, 0x15);
            this.cmbToMove.TabIndex = 0;
            this.label1.AutoSize = true;
            this.label1.Location = new Point(13, 15);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x39, 13);
            this.label1.TabIndex = 1;
            this.label1.Text = "Add to List";
            this.label2.AutoSize = true;
            this.label2.Location = new Point(0x1f, 0x2a);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x27, 13);
            this.label2.TabIndex = 2;
            this.label2.Text = "Where";
            this.cmbMoveAfter.DropDownStyle = ComboBoxStyle.DropDownList;
            this.cmbMoveAfter.FormattingEnabled = true;
            this.cmbMoveAfter.Location = new Point(0x4a, 0x27);
            this.cmbMoveAfter.Name = "cmbMoveAfter";
            this.cmbMoveAfter.Size = new Size(210, 0x15);
            this.cmbMoveAfter.TabIndex = 3;
            this.btnMove.Location = new Point(290, 12);
            this.btnMove.Name = "btnMove";
            this.btnMove.Size = new Size(0x53, 0x4c);
            this.btnMove.TabIndex = 4;
            this.btnMove.Text = "Go";
            this.btnMove.UseVisualStyleBackColor = true;
            this.btnMove.Click += new EventHandler(this.btnMove_Click);
            this.label3.AutoSize = true;
            this.label3.Location = new Point(0x16, 0x47);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x30, 13);
            this.label3.TabIndex = 5;
            this.label3.Text = "Contains";
            this.txtSearch.Location = new Point(0x4a, 0x44);
            this.txtSearch.Name = "txtSearch";
            this.txtSearch.Size = new Size(210, 20);
            this.txtSearch.TabIndex = 6;
            this.txtOutput.Location = new Point(0x12, 0x5e);
            this.txtOutput.Multiline = true;
            this.txtOutput.Name = "txtOutput";
            this.txtOutput.ScrollBars = ScrollBars.Both;
            this.txtOutput.Size = new Size(0x163, 0x133);
            this.txtOutput.TabIndex = 7;
            this.btnClear.Location = new Point(0x12, 0x1b0);
            this.btnClear.Name = "btnClear";
            this.btnClear.Size = new Size(0x163, 0x18);
            this.btnClear.TabIndex = 8;
            this.btnClear.Text = "Clear";
            this.btnClear.UseVisualStyleBackColor = true;
            this.btnClear.Click += new EventHandler(this.btnClear_Click);
            this.progressBar1.Location = new Point(0x12, 0x198);
            this.progressBar1.Name = "progressBar1";
            this.progressBar1.Size = new Size(0x163, 0x12);
            this.progressBar1.TabIndex = 9;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x185, 470);
            base.Controls.Add(this.progressBar1);
            base.Controls.Add(this.btnClear);
            base.Controls.Add(this.txtOutput);
            base.Controls.Add(this.txtSearch);
            base.Controls.Add(this.label3);
            base.Controls.Add(this.btnMove);
            base.Controls.Add(this.cmbMoveAfter);
            base.Controls.Add(this.label2);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.cmbToMove);
            base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "rowFilter";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "Row Filter";
            base.ResumeLayout(false);
            base.PerformLayout();
        }
    }
}

