using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace MuEditor
{
    public class EquipEditor : ucBase
    {
        private const int CB_FINDSTRING = 332;

        private IContainer components;

        private ComboBox cboEquipLevel;

        private ComboBox cboEquipExt;

        private Label label31;

        private ComboBox cboEquipName;

        private ComboBox cboEquipType;

        private GroupBox groupBox3;

        private Button button2;

        private CheckBox chkEquipZY6;

        private CheckBox chkEquipZY4;

        private CheckBox chkEquipZY2;

        private CheckBox chkEquipZY5;

        private CheckBox chkEquipZY3;

        private CheckBox chkEquipZY1;

        private CheckBox chkEquipXY;

        private CheckBox chkEquipJN;

        private Label label30;

        private Label label29;

        private Label label28;

        private Label label1;

        private MuEditor.TextBox txtDurability;

        private CheckBox chk380;

        private ComboBox cboPlusType;

        private ComboBox cboPlusLevel;

        private Label eee;

        private Label label3;

        private Button button4;

        private Button button1;

        private Button button3;

        private MuEditor.TextBox AddNums;

        private Label label2;

        private CheckBox chkAllPart;

        private MuEditor.TextBox txtCode;

        private GroupBox gbXQ;

        private ComboBox cbInlay1b;

        private ComboBox cbInlay3b;

        private ComboBox cbInlay2b;

        private ComboBox cbInlay5b;

        private ComboBox cbInlay4b;

        private ComboBox cbZhiye;

        private Label label4;

        private Label label5;

        private ComboBox cbSetVal;

        private Label label11;

        private Label label10;

        private Label label9;

        private Label label8;

        private Label label7;

        private Label label6;

        private ComboBox cbInlay6b;

        private ArrayList itemTypes = new ArrayList();

        private EquipItem editItem;

        private byte defDurability = 255;

        public static ITEM_ATTRIBUTE[] xItem;
        private GroupBox groupBox1;

        public static ITEM_SOCKETITEM[] xSocket;

        public int AddNum
        {
            get
            {
                return Convert.ToInt32(this.AddNums.Text);
            }
        }

        public bool AllPart
        {
            get
            {
                switch (this.cboEquipType.SelectedIndex)
                {
                    case 7:
                    case 8:
                    case 9:
                    case 10:
                    case 11:
                        {
                            return this.chkAllPart.Checked;
                        }
                }
                return false;
            }
            set
            {
                this.chkAllPart.Checked = value;
            }
        }

        public byte DefaultDurability
        {
            get
            {
                return this.defDurability;
            }
            set
            {
                this.defDurability = value;
            }
        }

        public EquipItem EditItem
        {
            get
            {
                return this.editItem;
            }
        }

        static EquipEditor()
        {
        }

        public EquipEditor()
        {
            this.InitializeComponent();
            string str = "Data\\Item.bmd";
            if (!File.Exists(str))
            {
                str = string.Concat("bin\\Release\\", str);
            }
            EquipEditor.xItem = (new ItemClass(str)).ItemAttribute;
            str = "Data\\SocketItem.bmd";
            if (!File.Exists(str))
            {
                str = string.Concat("bin\\Release\\", str);
            }
            EquipEditor.xSocket = (new SocketItemClass(str)).cSocket;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.chkEquipZY1.Checked = Utils.JPZY1;
            this.chkEquipZY2.Checked = Utils.JPZY2;
            this.chkEquipZY3.Checked = Utils.JPZY3;
            this.chkEquipZY4.Checked = Utils.JPZY4;
            this.chkEquipZY5.Checked = Utils.JPZY5;
            this.chkEquipZY6.Checked = Utils.JPZY6;
            this.cboEquipLevel.SelectedIndex = Utils.JPLevel;
            this.cboEquipExt.SelectedIndex = Utils.JPExt;
            this.chkEquipJN.Checked = Utils.JPJN;
            this.chkEquipXY.Checked = Utils.JPXY;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.chkEquipZY1.Checked = this.chkEquipZY1.Enabled;
            this.chkEquipZY2.Checked = this.chkEquipZY2.Enabled;
            this.chkEquipZY3.Checked = this.chkEquipZY3.Enabled;
            this.chkEquipZY4.Checked = this.chkEquipZY4.Enabled;
            this.chkEquipZY5.Checked = this.chkEquipZY5.Enabled;
            this.chkEquipZY6.Checked = this.chkEquipZY6.Enabled;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.chkEquipZY1.Checked = false;
            this.chkEquipZY2.Checked = false;
            this.chkEquipZY3.Checked = false;
            this.chkEquipZY4.Checked = false;
            this.chkEquipZY5.Checked = false;
            this.chkEquipZY6.Checked = false;
        }

        private void button4_Click(object sender, EventArgs e)
        {
            this.chkEquipZY1.Checked = Utils.DJZY1;
            this.chkEquipZY2.Checked = Utils.DJZY2;
            this.chkEquipZY3.Checked = Utils.DJZY3;
            this.chkEquipZY4.Checked = Utils.DJZY4;
            this.chkEquipZY5.Checked = Utils.DJZY5;
            this.chkEquipZY6.Checked = Utils.DJZY6;
            this.cboEquipLevel.SelectedIndex = Utils.DJLevel;
            this.cboEquipExt.SelectedIndex = Utils.DJExt;
            this.chkEquipJN.Checked = Utils.DJJN;
            this.chkEquipXY.Checked = Utils.DJXY;
        }

        private void cboEquipName_KeyUp(object sender, KeyEventArgs e)
        {
            this.cboEquipName.DroppedDown = true;
        }

        private void cboEquipName_SelectedIndexChanged(object sender, EventArgs e)
        {
            string text = this.cboEquipName.Text;
            if (text == null || "" == text.Trim())
            {
                return;
            }
            EquipItem item = EquipImageCache.Instance.getItem(this.cboEquipName.Text);
            if (item != null)
            {
                if (this.editItem == null)
                {
                    this.editItem = new EquipItem();
                }
                this.editItem.assign(item);
            }
            this.SetUIbyCob(item);
            this.cboPlusType.SelectedIndex = 0;
        }

        private void cboEquipType_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                EquipItemType selectedItem = (EquipItemType)this.cboEquipType.SelectedItem;
                selectedItem.ItemNames = new ArrayList();
                this.loadItemNamesByType(selectedItem.ItemNames, this.cboEquipType.SelectedIndex, this.cbZhiye.SelectedIndex);
                this.cboEquipName.Items.Clear();
                foreach (string itemName in selectedItem.ItemNames)
                {
                    this.cboEquipName.Items.Add(itemName);
                }
                if ((this.cbZhiye.SelectedIndex != 4 || this.cboEquipType.SelectedIndex != 2) && (this.cbZhiye.SelectedIndex != 7 || this.cboEquipType.SelectedIndex != 5) && (this.cbZhiye.SelectedIndex != 7 || this.cboEquipType.SelectedIndex != 1))
                {
                    this.cboEquipName.SelectedIndex = 0;
                }
                EquipItem item = EquipImageCache.Instance.getItem(this.cboEquipName.Text);
                if (item != null)
                {
                    if (this.editItem == null)
                    {
                        this.editItem = new EquipItem();
                    }
                    this.editItem.assign(item);
                }
                this.SetUIbyCob(item);
                this.cboPlusType.SelectedIndex = 0;
                this.cboPlusLevel.SelectedIndex = 0;
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                string[] message = new string[] { "Error:", exception.Message, "\nSource:", exception.Source, "\nTrace:", exception.StackTrace };
                Utils.WarningMessage(string.Concat(message));
            }
        }

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

        private void EquipEditor_Load(object sender, EventArgs e)
        {
            this.txtDurability.Text = Convert.ToString(this.defDurability);
        }

        private void Init_EquipEditor()
        {
            this.cbInlay1b.Items.Clear();
            this.cbInlay2b.Items.Clear();
            this.cbInlay3b.Items.Clear();
            this.cbInlay4b.Items.Clear();
            this.cbInlay5b.Items.Clear();
            this.cbInlay1b.Items.Add(new ComboBoxItem("No sockets", "255"));
            this.cbInlay1b.Items.Add(new ComboBoxItem("No element", "254"));
            for (int i = 0; i < 50; i++)
            {
                if (EquipEditor.xSocket[i].捞抚[0] != 0)
                {
                    for (int j = 0; j < 5; j++)
                    {
                        string str = string.Concat(frmMain.ByteToString(EquipEditor.xSocket[i].捞抚, 64), " +", EquipEditor.xSocket[i].饭骇1[j].ToString());
                        string str1 = (i + j * 50).ToString();
                        this.cbInlay1b.Items.Add(new ComboBoxItem(str, str1));
                    }
                }
            }
            this.cbInlay2b.Items.Add(new ComboBoxItem("No sockets", "255"));
            this.cbInlay2b.Items.Add(new ComboBoxItem("No element", "254"));
            for (int k = 0; k < 50; k++)
            {
                if (EquipEditor.xSocket[k].捞抚[0] != 0)
                {
                    for (int l = 0; l < 5; l++)
                    {
                        string str2 = string.Concat(frmMain.ByteToString(EquipEditor.xSocket[k].捞抚, 64), " +", EquipEditor.xSocket[k].饭骇1[l].ToString());
                        string str3 = (k + l * 50).ToString();
                        this.cbInlay2b.Items.Add(new ComboBoxItem(str2, str3));
                    }
                }
            }
            this.cbInlay3b.Items.Add(new ComboBoxItem("No sockets", "255"));
            this.cbInlay3b.Items.Add(new ComboBoxItem("No element", "254"));
            for (int m = 0; m < 50; m++)
            {
                if (EquipEditor.xSocket[m].捞抚[0] != 0)
                {
                    for (int n = 0; n < 5; n++)
                    {
                        string str4 = string.Concat(frmMain.ByteToString(EquipEditor.xSocket[m].捞抚, 64), " +", EquipEditor.xSocket[m].饭骇1[n].ToString());
                        string str5 = (m + n * 50).ToString();
                        this.cbInlay3b.Items.Add(new ComboBoxItem(str4, str5));
                    }
                }
            }
            this.cbInlay4b.Items.Add(new ComboBoxItem("No sockets", "255"));
            this.cbInlay4b.Items.Add(new ComboBoxItem("No element", "254"));
            for (int o = 0; o < 50; o++)
            {
                if (EquipEditor.xSocket[o].捞抚[0] != 0)
                {
                    for (int p = 0; p < 5; p++)
                    {
                        string str6 = string.Concat(frmMain.ByteToString(EquipEditor.xSocket[o].捞抚, 64), " +", EquipEditor.xSocket[o].饭骇1[p].ToString());
                        string str7 = (o + p * 50).ToString();
                        this.cbInlay4b.Items.Add(new ComboBoxItem(str6, str7));
                    }
                }
            }
            this.cbInlay5b.Items.Add(new ComboBoxItem("No sockets", "255"));
            this.cbInlay5b.Items.Add(new ComboBoxItem("No element", "254"));
            for (int q = 0; q < 50; q++)
            {
                if (EquipEditor.xSocket[q].捞抚[0] != 0)
                {
                    for (int r = 0; r < 5; r++)
                    {
                        string str8 = string.Concat(frmMain.ByteToString(EquipEditor.xSocket[q].捞抚, 64), " +", EquipEditor.xSocket[q].饭骇1[r].ToString());
                        string str9 = (q + r * 50).ToString();
                        this.cbInlay5b.Items.Add(new ComboBoxItem(str8, str9));
                    }
                }
            }
            this.cbInlay1b.SelectedIndex = 0;
            this.cbInlay2b.SelectedIndex = 0;
            this.cbInlay3b.SelectedIndex = 0;
            this.cbInlay4b.SelectedIndex = 0;
            this.cbInlay5b.SelectedIndex = 0;
            this.cbInlay6b.Items.Clear();
            for (int s = 0; s < (int)Utils.YGS.Length; s++)
            {
                this.cbInlay6b.Items.Add(new ComboBoxItem(Utils.YGS[s], s.ToString()));
            }
            this.cbInlay6b.SelectedIndex = 0;
            this.cbSetVal.SelectedIndex = 0;
            this.cboPlusType.SelectedIndex = 0;
            this.cboPlusLevel.SelectedIndex = 0;
        }

        private void InitializeComponent()
        {
            this.cboEquipLevel = new System.Windows.Forms.ComboBox();
            this.cboEquipExt = new System.Windows.Forms.ComboBox();
            this.label31 = new System.Windows.Forms.Label();
            this.cboEquipName = new System.Windows.Forms.ComboBox();
            this.cboEquipType = new System.Windows.Forms.ComboBox();
            this.groupBox3 = new System.Windows.Forms.GroupBox();
            this.button4 = new System.Windows.Forms.Button();
            this.button1 = new System.Windows.Forms.Button();
            this.button3 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.chkEquipZY6 = new System.Windows.Forms.CheckBox();
            this.chkEquipZY4 = new System.Windows.Forms.CheckBox();
            this.chkEquipZY2 = new System.Windows.Forms.CheckBox();
            this.chkEquipZY5 = new System.Windows.Forms.CheckBox();
            this.chkEquipZY3 = new System.Windows.Forms.CheckBox();
            this.chkEquipZY1 = new System.Windows.Forms.CheckBox();
            this.chk380 = new System.Windows.Forms.CheckBox();
            this.chkEquipXY = new System.Windows.Forms.CheckBox();
            this.chkEquipJN = new System.Windows.Forms.CheckBox();
            this.label30 = new System.Windows.Forms.Label();
            this.label29 = new System.Windows.Forms.Label();
            this.label28 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.txtDurability = new MuEditor.TextBox();
            this.cboPlusType = new System.Windows.Forms.ComboBox();
            this.cboPlusLevel = new System.Windows.Forms.ComboBox();
            this.eee = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.chkAllPart = new System.Windows.Forms.CheckBox();
            this.AddNums = new MuEditor.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.txtCode = new MuEditor.TextBox();
            this.gbXQ = new System.Windows.Forms.GroupBox();
            this.cbInlay6b = new System.Windows.Forms.ComboBox();
            this.label11 = new System.Windows.Forms.Label();
            this.label10 = new System.Windows.Forms.Label();
            this.label9 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.cbInlay5b = new System.Windows.Forms.ComboBox();
            this.cbInlay4b = new System.Windows.Forms.ComboBox();
            this.cbInlay3b = new System.Windows.Forms.ComboBox();
            this.cbInlay2b = new System.Windows.Forms.ComboBox();
            this.cbInlay1b = new System.Windows.Forms.ComboBox();
            this.cbZhiye = new System.Windows.Forms.ComboBox();
            this.label4 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.cbSetVal = new System.Windows.Forms.ComboBox();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.groupBox3.SuspendLayout();
            this.gbXQ.SuspendLayout();
            this.groupBox1.SuspendLayout();
            this.SuspendLayout();
            // 
            // cboEquipLevel
            // 
            this.cboEquipLevel.DropDownHeight = 206;
            this.cboEquipLevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboEquipLevel.FormattingEnabled = true;
            this.cboEquipLevel.IntegralHeight = false;
            this.cboEquipLevel.Items.AddRange(new object[] {
            "0",
            "1",
            "2",
            "3",
            "4",
            "5",
            "6",
            "7",
            "8",
            "9",
            "10",
            "11",
            "12",
            "13",
            "14",
            "15"});
            this.cboEquipLevel.Location = new System.Drawing.Point(67, 100);
            this.cboEquipLevel.Name = "cboEquipLevel";
            this.cboEquipLevel.Size = new System.Drawing.Size(35, 21);
            this.cboEquipLevel.TabIndex = 23;
            // 
            // cboEquipExt
            // 
            this.cboEquipExt.DropDownHeight = 206;
            this.cboEquipExt.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboEquipExt.FormattingEnabled = true;
            this.cboEquipExt.IntegralHeight = false;
            this.cboEquipExt.Items.AddRange(new object[] {
            "0",
            "4",
            "8",
            "12",
            "16",
            "20",
            "24",
            "28"});
            this.cboEquipExt.Location = new System.Drawing.Point(155, 100);
            this.cboEquipExt.Name = "cboEquipExt";
            this.cboEquipExt.Size = new System.Drawing.Size(35, 21);
            this.cboEquipExt.TabIndex = 22;
            // 
            // label31
            // 
            this.label31.AutoSize = true;
            this.label31.Location = new System.Drawing.Point(108, 103);
            this.label31.Name = "label31";
            this.label31.Size = new System.Drawing.Size(41, 13);
            this.label31.TabIndex = 21;
            this.label31.Text = "Option:";
            // 
            // cboEquipName
            // 
            this.cboEquipName.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
            this.cboEquipName.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
            this.cboEquipName.DropDownHeight = 400;
            this.cboEquipName.FormattingEnabled = true;
            this.cboEquipName.IntegralHeight = false;
            this.cboEquipName.Location = new System.Drawing.Point(67, 73);
            this.cboEquipName.Name = "cboEquipName";
            this.cboEquipName.Size = new System.Drawing.Size(123, 21);
            this.cboEquipName.TabIndex = 20;
            this.cboEquipName.SelectedIndexChanged += new System.EventHandler(this.cboEquipName_SelectedIndexChanged);
            this.cboEquipName.KeyUp += new System.Windows.Forms.KeyEventHandler(this.cboEquipName_KeyUp);
            // 
            // cboEquipType
            // 
            this.cboEquipType.DropDownHeight = 206;
            this.cboEquipType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboEquipType.FormattingEnabled = true;
            this.cboEquipType.IntegralHeight = false;
            this.cboEquipType.Location = new System.Drawing.Point(67, 46);
            this.cboEquipType.Name = "cboEquipType";
            this.cboEquipType.Size = new System.Drawing.Size(123, 21);
            this.cboEquipType.TabIndex = 19;
            this.cboEquipType.SelectedIndexChanged += new System.EventHandler(this.cboEquipType_SelectedIndexChanged);
            // 
            // groupBox3
            // 
            this.groupBox3.Controls.Add(this.button4);
            this.groupBox3.Controls.Add(this.button1);
            this.groupBox3.Controls.Add(this.button3);
            this.groupBox3.Controls.Add(this.button2);
            this.groupBox3.Controls.Add(this.chkEquipZY6);
            this.groupBox3.Controls.Add(this.chkEquipZY4);
            this.groupBox3.Controls.Add(this.chkEquipZY2);
            this.groupBox3.Controls.Add(this.chkEquipZY5);
            this.groupBox3.Controls.Add(this.chkEquipZY3);
            this.groupBox3.Controls.Add(this.chkEquipZY1);
            this.groupBox3.Location = new System.Drawing.Point(5, 161);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Size = new System.Drawing.Size(402, 114);
            this.groupBox3.TabIndex = 18;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "Excellent Options";
            // 
            // button4
            // 
            this.button4.Location = new System.Drawing.Point(269, 81);
            this.button4.Name = "button4";
            this.button4.Size = new System.Drawing.Size(45, 24);
            this.button4.TabIndex = 13;
            this.button4.Text = "Clear";
            this.button4.UseVisualStyleBackColor = true;
            this.button4.Click += new System.EventHandler(this.button4_Click);
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(179, 81);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(84, 24);
            this.button1.TabIndex = 12;
            this.button1.Text = "Full Options";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // button3
            // 
            this.button3.Location = new System.Drawing.Point(92, 81);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(81, 24);
            this.button3.TabIndex = 11;
            this.button3.Text = "Deselect All";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.button3_Click);
            // 
            // button2
            // 
            this.button2.Location = new System.Drawing.Point(8, 81);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(78, 24);
            this.button2.TabIndex = 10;
            this.button2.Text = "Select All";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            // 
            // chkEquipZY6
            // 
            this.chkEquipZY6.AutoSize = true;
            this.chkEquipZY6.Location = new System.Drawing.Point(213, 60);
            this.chkEquipZY6.Name = "chkEquipZY6";
            this.chkEquipZY6.Size = new System.Drawing.Size(85, 17);
            this.chkEquipZY6.TabIndex = 9;
            this.chkEquipZY6.Text = "Increase HP";
            this.chkEquipZY6.UseVisualStyleBackColor = true;
            // 
            // chkEquipZY4
            // 
            this.chkEquipZY4.AutoSize = true;
            this.chkEquipZY4.Location = new System.Drawing.Point(213, 38);
            this.chkEquipZY4.Name = "chkEquipZY4";
            this.chkEquipZY4.Size = new System.Drawing.Size(98, 17);
            this.chkEquipZY4.TabIndex = 8;
            this.chkEquipZY4.Text = "Dmg. reduction";
            this.chkEquipZY4.UseVisualStyleBackColor = true;
            // 
            // chkEquipZY2
            // 
            this.chkEquipZY2.AutoSize = true;
            this.chkEquipZY2.Location = new System.Drawing.Point(213, 16);
            this.chkEquipZY2.Name = "chkEquipZY2";
            this.chkEquipZY2.Size = new System.Drawing.Size(159, 17);
            this.chkEquipZY2.TabIndex = 7;
            this.chkEquipZY2.Text = "Defense Success Rate 10%";
            this.chkEquipZY2.UseVisualStyleBackColor = true;
            // 
            // chkEquipZY5
            // 
            this.chkEquipZY5.AutoSize = true;
            this.chkEquipZY5.Location = new System.Drawing.Point(16, 60);
            this.chkEquipZY5.Name = "chkEquipZY5";
            this.chkEquipZY5.Size = new System.Drawing.Size(86, 17);
            this.chkEquipZY5.TabIndex = 6;
            this.chkEquipZY5.Text = "Increase MP";
            this.chkEquipZY5.UseVisualStyleBackColor = true;
            // 
            // chkEquipZY3
            // 
            this.chkEquipZY3.AutoSize = true;
            this.chkEquipZY3.Location = new System.Drawing.Point(16, 38);
            this.chkEquipZY3.Name = "chkEquipZY3";
            this.chkEquipZY3.Size = new System.Drawing.Size(86, 17);
            this.chkEquipZY3.TabIndex = 5;
            this.chkEquipZY3.Text = "Reflect dmg.";
            this.chkEquipZY3.UseVisualStyleBackColor = true;
            // 
            // chkEquipZY1
            // 
            this.chkEquipZY1.AutoSize = true;
            this.chkEquipZY1.Location = new System.Drawing.Point(16, 16);
            this.chkEquipZY1.Name = "chkEquipZY1";
            this.chkEquipZY1.Size = new System.Drawing.Size(74, 17);
            this.chkEquipZY1.TabIndex = 4;
            this.chkEquipZY1.Text = "Zen +40%";
            this.chkEquipZY1.UseVisualStyleBackColor = true;
            // 
            // chk380
            // 
            this.chk380.AutoSize = true;
            this.chk380.Location = new System.Drawing.Point(326, 48);
            this.chk380.Name = "chk380";
            this.chk380.Size = new System.Drawing.Size(75, 17);
            this.chk380.TabIndex = 29;
            this.chk380.Text = "380 level?";
            this.chk380.UseVisualStyleBackColor = true;
            // 
            // chkEquipXY
            // 
            this.chkEquipXY.AutoSize = true;
            this.chkEquipXY.Location = new System.Drawing.Point(126, 129);
            this.chkEquipXY.Name = "chkEquipXY";
            this.chkEquipXY.Size = new System.Drawing.Size(50, 17);
            this.chkEquipXY.TabIndex = 17;
            this.chkEquipXY.Text = "Luck";
            this.chkEquipXY.UseVisualStyleBackColor = true;
            // 
            // chkEquipJN
            // 
            this.chkEquipJN.AutoSize = true;
            this.chkEquipJN.Location = new System.Drawing.Point(67, 129);
            this.chkEquipJN.Name = "chkEquipJN";
            this.chkEquipJN.Size = new System.Drawing.Size(45, 17);
            this.chkEquipJN.TabIndex = 16;
            this.chkEquipJN.Text = "Skill";
            this.chkEquipJN.UseVisualStyleBackColor = true;
            // 
            // label30
            // 
            this.label30.AutoSize = true;
            this.label30.Location = new System.Drawing.Point(6, 103);
            this.label30.Name = "label30";
            this.label30.Size = new System.Drawing.Size(36, 13);
            this.label30.TabIndex = 15;
            this.label30.Text = "Level:";
            // 
            // label29
            // 
            this.label29.AutoSize = true;
            this.label29.Location = new System.Drawing.Point(6, 76);
            this.label29.Name = "label29";
            this.label29.Size = new System.Drawing.Size(30, 13);
            this.label29.TabIndex = 14;
            this.label29.Text = "Title:";
            // 
            // label28
            // 
            this.label28.AutoSize = true;
            this.label28.Location = new System.Drawing.Point(6, 49);
            this.label28.Name = "label28";
            this.label28.Size = new System.Drawing.Size(52, 13);
            this.label28.TabIndex = 13;
            this.label28.Text = "Category:";
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(201, 130);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(53, 13);
            this.label1.TabIndex = 24;
            this.label1.Text = "Durability:";
            // 
            // txtDurability
            // 
            this.txtDurability.IsOnlyNumber = true;
            this.txtDurability.Location = new System.Drawing.Point(276, 127);
            this.txtDurability.Name = "txtDurability";
            this.txtDurability.Size = new System.Drawing.Size(39, 20);
            this.txtDurability.TabIndex = 25;
            this.txtDurability.Text = "255";
            this.txtDurability.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            // 
            // cboPlusType
            // 
            this.cboPlusType.DropDownHeight = 206;
            this.cboPlusType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboPlusType.FormattingEnabled = true;
            this.cboPlusType.IntegralHeight = false;
            this.cboPlusType.Location = new System.Drawing.Point(276, 100);
            this.cboPlusType.Name = "cboPlusType";
            this.cboPlusType.Size = new System.Drawing.Size(120, 21);
            this.cboPlusType.TabIndex = 30;
            // 
            // cboPlusLevel
            // 
            this.cboPlusLevel.DropDownHeight = 206;
            this.cboPlusLevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboPlusLevel.FormattingEnabled = true;
            this.cboPlusLevel.IntegralHeight = false;
            this.cboPlusLevel.Items.AddRange(new object[] {
            "+ 0",
            "+ 1",
            "+ 2",
            "+ 3",
            "+ 4",
            "+ 5",
            "+ 6",
            "+ 7",
            "+ 8",
            "+ 9",
            "+10",
            "+11",
            "+12",
            "+13"});
            this.cboPlusLevel.Location = new System.Drawing.Point(276, 46);
            this.cboPlusLevel.Name = "cboPlusLevel";
            this.cboPlusLevel.Size = new System.Drawing.Size(42, 21);
            this.cboPlusLevel.TabIndex = 31;
            // 
            // eee
            // 
            this.eee.AutoSize = true;
            this.eee.Location = new System.Drawing.Point(201, 103);
            this.eee.Name = "eee";
            this.eee.Size = new System.Drawing.Size(59, 13);
            this.eee.TabIndex = 32;
            this.eee.Text = "Enhanced:";
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(201, 49);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(39, 13);
            this.label3.TabIndex = 33;
            this.label3.Text = "Grade:";
            // 
            // chkAllPart
            // 
            this.chkAllPart.AutoSize = true;
            this.chkAllPart.Enabled = false;
            this.chkAllPart.Location = new System.Drawing.Point(326, 21);
            this.chkAllPart.Name = "chkAllPart";
            this.chkAllPart.Size = new System.Drawing.Size(76, 17);
            this.chkAllPart.TabIndex = 35;
            this.chkAllPart.Text = "Matching?";
            this.chkAllPart.UseVisualStyleBackColor = true;
            // 
            // AddNums
            // 
            this.AddNums.IsOnlyNumber = true;
            this.AddNums.Location = new System.Drawing.Point(276, 20);
            this.AddNums.Name = "AddNums";
            this.AddNums.Size = new System.Drawing.Size(42, 20);
            this.AddNums.TabIndex = 38;
            this.AddNums.Text = "1";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(201, 23);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(49, 13);
            this.label2.TabIndex = 37;
            this.label2.Text = "Quantity:";
            // 
            // txtCode
            // 
            this.txtCode.IsOnlyNumber = false;
            this.txtCode.Location = new System.Drawing.Point(3, 464);
            this.txtCode.Name = "txtCode";
            this.txtCode.ReadOnly = true;
            this.txtCode.Size = new System.Drawing.Size(404, 20);
            this.txtCode.TabIndex = 37;
            // 
            // gbXQ
            // 
            this.gbXQ.Controls.Add(this.cbInlay6b);
            this.gbXQ.Controls.Add(this.label11);
            this.gbXQ.Controls.Add(this.label10);
            this.gbXQ.Controls.Add(this.label9);
            this.gbXQ.Controls.Add(this.label8);
            this.gbXQ.Controls.Add(this.label7);
            this.gbXQ.Controls.Add(this.label6);
            this.gbXQ.Controls.Add(this.cbInlay5b);
            this.gbXQ.Controls.Add(this.cbInlay4b);
            this.gbXQ.Controls.Add(this.cbInlay3b);
            this.gbXQ.Controls.Add(this.cbInlay2b);
            this.gbXQ.Controls.Add(this.cbInlay1b);
            this.gbXQ.Location = new System.Drawing.Point(5, 281);
            this.gbXQ.Name = "gbXQ";
            this.gbXQ.Size = new System.Drawing.Size(402, 176);
            this.gbXQ.TabIndex = 38;
            this.gbXQ.TabStop = false;
            this.gbXQ.Text = "Socket Options";
            // 
            // cbInlay6b
            // 
            this.cbInlay6b.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbInlay6b.FormattingEnabled = true;
            this.cbInlay6b.Location = new System.Drawing.Point(94, 149);
            this.cbInlay6b.Name = "cbInlay6b";
            this.cbInlay6b.Size = new System.Drawing.Size(206, 21);
            this.cbInlay6b.TabIndex = 45;
            // 
            // label11
            // 
            this.label11.AutoSize = true;
            this.label11.Location = new System.Drawing.Point(3, 152);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(85, 13);
            this.label11.TabIndex = 44;
            this.label11.Text = "Socket Element:";
            // 
            // label10
            // 
            this.label10.AutoSize = true;
            this.label10.Location = new System.Drawing.Point(3, 125);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(50, 13);
            this.label10.TabIndex = 43;
            this.label10.Text = "Socket 5";
            // 
            // label9
            // 
            this.label9.AutoSize = true;
            this.label9.Location = new System.Drawing.Point(3, 98);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(50, 13);
            this.label9.TabIndex = 42;
            this.label9.Text = "Socket 4";
            // 
            // label8
            // 
            this.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(4, 71);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(50, 13);
            this.label8.TabIndex = 41;
            this.label8.Text = "Socket 3";
            // 
            // label7
            // 
            this.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(4, 44);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(50, 13);
            this.label7.TabIndex = 40;
            this.label7.Text = "Socket 2";
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(3, 17);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(50, 13);
            this.label6.TabIndex = 39;
            this.label6.Text = "Socket 1";
            // 
            // cbInlay5b
            // 
            this.cbInlay5b.DropDownHeight = 206;
            this.cbInlay5b.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbInlay5b.FormattingEnabled = true;
            this.cbInlay5b.IntegralHeight = false;
            this.cbInlay5b.Location = new System.Drawing.Point(94, 122);
            this.cbInlay5b.Name = "cbInlay5b";
            this.cbInlay5b.Size = new System.Drawing.Size(253, 21);
            this.cbInlay5b.TabIndex = 38;
            // 
            // cbInlay4b
            // 
            this.cbInlay4b.DropDownHeight = 206;
            this.cbInlay4b.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbInlay4b.FormattingEnabled = true;
            this.cbInlay4b.IntegralHeight = false;
            this.cbInlay4b.Location = new System.Drawing.Point(94, 95);
            this.cbInlay4b.Name = "cbInlay4b";
            this.cbInlay4b.Size = new System.Drawing.Size(253, 21);
            this.cbInlay4b.TabIndex = 37;
            // 
            // cbInlay3b
            // 
            this.cbInlay3b.DropDownHeight = 206;
            this.cbInlay3b.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbInlay3b.FormattingEnabled = true;
            this.cbInlay3b.IntegralHeight = false;
            this.cbInlay3b.Location = new System.Drawing.Point(94, 68);
            this.cbInlay3b.Name = "cbInlay3b";
            this.cbInlay3b.Size = new System.Drawing.Size(253, 21);
            this.cbInlay3b.TabIndex = 36;
            // 
            // cbInlay2b
            // 
            this.cbInlay2b.DropDownHeight = 206;
            this.cbInlay2b.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbInlay2b.FormattingEnabled = true;
            this.cbInlay2b.IntegralHeight = false;
            this.cbInlay2b.Location = new System.Drawing.Point(94, 41);
            this.cbInlay2b.Name = "cbInlay2b";
            this.cbInlay2b.Size = new System.Drawing.Size(253, 21);
            this.cbInlay2b.TabIndex = 34;
            // 
            // cbInlay1b
            // 
            this.cbInlay1b.DropDownHeight = 206;
            this.cbInlay1b.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbInlay1b.FormattingEnabled = true;
            this.cbInlay1b.IntegralHeight = false;
            this.cbInlay1b.Location = new System.Drawing.Point(94, 14);
            this.cbInlay1b.Name = "cbInlay1b";
            this.cbInlay1b.Size = new System.Drawing.Size(253, 21);
            this.cbInlay1b.TabIndex = 32;
            // 
            // cbZhiye
            // 
            this.cbZhiye.DropDownHeight = 206;
            this.cbZhiye.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbZhiye.FormattingEnabled = true;
            this.cbZhiye.IntegralHeight = false;
            this.cbZhiye.Items.AddRange(new object[] {
            "All",
            "Wizard",
            "Dark Knight",
            "Elf",
            "MAgic Gladiator",
            "Dark Lord",
            "Summoner",
            "Rage Fighter",
            "Grow Lancer"});
            this.cbZhiye.Location = new System.Drawing.Point(67, 19);
            this.cbZhiye.Name = "cbZhiye";
            this.cbZhiye.Size = new System.Drawing.Size(123, 21);
            this.cbZhiye.TabIndex = 40;
            this.cbZhiye.SelectedIndexChanged += new System.EventHandler(this.cboEquipType_SelectedIndexChanged);
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(6, 22);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(35, 13);
            this.label4.TabIndex = 39;
            this.label4.Text = "Class:";
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(201, 76);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(37, 13);
            this.label5.TabIndex = 42;
            this.label5.Text = "Value:";
            // 
            // cbSetVal
            // 
            this.cbSetVal.DropDownHeight = 206;
            this.cbSetVal.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbSetVal.FormattingEnabled = true;
            this.cbSetVal.IntegralHeight = false;
            this.cbSetVal.Items.AddRange(new object[] {
            "0",
            "5",
            "6",
            "9",
            "10"});
            this.cbSetVal.Location = new System.Drawing.Point(276, 73);
            this.cbSetVal.Name = "cbSetVal";
            this.cbSetVal.Size = new System.Drawing.Size(42, 21);
            this.cbSetVal.TabIndex = 43;
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.chkAllPart);
            this.groupBox1.Controls.Add(this.cbZhiye);
            this.groupBox1.Controls.Add(this.cbSetVal);
            this.groupBox1.Controls.Add(this.label4);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Controls.Add(this.label5);
            this.groupBox1.Controls.Add(this.chk380);
            this.groupBox1.Controls.Add(this.eee);
            this.groupBox1.Controls.Add(this.txtDurability);
            this.groupBox1.Controls.Add(this.cboPlusType);
            this.groupBox1.Controls.Add(this.cboEquipLevel);
            this.groupBox1.Controls.Add(this.cboPlusLevel);
            this.groupBox1.Controls.Add(this.cboEquipExt);
            this.groupBox1.Controls.Add(this.AddNums);
            this.groupBox1.Controls.Add(this.label31);
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Controls.Add(this.cboEquipName);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.cboEquipType);
            this.groupBox1.Controls.Add(this.label28);
            this.groupBox1.Controls.Add(this.label29);
            this.groupBox1.Controls.Add(this.chkEquipXY);
            this.groupBox1.Controls.Add(this.label30);
            this.groupBox1.Controls.Add(this.chkEquipJN);
            this.groupBox1.Location = new System.Drawing.Point(5, 3);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(402, 152);
            this.groupBox1.TabIndex = 44;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Item Info";
            // 
            // EquipEditor
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.gbXQ);
            this.Controls.Add(this.txtCode);
            this.Controls.Add(this.groupBox3);
            this.Margin = new System.Windows.Forms.Padding(0);
            this.Name = "EquipEditor";
            this.Size = new System.Drawing.Size(410, 491);
            this.Load += new System.EventHandler(this.EquipEditor_Load);
            this.groupBox3.ResumeLayout(false);
            this.groupBox3.PerformLayout();
            this.gbXQ.ResumeLayout(false);
            this.gbXQ.PerformLayout();
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        public void LoadData()
        {
            try
            {
                this.loadItemTypes(this.itemTypes);
                this.cboEquipType.Items.Clear();
                foreach (EquipItemType itemType in this.itemTypes)
                {
                    this.cboEquipType.Items.Add(itemType);
                }
                this.cboEquipType.SelectedIndex = 0;
                this.cboEquipLevel.SelectedIndex = 0;
                this.cboEquipExt.SelectedIndex = 0;
                this.cbZhiye.SelectedIndex = 0;
                this.cboPlusType.SelectedIndex = 0;
                this.cboPlusLevel.SelectedIndex = 0;
            }
            catch (Exception exception)
            {
                Utils.WarningMessage(string.Concat("Error: Database connection failed：", exception.Message));
            }
        }

        protected bool loadItemNamesByType(IList itemNames, int index, int type)
        {
            bool flag;
            this.itemTypes.Clear();
            this.cboEquipName.Items.Clear();
            try
            {
                for (int i = 0; i < (int)EquipEditor.xItem.Length; i++)
                {
                    if (EquipEditor.xItem[i] != null && EquipEditor.xItem[i].Group == index)
                    {
                        switch (type)
                        {
                            case 1:
                                {
                                    if (EquipEditor.xItem[i].iClassNumber.WIZARD == 0)
                                    {
                                        break;
                                    }
                                    itemNames.Add(frmMain.ByteToString(EquipEditor.xItem[i].Name, 30));
                                    break;
                                }
                            case 2:
                                {
                                    if (EquipEditor.xItem[i].iClassNumber.KNIGHT == 0)
                                    {
                                        break;
                                    }
                                    itemNames.Add(frmMain.ByteToString(EquipEditor.xItem[i].Name, 30));
                                    break;
                                }
                            case 3:
                                {
                                    if (EquipEditor.xItem[i].iClassNumber.ELF == 0)
                                    {
                                        break;
                                    }
                                    itemNames.Add(frmMain.ByteToString(EquipEditor.xItem[i].Name, 30));
                                    break;
                                }
                            case 4:
                                {
                                    if (EquipEditor.xItem[i].iClassNumber.MAGUMSA == 0)
                                    {
                                        break;
                                    }
                                    itemNames.Add(frmMain.ByteToString(EquipEditor.xItem[i].Name, 30));
                                    break;
                                }
                            case 5:
                                {
                                    if (EquipEditor.xItem[i].iClassNumber.DARKLORD == 0)
                                    {
                                        break;
                                    }
                                    itemNames.Add(frmMain.ByteToString(EquipEditor.xItem[i].Name, 30));
                                    break;
                                }
                            case 6:
                                {
                                    if (EquipEditor.xItem[i].iClassNumber.SUMMONER == 0)
                                    {
                                        break;
                                    }
                                    itemNames.Add(frmMain.ByteToString(EquipEditor.xItem[i].Name, 30));
                                    break;
                                }
                            case 7:
                                {
                                    if (EquipEditor.xItem[i].iClassNumber.MONK == 0)
                                    {
                                        break;
                                    }
                                    itemNames.Add(frmMain.ByteToString(EquipEditor.xItem[i].Name, 30));
                                    break;
                                }
                            case 8:
                                {
                                    if (EquipEditor.xItem[i].iClassNumber.LANCER == 0)
                                    {
                                        break;
                                    }
                                    itemNames.Add(frmMain.ByteToString(EquipEditor.xItem[i].Name, 30));
                                    break;
                                }
                            default:
                                {
                                    itemNames.Add(frmMain.ByteToString(EquipEditor.xItem[i].Name, 30));
                                    break;
                                }
                        }
                    }
                }
                flag = true;
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                string[] message = new string[] { "loadItemNamesByType：\nError:", exception.Message, "\nSource:", exception.Source, "\nTrace:", exception.StackTrace };
                Utils.WarningMessage(string.Concat(message));
                return false;
            }
            return flag;
        }

        protected bool loadItemTypes(IList itemTypes)
        {
            bool flag;
            itemTypes.Clear();
            try
            {
                itemTypes.Add(new EquipItemType(0, "Swords"));
                itemTypes.Add(new EquipItemType(1, "Axes"));
                itemTypes.Add(new EquipItemType(2, "Hammers/Maces"));
                itemTypes.Add(new EquipItemType(3, "Spears/Polearms"));
                itemTypes.Add(new EquipItemType(4, "Bows/Crossbows"));
                itemTypes.Add(new EquipItemType(5, "Staffs"));
                itemTypes.Add(new EquipItemType(6, "Shields"));
                itemTypes.Add(new EquipItemType(7, "Helms"));
                itemTypes.Add(new EquipItemType(8, "Armor"));
                itemTypes.Add(new EquipItemType(9, "Pants"));
                itemTypes.Add(new EquipItemType(10, "Gloves"));
                itemTypes.Add(new EquipItemType(11, "Boots"));
                itemTypes.Add(new EquipItemType(12, "Wings/Gems/Seals"));
                itemTypes.Add(new EquipItemType(13, "Amulets/Rings/Other"));
                itemTypes.Add(new EquipItemType(14, "Potions/Consumables"));
                itemTypes.Add(new EquipItemType(15, "Skills/Spells"));
                flag = true;
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                string[] message = new string[] { "itemTypes.Add：\nError:", exception.Message, "\nSource:", exception.Source, "\nTrace:", exception.StackTrace };
                Utils.WarningMessage(string.Concat(message));
                Application.Exit();
                return false;
            }
            return flag;
        }

        [DllImport("USER32.dll", CharSet = CharSet.None, EntryPoint = "SendMessageA", ExactSpelling = false)]
        private static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, string lParam);

        public void SetUIbyCob(EquipItem item)
        {
            this.gbXQ.Enabled = Utils.GetQX(item);
            this.chkAllPart.Enabled = (item.Type < 7 ? false : item.Type <= 11);
            this.chkEquipXY.Enabled = (item.Type < 0 ? false : item.Type <= 11);
            this.cbSetVal.Enabled = this.chkEquipXY.Enabled;
            this.chk380.Enabled = Utils.Get380(item);
            this.chk380.Checked = this.chk380.Enabled;
            this.chkEquipJN.Enabled = Utils.GetJN(item);
            if (item.Type != 5)
            {
                this.txtDurability.Text = EquipEditor.xItem[item.Type * 512 + item.Code].Dur.ToString();
            }
            else
            {
                this.txtDurability.Text = EquipEditor.xItem[item.Type * 512 + item.Code].MagicDur.ToString();
            }
            if (item.Type >= 0 && item.Type <= 5)
            {
                this.setZY(1);
                if (!item.IsFZ)
                {
                    Utils.GetPlusType(this.cboPlusType, 1);
                }
                else
                {
                    Utils.GetPlusType(this.cboPlusType, 3);
                }
            }
            else if (item.Type < 6 || item.Type > 11)
            {
                Utils.GetPlusType(this.cboPlusType, 0);
            }
            else
            {
                this.setZY(2);
                Utils.GetPlusType(this.cboPlusType, 2);
            }
            this.Init_EquipEditor();
            byte itemKindA = EquipEditor.xItem[item.Type * 512 + item.Code].ItemKindA;
            byte itemKindB = EquipEditor.xItem[item.Type * 512 + item.Code].ItemKindB;
            byte itemCategory = EquipEditor.xItem[item.Type * 512 + item.Code].ItemCategory;
            switch (item.Type)
            {
                case 12:
                    {
                        this.cbInlay6b.Items.Clear();
                        if (itemKindA != 8)
                        {
                            for (int i = 0; i < (int)Utils.YGS.Length; i++)
                            {
                                this.cbInlay6b.Items.Add(new ComboBoxItem(Utils.YGS[i], i.ToString()));
                            }
                        }
                        else
                        {
                            if (itemKindB == 0)
                            {
                                this.cbInlay1b.Items.Clear();
                                this.cbInlay1b.Items.Add(new ComboBoxItem("No property", "0"));
                                this.cbInlay2b.Items.Clear();
                                this.cbInlay2b.Items.Add(new ComboBoxItem("No property", "0"));
                                this.cbInlay3b.Items.Clear();
                                this.cbInlay3b.Items.Add(new ComboBoxItem("No property", "0"));
                                this.cbInlay4b.Items.Clear();
                                this.cbInlay4b.Items.Add(new ComboBoxItem("No property", "0"));
                                this.cbInlay5b.Items.Clear();
                                this.cbInlay5b.Items.Add(new ComboBoxItem("No property", "0"));
                            }
                            else if (itemKindB == 43)
                            {
                                this.cbInlay1b.Items.Clear();
                                this.cbInlay1b.Items.Add(new ComboBoxItem("No sockets", "255"));
                                this.cbInlay1b.Items.Add(new ComboBoxItem("Element", "254"));
                                this.cbInlay1b.Items.Add(new ComboBoxItem("Element (Fire)", "0"));
                                this.cbInlay2b.Items.Clear();
                                this.cbInlay2b.Items.Add(new ComboBoxItem("No sockets", "255"));
                                this.cbInlay2b.Items.Add(new ComboBoxItem("Element", "254"));
                                this.cbInlay2b.Items.Add(new ComboBoxItem("Element (Water)", "1"));
                                this.cbInlay3b.Items.Clear();
                                this.cbInlay3b.Items.Add(new ComboBoxItem("No sockets", "255"));
                                this.cbInlay3b.Items.Add(new ComboBoxItem("Element", "254"));
                                this.cbInlay3b.Items.Add(new ComboBoxItem("Element (Earth)", "2"));
                                this.cbInlay4b.Items.Clear();
                                this.cbInlay4b.Items.Add(new ComboBoxItem("No sockets", "255"));
                                this.cbInlay4b.Items.Add(new ComboBoxItem("Element", "254"));
                                this.cbInlay4b.Items.Add(new ComboBoxItem("Element (Wind)", "3"));
                                this.cbInlay5b.Items.Clear();
                                this.cbInlay5b.Items.Add(new ComboBoxItem("No sockets", "255"));
                                this.cbInlay5b.Items.Add(new ComboBoxItem("Element", "254"));
                                this.cbInlay5b.Items.Add(new ComboBoxItem("Element (Darkness)", "4"));
                            }
                            else if (itemKindB == 44)
                            {
                                this.cbInlay1b.Items.Clear();
                                this.cbInlay1b.Items.Add(new ComboBoxItem("None", "255"));
                                this.cbInlay1b.Items.Add(new ComboBoxItem("Property 1 +1", "17"));
                                this.cbInlay1b.Items.Add(new ComboBoxItem("Property 1 +2", "33"));
                                this.cbInlay1b.Items.Add(new ComboBoxItem("Property 1 +3", "49"));
                                this.cbInlay1b.Items.Add(new ComboBoxItem("Property 1 +4", "65"));
                                this.cbInlay1b.Items.Add(new ComboBoxItem("Property 1 +5", "81"));
                                this.cbInlay1b.Items.Add(new ComboBoxItem("Property 1 +6", "97"));
                                this.cbInlay1b.Items.Add(new ComboBoxItem("Property 1 +7", "113"));
                                this.cbInlay1b.Items.Add(new ComboBoxItem("Property 1 +8", "129"));
                                this.cbInlay1b.Items.Add(new ComboBoxItem("Property 1 +9", "145"));
                                this.cbInlay1b.Items.Add(new ComboBoxItem("Property 1 +10", "161"));
                                this.cbInlay2b.Items.Clear();
                                this.cbInlay2b.Items.Add(new ComboBoxItem("None", "255"));
                                this.cbInlay2b.Items.Add(new ComboBoxItem("Property 2 +1", "17"));
                                this.cbInlay2b.Items.Add(new ComboBoxItem("Property 2 +2", "33"));
                                this.cbInlay2b.Items.Add(new ComboBoxItem("Property 2 +3", "49"));
                                this.cbInlay2b.Items.Add(new ComboBoxItem("Property 2 +4", "65"));
                                this.cbInlay2b.Items.Add(new ComboBoxItem("Property 2 +5", "81"));
                                this.cbInlay2b.Items.Add(new ComboBoxItem("Property 2 +6", "97"));
                                this.cbInlay2b.Items.Add(new ComboBoxItem("Property 2 +7", "113"));
                                this.cbInlay2b.Items.Add(new ComboBoxItem("Property 2 +8", "129"));
                                this.cbInlay2b.Items.Add(new ComboBoxItem("Property 2 +9", "145"));
                                this.cbInlay2b.Items.Add(new ComboBoxItem("Property 2 +10", "161"));
                                this.cbInlay3b.Items.Clear();
                                this.cbInlay3b.Items.Add(new ComboBoxItem("None", "255"));
                                this.cbInlay3b.Items.Add(new ComboBoxItem("Property 3 +1", "17"));
                                this.cbInlay3b.Items.Add(new ComboBoxItem("Property 3 +2", "33"));
                                this.cbInlay3b.Items.Add(new ComboBoxItem("Property 3 +3", "49"));
                                this.cbInlay3b.Items.Add(new ComboBoxItem("Property 3 +4", "65"));
                                this.cbInlay3b.Items.Add(new ComboBoxItem("Property 3 +5", "81"));
                                this.cbInlay3b.Items.Add(new ComboBoxItem("Property 3 +6", "97"));
                                this.cbInlay3b.Items.Add(new ComboBoxItem("Property 3 +7", "113"));
                                this.cbInlay3b.Items.Add(new ComboBoxItem("Property 3 +8", "129"));
                                this.cbInlay3b.Items.Add(new ComboBoxItem("Property 3 +9", "145"));
                                this.cbInlay3b.Items.Add(new ComboBoxItem("Property 3 +10", "161"));
                                this.cbInlay4b.Items.Clear();
                                this.cbInlay4b.Items.Add(new ComboBoxItem("None", "255"));
                                this.cbInlay4b.Items.Add(new ComboBoxItem("Property 4 +1", "17"));
                                this.cbInlay4b.Items.Add(new ComboBoxItem("Property 4 +2", "33"));
                                this.cbInlay4b.Items.Add(new ComboBoxItem("Property 4 +3", "49"));
                                this.cbInlay4b.Items.Add(new ComboBoxItem("Property 4 +4", "65"));
                                this.cbInlay4b.Items.Add(new ComboBoxItem("Property 4 +5", "81"));
                                this.cbInlay4b.Items.Add(new ComboBoxItem("Property 4 +6", "97"));
                                this.cbInlay4b.Items.Add(new ComboBoxItem("Property 4 +7", "113"));
                                this.cbInlay4b.Items.Add(new ComboBoxItem("Property 4 +8", "129"));
                                this.cbInlay4b.Items.Add(new ComboBoxItem("Property 4 +9", "145"));
                                this.cbInlay4b.Items.Add(new ComboBoxItem("Property 4 +10", "161"));
                                this.cbInlay5b.Items.Clear();
                                this.cbInlay5b.Items.Add(new ComboBoxItem("None", "255"));
                                this.cbInlay5b.Items.Add(new ComboBoxItem("Property 5 +1", "17"));
                                this.cbInlay5b.Items.Add(new ComboBoxItem("Property 5 +2", "33"));
                                this.cbInlay5b.Items.Add(new ComboBoxItem("Property 5 +3", "49"));
                                this.cbInlay5b.Items.Add(new ComboBoxItem("Property 5 +4", "65"));
                                this.cbInlay5b.Items.Add(new ComboBoxItem("Property 5 +5", "81"));
                                this.cbInlay5b.Items.Add(new ComboBoxItem("Property 5 +6", "97"));
                                this.cbInlay5b.Items.Add(new ComboBoxItem("Property 5 +7", "113"));
                                this.cbInlay5b.Items.Add(new ComboBoxItem("Property 5 +8", "129"));
                                this.cbInlay5b.Items.Add(new ComboBoxItem("Property 5 +9", "145"));
                                this.cbInlay5b.Items.Add(new ComboBoxItem("Property 5 +10", "161"));
                            }
                            this.cbInlay1b.SelectedIndex = 0;
                            this.cbInlay2b.SelectedIndex = 0;
                            this.cbInlay3b.SelectedIndex = 0;
                            this.cbInlay4b.SelectedIndex = 0;
                            this.cbInlay5b.SelectedIndex = 0;
                            for (int j = 0; j < (int)Utils.YSS.Length; j++)
                            {
                                this.cbInlay6b.Items.Add(new ComboBoxItem(Utils.YSS[j], j.ToString()));
                            }
                        }
                        this.cbInlay6b.SelectedIndex = 0;
                        if (itemCategory != 1)
                        {
                            this.setZY(0);
                            this.chkEquipXY.Enabled = false;
                            break;
                        }
                        else if (itemKindB == 23)
                        {
                            this.setZY(0);
                            this.chkEquipXY.Enabled = true;
                            break;
                        }
                        else if (itemKindB == 24 || itemKindB == 27)
                        {
                            this.setZY(3);
                            this.chkEquipXY.Enabled = true;
                            break;
                        }
                        else if (itemKindB == 25 || itemKindB == 28 || itemKindB == 60)
                        {
                            this.setZY(4);
                            this.chkEquipXY.Enabled = true;
                            break;
                        }
                        else
                        {
                            this.setZY(0);
                            this.chkEquipXY.Enabled = false;
                            break;
                        }
                    }
                case 13:
                    {
                        if (itemCategory != 1)
                        {
                            if (itemKindA != 5 || itemKindB != 46 || item.Code != 37)
                            {
                                this.setZY(0);
                                this.cbSetVal.Enabled = false;
                                break;
                            }
                            else
                            {
                                this.setZY(6);
                                this.chkEquipJN.Enabled = true;
                                break;
                            }
                        }
                        else if (itemKindB == 26)
                        {
                            this.setZY(5);
                            this.chkEquipXY.Enabled = true;
                            this.cbSetVal.Enabled = false;
                            break;
                        }
                        else if (itemKindB == 29 || itemKindB == 30)
                        {
                            this.setZY(1);
                            this.cbSetVal.Enabled = true;
                            break;
                        }
                        else if (itemKindB != 31)
                        {
                            this.setZY(0);
                            this.cbSetVal.Enabled = false;
                            break;
                        }
                        else
                        {
                            this.setZY(2);
                            this.cbSetVal.Enabled = true;
                            break;
                        }
                    }
                case 14:
                case 15:
                    {
                        this.setZY(0);
                        break;
                    }
            }
            this.chkEquipZY1.Enabled = this.chkEquipZY1.Text != "No";
            this.chkEquipZY2.Enabled = this.chkEquipZY2.Text != "No";
            this.chkEquipZY3.Enabled = this.chkEquipZY3.Text != "No";
            this.chkEquipZY4.Enabled = this.chkEquipZY4.Text != "No";
            this.chkEquipZY5.Enabled = this.chkEquipZY5.Text != "No";
            this.chkEquipZY6.Enabled = this.chkEquipZY6.Text != "No";
        }

        private void setZY(int type)
        {
            if (type == 0)
            {
                this.chkEquipZY1.Text = "No";
                this.chkEquipZY2.Text = "No";
                this.chkEquipZY3.Text = "No";
                this.chkEquipZY4.Text = "No";
                this.chkEquipZY5.Text = "No";
                this.chkEquipZY6.Text = "No";
                return;
            }
            if (type == 1)
            {
                this.chkEquipZY1.Text = "Increase mana after monster + life/8";
                this.chkEquipZY2.Text = "Increase life after monster + life/8";
                this.chkEquipZY3.Text = "Increase Speed +7";
                this.chkEquipZY4.Text = "Damage +2%";
                this.chkEquipZY5.Text = "Increase Damage + level/20";
                this.chkEquipZY6.Text = "Excellent Damage Rate + 10%";
                return;
            }
            if (type == 2)
            {
                this.chkEquipZY1.Text = "Increase Zen +40%";
                this.chkEquipZY2.Text = "Defense Rate +10%";
                this.chkEquipZY3.Text = "Reflect Damage 5%";
                this.chkEquipZY4.Text = "Damage Decrease 4%";
                this.chkEquipZY5.Text = "Increase MP +4%";
                this.chkEquipZY6.Text = "Increase HP +4%";
                return;
            }
            if (type == 3)
            {
                this.chkEquipZY1.Text = "Withdraw";
                this.chkEquipZY2.Text = "Add mana";
                this.chkEquipZY3.Text = "Ignore";
                this.chkEquipZY4.Text = "Skill values";
                this.chkEquipZY5.Text = "Speed";
                this.chkEquipZY6.Text = "Recovery";
                return;
            }
            if (type == 4)
            {
                this.chkEquipZY1.Text = "Ignore";
                this.chkEquipZY2.Text = "Reflect damage";
                this.chkEquipZY3.Text = "Life regen";
                this.chkEquipZY4.Text = "Mana regen";
                this.chkEquipZY5.Text = "Recovery";
                this.chkEquipZY6.Text = "Recovery";
                return;
            }
            if (type == 5)
            {
                this.chkEquipZY1.Text = "Life +50";
                this.chkEquipZY2.Text = "Mana +50";
                this.chkEquipZY3.Text = "Ignore";
                this.chkEquipZY4.Text = "Add command";
                this.chkEquipZY5.Text = "No";
                this.chkEquipZY6.Text = "No";
                return;
            }
            if (type == 6)
            {
                this.chkEquipZY1.Text = "Black Fenrir";
                this.chkEquipZY2.Text = "Green Fenrir";
                this.chkEquipZY3.Text = "Golden Fenrir";
                this.chkEquipZY4.Text = "No";
                this.chkEquipZY5.Text = "No";
                this.chkEquipZY6.Text = "No";
            }
        }

        public void updateData(EquipItem item)
        {
            item.Level = (byte)this.cboEquipLevel.SelectedIndex;
            item.Ext = this.cboEquipExt.SelectedIndex;
            item.PlusType = (byte)this.cboPlusType.SelectedIndex;
            item.PlusLevel = (this.cboPlusType.SelectedIndex <= 0) ? ((byte)0) : ((byte)this.cboPlusLevel.SelectedIndex);
            item.JN = this.chkEquipJN.Checked && this.chkEquipJN.Enabled;
            item.XY = this.chkEquipXY.Checked && this.chkEquipXY.Enabled;
            item.ZY1 = this.chkEquipZY1.Checked && this.chkEquipZY1.Enabled;
            item.ZY2 = this.chkEquipZY2.Checked && this.chkEquipZY2.Enabled;
            item.ZY3 = this.chkEquipZY3.Checked && this.chkEquipZY3.Enabled;
            item.ZY4 = this.chkEquipZY4.Checked && this.chkEquipZY4.Enabled;
            item.ZY5 = this.chkEquipZY5.Checked && this.chkEquipZY5.Enabled;
            item.ZY6 = this.chkEquipZY6.Checked && this.chkEquipZY6.Enabled;
            item.IsSet = (this.cbSetVal.SelectedIndex > 0) && this.cbSetVal.Enabled;
            item.SetVal = this.cbSetVal.Enabled ? Convert.ToByte(this.cbSetVal.SelectedItem) : ((byte)0);
            item.Is380 = this.chk380.Checked && this.chk380.Enabled;
            item.Durability = Convert.ToByte(this.txtDurability.Text);
            if (this.gbXQ.Enabled)
            {
                item.PlusType = 0;
                item.PlusLevel = 0;
                byte itemKindA = xItem[(item.Type * 0x200) + item.Code].ItemKindA;
                byte itemKindB = xItem[(item.Type * 0x200) + item.Code].ItemKindB;
                byte itemCategory = xItem[(item.Type * 0x200) + item.Code].ItemCategory;
                if (itemKindA == 8)
                {
                    ComboBoxItem selectedItem = (ComboBoxItem)this.cbInlay1b.SelectedItem;
                    item.XQ1 = Convert.ToByte(selectedItem.Value);
                    ComboBoxItem item3 = (ComboBoxItem)this.cbInlay2b.SelectedItem;
                    item.XQ2 = Convert.ToByte(item3.Value);
                    ComboBoxItem item4 = (ComboBoxItem)this.cbInlay3b.SelectedItem;
                    item.XQ3 = Convert.ToByte(item4.Value);
                    ComboBoxItem item5 = (ComboBoxItem)this.cbInlay4b.SelectedItem;
                    item.XQ4 = Convert.ToByte(item5.Value);
                    ComboBoxItem item6 = (ComboBoxItem)this.cbInlay5b.SelectedItem;
                    item.XQ5 = Convert.ToByte(item6.Value);
                    item.YG = (byte)(this.cbInlay6b.SelectedIndex + 0x11);
                }
                else
                {
                    ComboBoxItem item7 = (ComboBoxItem)this.cbInlay1b.SelectedItem;
                    item.XQ1 = Convert.ToByte(item7.Value);
                    ComboBoxItem item8 = (ComboBoxItem)this.cbInlay2b.SelectedItem;
                    item.XQ2 = Convert.ToByte(item8.Value);
                    ComboBoxItem item9 = (ComboBoxItem)this.cbInlay3b.SelectedItem;
                    item.XQ3 = Convert.ToByte(item9.Value);
                    ComboBoxItem item10 = (ComboBoxItem)this.cbInlay4b.SelectedItem;
                    item.XQ4 = Convert.ToByte(item10.Value);
                    ComboBoxItem item11 = (ComboBoxItem)this.cbInlay5b.SelectedItem;
                    item.XQ5 = Convert.ToByte(item11.Value);
                    item.YG = (this.cbInlay6b.SelectedIndex > 0) ? ((byte)(this.cbInlay6b.SelectedIndex - 1)) : ((byte)0xff);
                }
            }
        }

        public void updateUI(EquipItem item)
        {
            try
            {
                this.cbZhiye.SelectedIndex = 0;
                this.cboEquipType.SelectedIndex = item.Type;
                this.cboEquipName.Text = item.Name;
                this.cboEquipLevel.SelectedIndex = item.Level;
                this.cboEquipExt.SelectedIndex = item.Ext;
                if (item.PlusType < this.cboPlusType.Items.Count)
                {
                    this.cboPlusType.SelectedIndex = item.PlusType;
                }
                if (item.PlusLevel < this.cboPlusLevel.Items.Count)
                {
                    this.cboPlusLevel.SelectedIndex = item.PlusLevel;
                }
                this.chkEquipJN.Checked = item.JN;
                this.chkEquipXY.Checked = item.XY;
                this.chkEquipZY1.Checked = item.ZY1;
                this.chkEquipZY2.Checked = item.ZY2;
                this.chkEquipZY3.Checked = item.ZY3;
                this.chkEquipZY4.Checked = item.ZY4;
                this.chkEquipZY5.Checked = item.ZY5;
                this.chkEquipZY6.Checked = item.ZY6;
                this.cbSetVal.SelectedItem = string.Concat(item.SetVal);
                this.chk380.Checked = item.Is380;
                this.txtDurability.Text = Convert.ToString(item.Durability);
                this.txtCode.Text = string.Concat("H:", item.ToString());
                if (this.gbXQ.Enabled)
                {
                    this.cboPlusType.SelectedIndex = 0;
                    this.cboPlusLevel.SelectedIndex = 0;
                    byte itemKindA = EquipEditor.xItem[item.Type * 512 + item.Code].ItemKindA;
                    byte itemKindB = EquipEditor.xItem[item.Type * 512 + item.Code].ItemKindB;
                    byte itemCategory = EquipEditor.xItem[item.Type * 512 + item.Code].ItemCategory;
                    if (itemKindA != 8)
                    {
                        if (item.XQ1 == 255)
                        {
                            this.cbInlay1b.SelectedIndex = 0;
                        }
                        else if (item.XQ1 != 254)
                        {
                            int xQ1 = item.XQ1 % 50;
                            int num = (item.XQ1 - xQ1) / 50;
                            string str = string.Concat(frmMain.ByteToString(EquipEditor.xSocket[xQ1].捞抚, 64), " +", EquipEditor.xSocket[xQ1].饭骇1[num].ToString());
                            this.cbInlay1b.SelectedIndex = EquipEditor.SendMessage(this.cbInlay1b.Handle, 332, IntPtr.Zero, str);
                        }
                        else
                        {
                            this.cbInlay1b.SelectedIndex = 1;
                        }
                        if (item.XQ2 == 255)
                        {
                            this.cbInlay2b.SelectedIndex = 0;
                        }
                        else if (item.XQ2 != 254)
                        {
                            int xQ2 = item.XQ2 % 50;
                            int xQ21 = (item.XQ2 - xQ2) / 50;
                            string str1 = string.Concat(frmMain.ByteToString(EquipEditor.xSocket[xQ2].捞抚, 64), " +", EquipEditor.xSocket[xQ2].饭骇1[xQ21].ToString());
                            this.cbInlay2b.SelectedIndex = EquipEditor.SendMessage(this.cbInlay2b.Handle, 332, IntPtr.Zero, str1);
                        }
                        else
                        {
                            this.cbInlay2b.SelectedIndex = 1;
                        }
                        if (item.XQ3 == 255)
                        {
                            this.cbInlay3b.SelectedIndex = 0;
                        }
                        else if (item.XQ3 != 254)
                        {
                            int xQ3 = item.XQ3 % 50;
                            int xQ31 = (item.XQ3 - xQ3) / 50;
                            string str2 = string.Concat(frmMain.ByteToString(EquipEditor.xSocket[xQ3].捞抚, 64), " +", EquipEditor.xSocket[xQ3].饭骇1[xQ31].ToString());
                            this.cbInlay3b.SelectedIndex = EquipEditor.SendMessage(this.cbInlay3b.Handle, 332, IntPtr.Zero, str2);
                        }
                        else
                        {
                            this.cbInlay3b.SelectedIndex = 1;
                        }
                        if (item.XQ4 == 255)
                        {
                            this.cbInlay4b.SelectedIndex = 0;
                        }
                        else if (item.XQ4 != 254)
                        {
                            int xQ4 = item.XQ4 % 50;
                            int xQ41 = (item.XQ4 - xQ4) / 50;
                            string str3 = string.Concat(frmMain.ByteToString(EquipEditor.xSocket[xQ4].捞抚, 64), " +", EquipEditor.xSocket[xQ4].饭骇1[xQ41].ToString());
                            this.cbInlay4b.SelectedIndex = EquipEditor.SendMessage(this.cbInlay4b.Handle, 332, IntPtr.Zero, str3);
                        }
                        else
                        {
                            this.cbInlay4b.SelectedIndex = 1;
                        }
                        if (item.XQ5 == 255)
                        {
                            this.cbInlay5b.SelectedIndex = 0;
                        }
                        else if (item.XQ5 != 254)
                        {
                            int xQ5 = item.XQ5 % 50;
                            int xQ51 = (item.XQ5 - xQ5) / 50;
                            string str4 = string.Concat(frmMain.ByteToString(EquipEditor.xSocket[xQ5].捞抚, 64), " +", EquipEditor.xSocket[xQ5].饭骇1[xQ51].ToString());
                            this.cbInlay5b.SelectedIndex = EquipEditor.SendMessage(this.cbInlay5b.Handle, 332, IntPtr.Zero, str4);
                        }
                        else
                        {
                            this.cbInlay5b.SelectedIndex = 1;
                        }
                        if (item.YG < 0 || item.YG >= (int)Utils.YGS.Length - 1)
                        {
                            this.cbInlay6b.SelectedIndex = 0;
                        }
                        else
                        {
                            this.cbInlay6b.SelectedIndex = item.YG + 1;
                        }
                    }
                    else
                    {
                        if (itemKindB == 0)
                        {
                            if (item.XQ1 == 255)
                            {
                                this.cbInlay1b.SelectedIndex = 0;
                            }
                            else if (item.XQ1 == 0)
                            {
                                this.cbInlay1b.SelectedIndex = 0;
                            }
                            if (item.XQ2 == 255)
                            {
                                this.cbInlay2b.SelectedIndex = 0;
                            }
                            else if (item.XQ2 == 0)
                            {
                                this.cbInlay2b.SelectedIndex = 0;
                            }
                            if (item.XQ3 == 255)
                            {
                                this.cbInlay3b.SelectedIndex = 0;
                            }
                            else if (item.XQ3 == 0)
                            {
                                this.cbInlay3b.SelectedIndex = 0;
                            }
                            if (item.XQ4 == 255)
                            {
                                this.cbInlay4b.SelectedIndex = 0;
                            }
                            else if (item.XQ4 == 0)
                            {
                                this.cbInlay4b.SelectedIndex = 0;
                            }
                            if (item.XQ5 == 255)
                            {
                                this.cbInlay5b.SelectedIndex = 0;
                            }
                            else if (item.XQ5 == 0)
                            {
                                this.cbInlay5b.SelectedIndex = 0;
                            }
                        }
                        else if (itemKindB == 43)
                        {
                            if (item.XQ1 == 255)
                            {
                                this.cbInlay1b.SelectedIndex = 0;
                            }
                            else if (item.XQ1 != 254)
                            {
                                this.cbInlay1b.SelectedIndex = 2;
                            }
                            else
                            {
                                this.cbInlay1b.SelectedIndex = 1;
                            }
                            if (item.XQ2 == 255)
                            {
                                this.cbInlay2b.SelectedIndex = 0;
                            }
                            else if (item.XQ2 != 254)
                            {
                                this.cbInlay2b.SelectedIndex = 2;
                            }
                            else
                            {
                                this.cbInlay2b.SelectedIndex = 1;
                            }
                            if (item.XQ3 == 255)
                            {
                                this.cbInlay3b.SelectedIndex = 0;
                            }
                            else if (item.XQ3 != 254)
                            {
                                this.cbInlay3b.SelectedIndex = 2;
                            }
                            else
                            {
                                this.cbInlay3b.SelectedIndex = 1;
                            }
                            if (item.XQ4 == 255)
                            {
                                this.cbInlay4b.SelectedIndex = 0;
                            }
                            else if (item.XQ4 != 254)
                            {
                                this.cbInlay4b.SelectedIndex = 2;
                            }
                            else
                            {
                                this.cbInlay4b.SelectedIndex = 1;
                            }
                            if (item.XQ5 == 255)
                            {
                                this.cbInlay5b.SelectedIndex = 0;
                            }
                            else if (item.XQ5 != 254)
                            {
                                this.cbInlay5b.SelectedIndex = 2;
                            }
                            else
                            {
                                this.cbInlay5b.SelectedIndex = 1;
                            }
                        }
                        else if (itemKindB == 44)
                        {
                            if (item.XQ1 == 255)
                            {
                                this.cbInlay1b.SelectedIndex = 0;
                            }
                            else if (item.XQ1 == 17)
                            {
                                this.cbInlay1b.SelectedIndex = 1;
                            }
                            else if (item.XQ1 == 33)
                            {
                                this.cbInlay1b.SelectedIndex = 2;
                            }
                            else if (item.XQ1 == 49)
                            {
                                this.cbInlay1b.SelectedIndex = 3;
                            }
                            else if (item.XQ1 == 65)
                            {
                                this.cbInlay1b.SelectedIndex = 4;
                            }
                            else if (item.XQ1 == 81)
                            {
                                this.cbInlay1b.SelectedIndex = 5;
                            }
                            else if (item.XQ1 == 97)
                            {
                                this.cbInlay1b.SelectedIndex = 6;
                            }
                            else if (item.XQ1 == 113)
                            {
                                this.cbInlay1b.SelectedIndex = 7;
                            }
                            else if (item.XQ1 == 129)
                            {
                                this.cbInlay1b.SelectedIndex = 8;
                            }
                            else if (item.XQ1 != 145)
                            {
                                this.cbInlay1b.SelectedIndex = 10;
                            }
                            else
                            {
                                this.cbInlay1b.SelectedIndex = 9;
                            }
                            if (item.XQ2 == 255)
                            {
                                this.cbInlay2b.SelectedIndex = 0;
                            }
                            else if (item.XQ2 == 17)
                            {
                                this.cbInlay2b.SelectedIndex = 1;
                            }
                            else if (item.XQ2 == 33)
                            {
                                this.cbInlay2b.SelectedIndex = 2;
                            }
                            else if (item.XQ2 == 49)
                            {
                                this.cbInlay2b.SelectedIndex = 3;
                            }
                            else if (item.XQ2 == 65)
                            {
                                this.cbInlay2b.SelectedIndex = 4;
                            }
                            else if (item.XQ2 == 81)
                            {
                                this.cbInlay2b.SelectedIndex = 5;
                            }
                            else if (item.XQ2 == 97)
                            {
                                this.cbInlay2b.SelectedIndex = 6;
                            }
                            else if (item.XQ2 == 113)
                            {
                                this.cbInlay2b.SelectedIndex = 7;
                            }
                            else if (item.XQ2 == 129)
                            {
                                this.cbInlay2b.SelectedIndex = 8;
                            }
                            else if (item.XQ2 != 145)
                            {
                                this.cbInlay2b.SelectedIndex = 10;
                            }
                            else
                            {
                                this.cbInlay2b.SelectedIndex = 9;
                            }
                            if (item.XQ3 == 255)
                            {
                                this.cbInlay3b.SelectedIndex = 0;
                            }
                            else if (item.XQ3 == 17)
                            {
                                this.cbInlay3b.SelectedIndex = 1;
                            }
                            else if (item.XQ3 == 33)
                            {
                                this.cbInlay3b.SelectedIndex = 2;
                            }
                            else if (item.XQ3 == 49)
                            {
                                this.cbInlay3b.SelectedIndex = 3;
                            }
                            else if (item.XQ3 == 65)
                            {
                                this.cbInlay3b.SelectedIndex = 4;
                            }
                            else if (item.XQ3 == 81)
                            {
                                this.cbInlay3b.SelectedIndex = 5;
                            }
                            else if (item.XQ3 == 97)
                            {
                                this.cbInlay3b.SelectedIndex = 6;
                            }
                            else if (item.XQ3 == 113)
                            {
                                this.cbInlay3b.SelectedIndex = 7;
                            }
                            else if (item.XQ3 == 129)
                            {
                                this.cbInlay3b.SelectedIndex = 8;
                            }
                            else if (item.XQ3 != 145)
                            {
                                this.cbInlay3b.SelectedIndex = 10;
                            }
                            else
                            {
                                this.cbInlay3b.SelectedIndex = 9;
                            }
                            if (item.XQ4 == 255)
                            {
                                this.cbInlay4b.SelectedIndex = 0;
                            }
                            else if (item.XQ4 == 17)
                            {
                                this.cbInlay4b.SelectedIndex = 1;
                            }
                            else if (item.XQ4 == 33)
                            {
                                this.cbInlay4b.SelectedIndex = 2;
                            }
                            else if (item.XQ4 == 49)
                            {
                                this.cbInlay4b.SelectedIndex = 3;
                            }
                            else if (item.XQ4 == 65)
                            {
                                this.cbInlay4b.SelectedIndex = 4;
                            }
                            else if (item.XQ4 == 81)
                            {
                                this.cbInlay4b.SelectedIndex = 5;
                            }
                            else if (item.XQ4 == 97)
                            {
                                this.cbInlay4b.SelectedIndex = 6;
                            }
                            else if (item.XQ4 == 113)
                            {
                                this.cbInlay4b.SelectedIndex = 7;
                            }
                            else if (item.XQ4 == 129)
                            {
                                this.cbInlay4b.SelectedIndex = 8;
                            }
                            else if (item.XQ4 != 145)
                            {
                                this.cbInlay4b.SelectedIndex = 10;
                            }
                            else
                            {
                                this.cbInlay4b.SelectedIndex = 9;
                            }
                            if (item.XQ5 == 255)
                            {
                                this.cbInlay5b.SelectedIndex = 0;
                            }
                            else if (item.XQ5 == 17)
                            {
                                this.cbInlay5b.SelectedIndex = 1;
                            }
                            else if (item.XQ5 == 33)
                            {
                                this.cbInlay5b.SelectedIndex = 2;
                            }
                            else if (item.XQ5 == 49)
                            {
                                this.cbInlay5b.SelectedIndex = 3;
                            }
                            else if (item.XQ5 == 65)
                            {
                                this.cbInlay5b.SelectedIndex = 4;
                            }
                            else if (item.XQ5 == 81)
                            {
                                this.cbInlay5b.SelectedIndex = 5;
                            }
                            else if (item.XQ5 == 97)
                            {
                                this.cbInlay5b.SelectedIndex = 6;
                            }
                            else if (item.XQ5 == 113)
                            {
                                this.cbInlay5b.SelectedIndex = 7;
                            }
                            else if (item.XQ5 == 129)
                            {
                                this.cbInlay5b.SelectedIndex = 8;
                            }
                            else if (item.XQ5 != 145)
                            {
                                this.cbInlay5b.SelectedIndex = 10;
                            }
                            else
                            {
                                this.cbInlay5b.SelectedIndex = 9;
                            }
                        }
                        Trace.WriteLine(string.Concat("item.YG : ", item.YG - 17));
                        if (item.YG < 0 || item.YG - 17 >= (int)Utils.YSS.Length)
                        {
                            this.cbInlay6b.SelectedIndex = 0;
                        }
                        else
                        {
                            this.cbInlay6b.SelectedIndex = item.YG - 17;
                        }
                    }
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                string[] message = new string[] { "Error:", exception.Message, "\nSource:", exception.Source, "\nTrace:", exception.StackTrace };
                Utils.WarningMessage(string.Concat(message));
            }
        }
    }
}