public static bool TryConvert(this ExtensionsPreset preset, out IReadOnlyList <string> inclusions) { switch (preset) { case ExtensionsPreset.Documents: inclusions = new[] { "doc", "docx", "txt", "rtf", "tex", "csv", "pps", "ppsx", "ppt", "pptx", "xls", "xlsx", "xlr", "odt", "pdf" }; return(true); case ExtensionsPreset.Images: inclusions = new[] { "ai", "bmp", "gif", "ico", "jpeg", "jpg", "png", "ps", "psd", "svg", "tif", "tiff", "gif", "tga", "yuv" }; return(true); case ExtensionsPreset.Music: inclusions = new[] { "aif", "cda", "mid", "midi", "mp3", "mpa", "ogg", "wav", "wma", "wpl", "flac", "iff", "m3u", "m4a" }; return(true); case ExtensionsPreset.Videos: inclusions = new[] { "3g2", "3gp", "avi", "flv", "h264", "m4v", "mkv", "mov", "mp4", "mpg", "mpeg", "rm", "swf", "vob", "wmv", "asf", "rm", "srt" }; return(true); case ExtensionsPreset.Code: inclusions = new[] { "c", "class", "cpp", "cc", "cu", "cs", "h", "java", "sh", "swift", "vb", "rb", "asp", "aspx", "css", "htm", "html", "js", "jsp", "php", "xml", "xaml", "lua", "m", "pl", "py", "pyc", "sh" }; return(true); default: inclusions = default; return(false); } }
/// <summary> /// Returns a list of file extensions for a given preset /// </summary> /// <param name="preset">The source preset to convert</param> public static IReadOnlyList <string> Convert(ExtensionsPreset preset) { switch (preset) { case ExtensionsPreset.Documents: return(new[] { "doc", "docx", "txt", "rtf", "tex", "csv", "pps", "ppsx", "ppt", "pptx", "xls", "xlsx", "xlr", "odt", "pdf" }); case ExtensionsPreset.Images: return(new[] { "ai", "bmp", "gif", "ico", "jpeg", "jpg", "png", "ps", "psd", "svg", "tif", "tiff", "gif", "tga", "yuv" }); case ExtensionsPreset.Audio: return(new[] { "aif", "cda", "mid", "midi", "mp3", "mpa", "ogg", "wav", "wma", "wpl", "flac", "iff", "m3u", "m4a" }); case ExtensionsPreset.Video: return(new[] { "3g2", "3gp", "avi", "flv", "h264", "m4v", "mkv", "mov", "mp4", "mpg", "mpeg", "rm", "swf", "vob", "wmv", "asf", "rm", "srt" }); case ExtensionsPreset.Code: return(new[] { "c", "class", "cpp", "cs", "h", "java", "sh", "swift", "vb", "rb", "asp", "aspx", "css", "htm", "html", "js", "jsp", "php", "xml", "xaml", "lua", "m", "pl", "py", "pyc", "sh" }); default: throw new ArgumentOutOfRangeException(nameof(preset), preset, "Invalid preset"); } }
public static bool TryExpand(this ExtensionsPreset preset, out (IReadOnlyList <string> Exclusions, IReadOnlyList <string> Directories) expansion)