/// <summary> /// Gets the instance of a specific language descriptor by specifying a file. /// </summary> /// <param name="path">The file to get the language from.</param> /// <returns>A language descriptor determined by the file's extension, or null if none can be found.</returns> public static LanguageDescriptor GetLanguageByPath(string path) { string extension = Path.GetExtension(path); var descriptor = RegisteredLanguages.FirstOrDefault(x => !x.SupportAnyExtension && x.FileExtensions.Contains(extension.ToLower())); if (descriptor == null) { return(GetLanguage <PlainTextLanguage>()); } return(descriptor); }
/// <summary> /// Gets the first occurance of a project descriptor that matches the given predicate. /// </summary> /// <param name="predicate">The predicate to match.</param> /// <returns>A project descriptor matching the given predicate.</returns> public static ProjectDescriptor GetDescriptor(Func <ProjectDescriptor, bool> predicate) { return(ProjectDescriptors.FirstOrDefault(predicate)); }
public static T GetLayout <T>() where T : EditorLayoutData { return(RegisteredLayouts.FirstOrDefault(x => x is T) as T); }
/// <summary> /// Gets a description by its identifier. /// </summary> /// <param name="id">The identifier of the description to look for.</param> /// <returns>A descriptor with an identifier specified in <paramref name="id"/>, or null if none can be found.</returns> public AppearanceDescription GetDescriptionById(string id) { return(Descriptions.FirstOrDefault(x => x.ID == id)); }