public static bool TryParseName(string name, out FileTypeInfo result) { if (name == null) { result = null; return(false); } var ident = name.ToLower().TrimStart('.'); result = Types.FirstOrDefault(i => i.Extension == ident || i.Name == ident); return(result != null); }
public static bool TryParseFromExtension(string path, out FileTypeInfo result) { return(TryParseName(System.IO.Path.GetExtension(path), out result)); }