Example #1
0
        /// <summary>
        /// Populates the assembler combo box.  Attempts to match the defaultAsm arg with
        /// the entries to configure the initial value.
        /// </summary>
        private void PopulateAssemblerComboBox(string defaultAsm)
        {
            //assemblerComboBox.DisplayMember = "Name";   // show this property

            assemblerComboBox.Items.Clear();
            IEnumerator <AssemblerInfo> iter = AssemblerInfo.GetInfoEnumerator();
            bool foundMatch = false;

            while (iter.MoveNext())
            {
                AssemblerInfo    info    = iter.Current;
                AssemblerVersion version = AssemblerVersionCache.GetVersion(info.AssemblerId);
                AsmComboItem     item    = new AsmComboItem(info, version);
                assemblerComboBox.Items.Add(item);
                if (item.AssemblerId.ToString() == defaultAsm)
                {
                    Debug.WriteLine("matched current " + defaultAsm);
                    assemblerComboBox.SelectedItem = item;
                    foundMatch = true;
                }
            }
            if (!foundMatch)
            {
                // Need to do this or box will show empty.
                assemblerComboBox.SelectedIndex = 0;
            }
        }
        /// <summary>
        /// Queries the versions from all known assemblers, replacing any previously held data.
        /// </summary>
        public static void QueryVersions()
        {
            IEnumerator <AssemblerInfo> iter = AssemblerInfo.GetInfoEnumerator();

            while (iter.MoveNext())
            {
                AssemblerInfo.Id id = iter.Current.AssemblerId;
                if (id == AssemblerInfo.Id.Unknown)
                {
                    continue;
                }

                AssemblerVersion vers = null;
                IAssembler       asm  = AssemblerInfo.GetAssembler(id);
                if (asm != null)
                {
                    vers = asm.QueryVersion();
                }

                Debug.WriteLine("Asm version query: " + id + "=" + vers);
                sVersions[id] = vers;
            }

            sQueried = true;
        }