// --------------------------------------------------- \\
        // -----------------Display Methods------------------- \\
        // --------------------------------------------------- \\
        //  Display the event's name, offset and parameters.
        public void DisplayEvent(Event eventData)
        {
            lstParameters.Items.Clear();
            cboType.SelectedIndex = -1;
            cboType.Text = "";
            cboType.Enabled = false;
            lblParamDescription.Text = "No Description Available.";
            for (int i = 0; i < typeDisp.Length; i++)
                typeDisp[i].Visible = false;

            paramData = p.GetParameterInfo(eventData.eventId);
            lblEventName.Text = p.GetEventInfo(eventData.eventId).name;
            lblEventId.Text = eventData.eventId;
            lblParameterListOffset.Text = "0x" + p.Hex(eventData.pParameters);

            for (int i = 0; i < eventData.lParameters; i++)
                lstParameters.Items.Add(paramData.GetName(i));
        }
        //  Standard setup procedure upon starting up.
        public void Setup()
        {
            StreamReader sr = null;

            //  Read known attributes and their descriptions.
            try { sr = new StreamReader(Application.StartupPath + "/Data/Attributes.txt"); }
            catch { MessageBox.Show("File Attributes.txt not found."); }
            if (sr != null)
            {
                for (int i = 0; !sr.EndOfStream && i <= FromWord(0x2E0); i++)
                {
                    Array.Resize<InfoAttribute>(ref iAttributes, i + 1);
                    iAttributes[i] = new InfoAttribute();
                    iAttributes[i].name = sr.ReadLine();
                    iAttributes[i].description = sr.ReadLine();
                    iAttributes[i].type = long.Parse(sr.ReadLine());
                    if (iAttributes[i].description == "")
                        iAttributes[i].description = "No Description Available.";

                    sr.ReadLine();
                    Graphics g = this.CreateGraphics();
                    Rectangle rect = new Rectangle(10, 10, 150, 150);
                    PaintEventArgs e = new PaintEventArgs(g, rect);
                    e.Graphics.DrawRectangle(Pens.Red, rect);

                }
                sr.Close();
                sr = null;
            }

            //  Read known events and their descriptions.
            try { sr = new StreamReader(Application.StartupPath + "/Data/Events.txt"); }
            catch { MessageBox.Show("File Events.txt not found."); }
            if (sr != null)
            {
                for (int i = 0; !sr.EndOfStream; i++)
                {
                    Array.Resize<InfoEvent>(ref iEvents, i + 1);
                    iEvents[i] = new InfoEvent();
                    iEvents[i].idNumber = sr.ReadLine();
                    iEvents[i].name = sr.ReadLine();
                    iEvents[i].description = sr.ReadLine();
                    iEvents[i].SetDfltParameters(sr.ReadLine());
                    sr.ReadLine();
                }
                sr.Close();
                sr = null;
            }

            //  Read known parameters and their descriptions.
            try { sr = new StreamReader(Application.StartupPath + "/Data/Parameters.txt"); }
            catch { MessageBox.Show("File Parameters.txt not found."); }
            if (sr != null)
            {
                for (int i = 0; !sr.EndOfStream; i++)
                {
                    Array.Resize<InfoParameter>(ref iParameters, i + 1);
                    iParameters[i] = new InfoParameter();
                    iParameters[i].idNumber = sr.ReadLine();

                    for (int i2 = 0; ; i2++)
                    {
                        string name = sr.ReadLine();
                        if (name == null) name = "";

                        if (name != "")
                        {
                            Array.Resize<string>(ref iParameters[i].name, i2 + 1);
                            Array.Resize<string>(ref iParameters[i].description, i2 + 1);
                            iParameters[i].name[i2] = name;
                            iParameters[i].description[i2] = sr.ReadLine();
                        }
                        if (name == "")
                            break;
                    }

                }
                sr.Close();
                sr = null;
            }

            //  Read the list containing the syntax to display each event with.
            try { sr = new StreamReader(Application.StartupPath + "/Data/EventSyntax.txt"); }
            catch { MessageBox.Show("File EventSyntax.txt not found."); }
            if (sr != null)
            {
                for (int i = 0; !sr.EndOfStream; i++)
                {
                    string syntax = "";
                    Array.Resize(ref iEventSyntax, i + 1);
                    iEventSyntax[i] = new InfoEventSyntax();
                    iEventSyntax[i].idNumber = sr.ReadLine();
                    syntax = sr.ReadLine();
                    while (syntax != "" && syntax != null)
                    {
                        iEventSyntax[i].syntax += syntax;
                        syntax = sr.ReadLine();
                    }
                }
                sr.Close();
                sr = null;
            }

            //  Read the list of Event Requirements.
            try { sr = new StreamReader(Application.StartupPath + "/Data/Requirements.txt"); }
            catch { MessageBox.Show("File Attributes.txt not found."); }
            if (sr != null)
            {
                for (int i = 0; !sr.EndOfStream; i++)
                {
                    Array.Resize<string>(ref iRequirements, i + 1);
                    iRequirements[i] = sr.ReadLine();
                }
                sr.Close();
                sr = null;
            }

            // Read the list of Air Ground Stats.
            try { sr = new StreamReader(Application.StartupPath + "/Data/AirGroundStats.txt"); }
            catch { MessageBox.Show("File AirGroundStats.txt not found."); }
            if (sr != null)
            {
                for (int i = 0; !sr.EndOfStream; i++)
                {
                    Array.Resize<string>(ref iAirGroundStats, i + 1);
                    iAirGroundStats[i] = sr.ReadLine();
                }
                sr.Close();
                sr = null;
            }

            // Read the list of Collision Stats.
            try { sr = new StreamReader(Application.StartupPath + "/Data/CollisionStats.txt"); }
            catch { MessageBox.Show("File CollisionStats.txt not found."); }
            if (sr != null)
            {
                for (int i = 0; !sr.EndOfStream; i++)
                {
                    Array.Resize<string>(ref iCollisionStats, i + 1);
                    iCollisionStats[i] = sr.ReadLine();
                }
                sr.Close();
                sr = null;
            }

            //  Setup Attribute Table.
            attributes.Columns.Add("Name");
            attributes.Columns.Add("Value");
            attributes.Columns[0].ReadOnly = true;
            dtgrdAttributes.DataSource = attributes;

            for (int i = 0; i <= FromWord(0x2E0); i++)
            {
                if (i < iAttributes.Length) { attributes.Rows.Add(iAttributes[i].name); }
                else { attributes.Rows.Add("0x" + Hex(ToWord(i))); }
            }

            //  For ease of access, each form contains a reference to the main form in order
            //  to use the methods and variables in the main form.
            frmModifyEvent.p = this;
            frmEventList.p = this;
            frmAnimFlags.p = this;
        }