private void DoAllCoresTree(CoreInfo current_ci)
        {
            CoreTree.ImageList = new ImageList();
            CoreTree.ImageList.Images.Add("Good", Properties.Resources.GreenCheck);
            CoreTree.ImageList.Images.Add("Bad", Properties.Resources.ExclamationRed);
            CoreTree.ImageList.Images.Add("Unknown", Properties.Resources.RetroQuestion);

            var possiblecoretypes =
                Assembly
                .Load("BizHawk.Emulation.Cores")
                .GetTypes()
                .Where(t => typeof(IEmulator).IsAssignableFrom(t) && !t.IsAbstract)
                .Select(t => new
            {
                Type           = t,
                CoreAttributes = (CoreAttributes)t.GetCustomAttributes(typeof(CoreAttributes), false).First()
            })
                .OrderByDescending(t => t.CoreAttributes.Released)
                .ThenBy(t => t.CoreAttributes.CoreName)
                .ToList();

            toolStripStatusLabel1.Text = string.Format("Total: {0} Released: {1} Profiled: {2}",
                                                       possiblecoretypes.Count,
                                                       KnownCores.Values.Count(c => c.Released),
                                                       KnownCores.Count);

            CoreTree.Nodes.Clear();
            CoreTree.BeginUpdate();

            foreach (var ci in KnownCores.Values)
            {
                var coreNode = CreateCoreTree(ci);

                if (ci.CoreName == current_ci.CoreName)
                {
                    coreNode.Expand();
                }
                CoreTree.Nodes.Add(coreNode);
            }

            foreach (var t in possiblecoretypes)
            {
                if (!KnownCores.ContainsKey(t.CoreAttributes.CoreName))
                {
                    string img      = "Unknown";
                    var    coreNode = new TreeNode
                    {
                        Text             = t.CoreAttributes.CoreName + (t.CoreAttributes.Released ? string.Empty : " (UNRELEASED)"),
                        ForeColor        = t.CoreAttributes.Released ? Color.Black : Color.DarkGray,
                        ImageKey         = img,
                        SelectedImageKey = img,
                        StateImageKey    = img
                    };
                    CoreTree.Nodes.Add(coreNode);
                }
            }

            CoreTree.EndUpdate();
        }
Пример #2
0
        private void DoAllCoresTree(CoreInfo current_ci)
        {
            CoreTree.ImageList = new ImageList();
            CoreTree.ImageList.Images.Add("Good", Properties.Resources.GreenCheck);
            CoreTree.ImageList.Images.Add("Bad", Properties.Resources.ExclamationRed);
            CoreTree.ImageList.Images.Add("Unknown", Properties.Resources.RetroQuestion);

            var possibleCoreTypes = CoreInventory.Instance.SystemsFlat
                                    .OrderByDescending(core => core.CoreAttr.Released)
                                    .ThenBy(core => core.Name)
                                    .ToList();

            toolStripStatusLabel1.Text = $"Total: {possibleCoreTypes.Count} Released: {KnownCores.Values.Count(c => c.Released)} Profiled: {KnownCores.Count}";

            CoreTree.Nodes.Clear();
            CoreTree.BeginUpdate();

            foreach (var ci in KnownCores.Values)
            {
                var coreNode = CreateCoreTree(ci);

                if (ci.CoreName == current_ci.CoreName)
                {
                    coreNode.Expand();
                }
                CoreTree.Nodes.Add(coreNode);
            }

            foreach (var core in possibleCoreTypes)
            {
                if (!KnownCores.ContainsKey(core.Name))
                {
                    string img      = "Unknown";
                    var    coreNode = new TreeNode
                    {
                        Text             = core.Name + (core.CoreAttr.Released ? "" : " (UNRELEASED)"),
                        ForeColor        = core.CoreAttr.Released ? Color.Black : Color.DarkGray,
                        ImageKey         = img,
                        SelectedImageKey = img,
                        StateImageKey    = img
                    };
                    CoreTree.Nodes.Add(coreNode);
                }
            }

            CoreTree.EndUpdate();
        }