/// <summary> /// Gets the associated system icon image for the extension. /// </summary> /// <param name="ext"> /// The file extension. /// </param> public Icon GetSystemFileTypeIcon(string ext) { //Get the icon try { Icon icon = SystemFileType.ReturnIcon(ext.StartsWith(".") == false ? string.Format(".{0}", ext) : ext); return(icon); } catch (Exception) { return(null); //Return nothing } }
/// <summary> /// Returns all the system registered file type extensions. /// </summary> /// <param name="withDot"> /// Optional. Specifies whether to add a dot before the extension (.ext). /// Default is true. /// </param>s public List <string> GetSystemFileTypes(bool withDot = true) { var s = new List <string>(); //Get the icons info SystemFileType.iconsInfo = SystemFileType.GetFileTypeAndIcon(); //Loads file types into list foreach (object objString in SystemFileType.iconsInfo.Keys) { //Check for dot at start s.Add((string)(withDot ? objString : ((string)objString).TrimStart('.'))); } //Return the list return(s); }
/// <summary> /// Gets the associated system icon image for the filter. /// </summary> /// <param name="filter"> /// The filter to get the icon for. /// </param> public Icon GetSystemFileTypeIcon(Filters filter) { List <string> l = this.GetSystemFileTypes(); //Get the icon try { string ext = this.GetFileExtension(filter); //Get file extension Icon icon = SystemFileType.ReturnIcon(ext.StartsWith(".") == false ? string.Format(".{0}", ext) : ext); return(icon); } catch (Exception) { return(null); //Return nothing } }