Ejemplo n.º 1
0
        private void btnLookup_Click(object sender, EventArgs e)
        {
            string strID = txtID.Text;

            if (string.IsNullOrEmpty(strID))
            {
                MessageBox.Show(this, "ID Field is empty.  Please specify a string ID to find.", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            uint uiID;

            if (!uint.TryParse(strID, NumberStyles.HexNumber, null, out uiID))
            {
                MessageBox.Show(this, "Unable to parse string id", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                StringHolder holder = strings.FirstOrDefault(a => a.ID == uiID);
                if (holder != null)
                {
                    SetSelectedItem(holder);
                }
            }
        }
Ejemplo n.º 2
0
        public override void UpdateShortDescription()
        {
            if (Name == "REFR") // temporary hack for references
            {
                var    edid = SubRecords.FirstOrDefault(x => x.Name == "EDID");
                string desc = (edid != null) ? string.Format(" ({0})", edid.GetStrData()) : "";
                //var name = SubRecords.FirstOrDefault( x => x.Name == "NAME" );
                var data = SubRecords.FirstOrDefault(x => x.Name == "DATA");
                if (data != null)
                {
                    desc = string.Format(" [{1},{2}]\t{0}",
                                         desc, (int)(data.GetValue <float>(0) / 4096.0f),
                                         (int)(data.GetValue <float>(4) / 4096.0f)
                                         );
                }
                descriptiveName = desc;
            }
            else if (Name == "ACHR") // temporary hack for references
            {
                var    edid = SubRecords.FirstOrDefault(x => x.Name == "EDID");
                string desc = (edid != null) ? string.Format(" ({0})", edid.GetStrData()) : "";
                var    data = SubRecords.FirstOrDefault(x => x.Name == "DATA");
                if (data != null)
                {
                    desc = string.Format(" [{1},{2}]\t{0}",
                                         desc, (int)(data.GetValue <float>(0) / 4096.0f),
                                         (int)(data.GetValue <float>(4) / 4096.0f)
                                         );
                }
                descriptiveName = desc;
            }
            else if (Name == "CELL")
            {
                var    edid = SubRecords.FirstOrDefault(x => x.Name == "EDID");
                string desc = (edid != null) ? desc = " (" + edid.GetStrData() + ")" : "";

                var xclc = SubRecords.FirstOrDefault(x => x.Name == "XCLC");
                if (xclc != null)
                {
                    desc = string.Format(" [{1:F0},{2:F0}]\t{0}",
                                         desc, xclc.GetValue <int>(0), xclc.GetValue <int>(4)
                                         );
                }
                else
                {
                    desc = string.Format(" [Intr]\t{0}", desc);
                }
                descriptiveName = desc;
            }
            else
            {
                var edid = SubRecords.FirstOrDefault(x => x.Name == "EDID");
                if (edid != null)
                {
                    descriptiveName = " (" + edid.GetStrData() + ")";
                }
                else
                {
                    descriptiveName = "";
                }
            }
        }