public static IRigelGfxContext GetGfxContext(GraphicsAPIEnum curGraphics, PlatformEnum platform, string contextName = null) { bool specificContext = !string.IsNullOrEmpty(contextName); if (specificContext) { if (s_gfxContextTypes.ContainsKey(contextName)) { var attr = s_gfxContextTypes[contextName]; if (platform == attr.SupportPlatform && curGraphics == attr.SupportGraphics) { return((IRigelGfxContext)Activator.CreateInstance(attr.ContextType)); } } } foreach (var attr in s_gfxContextTypes.Values) { if (platform == attr.SupportPlatform && curGraphics == attr.SupportGraphics) { return((IRigelGfxContext)Activator.CreateInstance(attr.ContextType)); } } return(null); }
public RigelGfxContextAttribute(string contextName, Type contextType, GraphicsAPIEnum supportGraphics, PlatformEnum supportPlatform) { this.ContextName = contextName; this.ContextType = contextType; this.SupportGraphics = supportGraphics; this.SupportPlatform = supportPlatform; }