Ejemplo n.º 1
0
        public static List <RendererInfo> GetCompatibleRenderers(string gamePath)
        {
            var dir = new DirectoryInfo(
                Path.GetDirectoryName(gamePath));
            var capabilities = new List <RendererInfo>();

            // Search current directory for compatible renderers:
            foreach (FileInfo file in dir.GetFiles("gg_*.dll"))
            {
                try
                {
                    // Make interop call to native renderer DLLs to get capability info
                    var    interopCaps = new RendererInterop.GFXCapabilityInfo();
                    string path        = Path.Combine(file.DirectoryName, file.Name);
                    if (GetRendererCapabilities(path, ref interopCaps) && interopCaps.priority >= 0)
                    {
                        RendererInfo caps = new RendererInfo(path, ref interopCaps);
                        capabilities.Add(caps);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            return(capabilities);
        }
Ejemplo n.º 2
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            RendererInfo other = obj as RendererInfo;

            if (other != null)
            {
                return(this.Priority.CompareTo(other.Priority));
            }
            else
            {
                throw new ArgumentException();
            }
        }
Ejemplo n.º 3
0
        private void PopulateRenderers()
        {
            this.cmbRenderer.Items.Clear();
            this.cmbRenderer.Items.AddRange(
                GameSettings.CompatibleRenderers
                .Disambiguate()
                .ToList()
                .ToArray());

            RendererInfo renderer = GameSettings.CompatibleRenderers.Find(
                r => StringComparer.OrdinalIgnoreCase.Compare(Path.GetFileName(r.FilePath), GameSettings.Get <string>(RegistryKeys.Renderer)) == 0);

            if (renderer != null)
            {
                this.cmbRenderer.SelectedItem = renderer;
            }
            else
            {
                renderer = GameSettings.CompatibleRenderers.Find(r => r.Name == "DirectX 7");
                this.cmbRenderer.SelectedItem = renderer;
            }
        }