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

    public class rowReplace : Form
    {
        private Button btnGo;
        private ComboBox cmbSearcher;
        private ComboBox comboBox1;
        private IContainer components;
        private Label label1;
        private Label label2;
        private Label label3;
        private Label label4;
        private frmMain mainfrm;
        private TextBox txtForItems;
        private TextBox txtValue;

        public rowReplace(frmMain form)
        {
            this.mainfrm = form;
            this.InitializeComponent();
        }

        private void btnGo_Click(object sender, EventArgs e)
        {
            int num = this.mainfrm.file.getColIndex(this.comboBox1.Items[this.comboBox1.SelectedIndex].ToString());
            int colIndex = this.mainfrm.file.getColIndex(this.cmbSearcher.Items[this.cmbSearcher.SelectedIndex].ToString());
            if ((num >= 0) && (colIndex >= 0))
            {
                int num3 = 0;
                for (int i = 0; i < this.txtForItems.Lines.Length; i++)
                {
                    int rowByIndex = this.mainfrm.file.GetRowByIndex(colIndex, this.txtForItems.Lines[i].ToLower().Replace(" ", ""));
                    if (rowByIndex >= 0)
                    {
                        this.mainfrm.file.table.Rows[rowByIndex][num] = this.txtValue.Text;
                        num3++;
                    }
                }
                this.mainfrm.SQLStatus.Text = num3.ToString() + " values changed to " + this.txtValue.Text;
            }
        }

        private void ColMultiplier_Load(object sender, EventArgs e)
        {
            if (this.mainfrm.file == null)
            {
                base.Close();
            }
            else
            {
                this.init();
            }
        }

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

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

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(rowReplace));
            this.comboBox1 = new ComboBox();
            this.btnGo = new Button();
            this.label1 = new Label();
            this.txtForItems = new TextBox();
            this.label2 = new Label();
            this.label3 = new Label();
            this.txtValue = new TextBox();
            this.cmbSearcher = new ComboBox();
            this.label4 = new Label();
            base.SuspendLayout();
            this.comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
            this.comboBox1.FormattingEnabled = true;
            this.comboBox1.Location = new Point(0x33, 12);
            this.comboBox1.Name = "comboBox1";
            this.comboBox1.Size = new Size(0x13f, 0x15);
            this.comboBox1.TabIndex = 0;
            this.btnGo.Location = new Point(0x33, 0x155);
            this.btnGo.Name = "btnGo";
            this.btnGo.Size = new Size(0x13f, 0x23);
            this.btnGo.TabIndex = 4;
            this.btnGo.Text = "Go";
            this.btnGo.UseVisualStyleBackColor = true;
            this.btnGo.Click += new EventHandler(this.btnGo_Click);
            this.label1.AutoSize = true;
            this.label1.Location = new Point(6, 0x43);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x2a, 13);
            this.label1.TabIndex = 4;
            this.label1.Text = "Where:";
            this.txtForItems.Location = new Point(0x33, 0x5c);
            this.txtForItems.Multiline = true;
            this.txtForItems.Name = "txtForItems";
            this.txtForItems.Size = new Size(0x13f, 0xf3);
            this.txtForItems.TabIndex = 3;
            this.label2.AutoSize = true;
            this.label2.Location = new Point(0x16, 15);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x1a, 13);
            this.label2.TabIndex = 6;
            this.label2.Text = "Set:";
            this.label3.AutoSize = true;
            this.label3.Location = new Point(0x16, 0x2a);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x17, 13);
            this.label3.TabIndex = 7;
            this.label3.Text = "To:";
            this.txtValue.Location = new Point(0x33, 0x27);
            this.txtValue.Name = "txtValue";
            this.txtValue.Size = new Size(0x13f, 20);
            this.txtValue.TabIndex = 1;
            this.cmbSearcher.DropDownStyle = ComboBoxStyle.DropDownList;
            this.cmbSearcher.FormattingEnabled = true;
            this.cmbSearcher.Location = new Point(0x33, 0x41);
            this.cmbSearcher.Name = "cmbSearcher";
            this.cmbSearcher.Size = new Size(0x13f, 0x15);
            this.cmbSearcher.TabIndex = 2;
            this.label4.AutoSize = true;
            this.label4.Location = new Point(0x20, 0x5e);
            this.label4.Name = "label4";
            this.label4.Size = new Size(13, 13);
            this.label4.TabIndex = 10;
            this.label4.Text = "=";
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x180, 0x182);
            base.Controls.Add(this.label4);
            base.Controls.Add(this.cmbSearcher);
            base.Controls.Add(this.txtValue);
            base.Controls.Add(this.label3);
            base.Controls.Add(this.label2);
            base.Controls.Add(this.txtForItems);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.btnGo);
            base.Controls.Add(this.comboBox1);
            base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "rowReplace";
            base.StartPosition = FormStartPosition.CenterParent;
            this.Text = "Row Replace";
            base.Load += new EventHandler(this.ColMultiplier_Load);
            base.ResumeLayout(false);
            base.PerformLayout();
        }
    }
}

