示例#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);
        }
示例#2
0
 public RendererInfo(string filePath, ref RendererInterop.GFXCapabilityInfo gfxCaps)
 {
     this.FilePath      = filePath;
     this.FileName      = Path.GetFileName(filePath);
     this.MaxAnisotropy = gfxCaps.maxAnisotropy;
     this.Flags         = (RendererFlag)gfxCaps.flags;
     this.Priority      = gfxCaps.priority;
     this.Name          = gfxCaps.rendererName;
 }