namespace ns0
{
    using ns1;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    internal class frmResEditor : Form
    {
        private Button btnSaveResource;
        private Button btnshow;
        private frmMain frmMain_0;
        private IContainer icontainer_0 = null;
        private Label label1;
        private Label lblFreeID;
        private ToolStripStatusLabel statusLabel;
        private StatusStrip statusStrip1;
        private TextBox txtResID;
        private TextBox txtSaveAs;
        private TextBox txtText;

        public frmResEditor(frmMain main)
        {
            this.frmMain_0 = main;
            this.InitializeComponent();
        }

        private void btnSaveResource_Click(object sender, EventArgs e)
        {
            int num = this.frmMain_0.class7_0.method_12(0, this.txtSaveAs.Text);
            if (num > -1)
            {
                if (MessageBox.Show("Replace old text?", "Replace", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return;
                }
                this.frmMain_0.class7_0.dataTable_0.Rows[num][1] = this.txtText.Text;
                this.method_2("Changed successfully!");
            }
            else
            {
                DataRow row = this.frmMain_0.class7_0.dataTable_0.NewRow();
                row[0] = this.txtSaveAs.Text;
                row[1] = this.txtText.Text;
                this.frmMain_0.class7_0.dataTable_0.Rows.Add(row);
                this.method_2("Added new textdata!");
            }
            if (this.frmMain_0.class3_0 != null)
            {
                this.frmMain_0.method_7();
            }
            this.frmMain_0.method_2();
            this.txtResID.Text = this.txtSaveAs.Text;
            this.method_0();
            this.frmMain_0.method_6("");
        }

        private void btnshow_Click(object sender, EventArgs e)
        {
            ushort num = 0;
            try
            {
                num = Convert.ToUInt16(this.txtResID.Text);
            }
            catch
            {
                MessageBox.Show("Invalid number!");
                return;
            }
            int num2 = this.frmMain_0.class7_0.method_12(0, num.ToString());
            if (num2 < 0)
            {
                this.method_2("Not found!");
                this.txtText.Tag = 0;
            }
            else
            {
                this.txtText.Text = this.frmMain_0.class7_0.dataTable_0.Rows[num2][1].ToString();
                this.txtSaveAs.Text = this.txtResID.Text;
                this.txtText.Tag = num;
            }
        }

        private void frmResEditor_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = true;
            base.Hide();
        }

        private void frmResEditor_Load(object sender, EventArgs e)
        {
            this.txtText.Tag = 0;
            this.method_0();
        }

        private void InitializeComponent()
        {
            this.txtResID = new TextBox();
            this.label1 = new Label();
            this.btnshow = new Button();
            this.txtText = new TextBox();
            this.btnSaveResource = new Button();
            this.txtSaveAs = new TextBox();
            this.statusStrip1 = new StatusStrip();
            this.statusLabel = new ToolStripStatusLabel();
            this.lblFreeID = new Label();
            this.statusStrip1.SuspendLayout();
            base.SuspendLayout();
            this.txtResID.Location = new Point(0x27, 9);
            this.txtResID.Name = "txtResID";
            this.txtResID.Size = new Size(90, 20);
            this.txtResID.TabIndex = 0;
            this.label1.AutoSize = true;
            this.label1.Location = new Point(12, 12);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x15, 13);
            this.label1.TabIndex = 1;
            this.label1.Text = "ID:";
            this.btnshow.Location = new Point(0x8f, 9);
            this.btnshow.Name = "btnshow";
            this.btnshow.Size = new Size(0x4d, 20);
            this.btnshow.TabIndex = 2;
            this.btnshow.Text = "Show";
            this.btnshow.UseVisualStyleBackColor = true;
            this.btnshow.Click += new EventHandler(this.btnshow_Click);
            this.txtText.BackColor = Color.Black;
            this.txtText.ForeColor = Color.White;
            this.txtText.Location = new Point(14, 40);
            this.txtText.Multiline = true;
            this.txtText.Name = "txtText";
            this.txtText.ScrollBars = ScrollBars.Both;
            this.txtText.Size = new Size(0x145, 220);
            this.txtText.TabIndex = 3;
            this.btnSaveResource.Location = new Point(15, 0x10a);
            this.btnSaveResource.Name = "btnSaveResource";
            this.btnSaveResource.Size = new Size(0x56, 0x18);
            this.btnSaveResource.TabIndex = 4;
            this.btnSaveResource.Text = "Save As ID:";
            this.btnSaveResource.UseVisualStyleBackColor = true;
            this.btnSaveResource.Click += new EventHandler(this.btnSaveResource_Click);
            this.txtSaveAs.Location = new Point(0x6b, 270);
            this.txtSaveAs.Name = "txtSaveAs";
            this.txtSaveAs.Size = new Size(0x70, 20);
            this.txtSaveAs.TabIndex = 5;
            this.statusStrip1.Items.AddRange(new ToolStripItem[] { this.statusLabel });
            this.statusStrip1.Location = new Point(0, 0x130);
            this.statusStrip1.Name = "statusStrip1";
            this.statusStrip1.Size = new Size(0x15c, 0x16);
            this.statusStrip1.TabIndex = 6;
            this.statusStrip1.Text = "statusStrip1";
            this.statusLabel.Name = "statusLabel";
            this.statusLabel.Size = new Size(0x2a, 0x11);
            this.statusLabel.Text = "Ready.";
            this.lblFreeID.AutoSize = true;
            this.lblFreeID.Location = new Point(0xe1, 0x111);
            this.lblFreeID.Name = "lblFreeID";
            this.lblFreeID.Size = new Size(0x2d, 13);
            this.lblFreeID.TabIndex = 7;
            this.lblFreeID.Text = "Free ID:";
            this.lblFreeID.Click += new EventHandler(this.lblFreeID_Click);
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x15c, 0x146);
            base.Controls.Add(this.lblFreeID);
            base.Controls.Add(this.statusStrip1);
            base.Controls.Add(this.txtSaveAs);
            base.Controls.Add(this.btnSaveResource);
            base.Controls.Add(this.txtText);
            base.Controls.Add(this.btnshow);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.txtResID);
            base.FormBorderStyle = FormBorderStyle.FixedDialog;
            base.MaximizeBox = false;
            base.Name = "frmResEditor";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "Resources";
            base.Load += new EventHandler(this.frmResEditor_Load);
            base.FormClosing += new FormClosingEventHandler(this.frmResEditor_FormClosing);
            this.statusStrip1.ResumeLayout(false);
            this.statusStrip1.PerformLayout();
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        private void lblFreeID_Click(object sender, EventArgs e)
        {
            this.txtSaveAs.Text = this.lblFreeID.Tag.ToString();
        }

        private void method_0()
        {
            ushort num = this.frmMain_0.method_20();
            this.lblFreeID.Text = "Free ID:" + num.ToString();
            this.lblFreeID.Tag = num;
        }

        public void method_1(ushort ushort_0)
        {
            int num = this.frmMain_0.class7_0.method_12(0, ushort_0.ToString());
            if (num < 0)
            {
                this.method_2("Not found!");
                this.txtText.Tag = 0;
            }
            else
            {
                this.txtText.Text = this.frmMain_0.class7_0.dataTable_0.Rows[num][1].ToString();
                this.txtResID.Text = ushort_0.ToString();
                this.txtSaveAs.Text = this.txtResID.Text;
                this.txtText.Tag = ushort_0;
            }
        }

        public void method_2(string string_0)
        {
            this.statusLabel.Text = string_0;
        }

        public void Dispose(bool disposing)
        {
            if (disposing && (this.icontainer_0 != null))
            {
                this.icontainer_0.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}

