@@ -9,45 +9,59 @@ namespace Zhai.PictureView
99{
1010 internal static class PictureSupport
1111 {
12- internal static string [ ] All { get ; } = new string [ ] {
13-
14- // Standards
15- ".jpg" , ".jpeg" , ".jpe" , ".png" , ".bmp" , ".tif" , ".tiff" , ".gif" , ".ico" , ".jfif" , ".webp" , ".wbmp" ,
12+ internal static string [ ] JPEG { get ; } = new string [ ] {
13+ ".jpg" , ".jpeg"
14+ } ;
1615
17- // Non-standards
16+ internal static string [ ] PortableNetworkGraphic { get ; } = new string [ ] {
17+ ".png"
18+ } ;
1819
19- // Photoshop
20- ".psd" , ".psb" ,
20+ internal static string [ ] GraphicsInterchangeFormat { get ; } = new string [ ] {
21+ ".gif"
22+ } ;
2123
22- // Pfim
23- ".tga" , ".dds" ,
24+ internal static string [ ] Icon { get ; } = new string [ ] {
25+ ".ico"
26+ } ;
2427
25- // Vector
26- ".svg " , // Maybe add svgz at some point
27- ".xcf" ,
28+ internal static string [ ] Photoshop { get ; } = new string [ ] {
29+ ".psd " , ".psb"
30+ } ;
2831
29- // Camera
30- ".3fr " , ".arw" , ".cr2" , ".crw" , ".dcr" , ".dng" , ".erf" , ".kdc" , ".mdc" , ".mef" , ".mos" , ".mrw" , ".nef" , ".nrw" , ".orf" ,
31- ".pef" , ".raf" , ".raw" , ".rw2" , ".srf" , ".x3f" ,
32+ internal static string [ ] Vector { get ; } = new string [ ] {
33+ ".svg " , ".svgz"
34+ } ;
3235
33- // Others
34- ".pgm" , ".hdr" , ".cut" , ".exr" , ".dib" , ".heic" , ".emf" , ".wmf" , ".wpg" , ".pcx" , ".xbm" , ".xpm"
36+ internal static string [ ] Camera { get ; } = new string [ ] {
37+ ".3fr" , ".arw" , ".cr2" , ".cr3" , ".crw" , ".dcr" , ".dng" , ".erf" , ".kdc" , ".mdc" , ".mef" , ".mos" , ".mrw" ,
38+ ".nef" , ".nrw" , ".orf" , ".pef" , ".raf" , ".raw" , ".rw2" , ".srf" , ".x3f" ,
39+ } ;
3540
41+ internal static string [ ] Others { get ; } = new string [ ] {
42+ ".jpe" , ".bmp" , ".jfif" , ".webp" , ".wbmp" ,
43+ ".tif" , ".tiff" , ".dds" , ".tga" , ".heic" , ".heif" , ".hdr" , ".xcf" , ".jxl" , ".jp2" ,
44+ ".b64" ,
45+ ".pgm" , ".ppm" , ".cut" , ".exr" , ".dib" , ".emf" , ".wmf" , ".wpg" , ".pcx" , ".xbm" , ".xpm" ,
3646 } ;
3747
38- internal static string AllSupported = String . Join ( ";" , All . Select ( t => $ "*{ t } ") ) ;
48+ internal static string [ ] All { get ; } = ( new List < IEnumerable < string > > { JPEG , PortableNetworkGraphic , GraphicsInterchangeFormat , Icon , Photoshop , Vector , Camera , Others } ) . Aggregate ( ( x , y ) => x . Concat ( y ) ) . ToArray ( ) ;
49+
50+ internal static string ToFilter ( this IEnumerable < string > strings )
51+ {
52+ return String . Join ( ";" , strings . Select ( t => $ "*{ t } ") ) ;
53+ }
3954
4055 internal static string Filter { get ; } =
41- $@ "All Supported ({ AllSupported } )|{ AllSupported } |
42- JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|
43- Portable Network Graphic (*.png)|*.png|
44- Graphics Interchange Format (*.gif)|*.gif|
45- Icon (*.ico)|*.ico|
46- Photoshop (*.psd;*.psb)|*.psd;*.psb|
47- Pfim (*.tga;*.dds)|*.tga;*.dds|
48- Vector (*.svg;*.xcf)|*.svg;*.xcf|
49- Camera (*.3fr;*.arw;*.cr2;*.crw;*.dcr;*.dng;*.erf;*.kdc;*.mdc;*.mef;*.mos;*.mrw;*.nef;*.nrw;*.orf;*.pef;*.raf;*.raw;*.rw2;*.srf;*.x3f)|*.3fr;*.arw;*.cr2;*.crw;*.dcr;*.dng;*.erf;*.kdc;*.mdc;*.mef;*.mos;*.mrw;*.nef;*.nrw;*.orf;*.pef;*.raf;*.raw;*.rw2;*.srf;*.x3f|
50- Other (*.jpe;*.tif;*.jfif;*.webp;*.wbmp;*.tiff;*.wmf;*.pgm;*.hdr;*.cut;*.exr;*.dib;*.heic;*.emf;*.wpg;*.pcx;*.xbm;*.xpm)|*.jpe;*.tif;*.jfif;*.webp;*.wbmp;*.tiff;*.wmf;*.pgm;*.hdr;*.cut;*.exr;*.dib;*.heic;*.emf;*.wpg;*.pcx;*.xbm;*.xpm|
56+ $@ "All Supported ({ All . ToFilter ( ) } )|{ All . ToFilter ( ) } |
57+ JPEG ({ GraphicsInterchangeFormat . ToFilter ( ) } )|{ Icon . ToFilter ( ) } |
58+ Portable Network Graphic ({ PortableNetworkGraphic . ToFilter ( ) } )|{ PortableNetworkGraphic . ToFilter ( ) } |
59+ Graphics Interchange Format ({ GraphicsInterchangeFormat . ToFilter ( ) } )|{ GraphicsInterchangeFormat . ToFilter ( ) } |
60+ Icon ({ Icon . ToFilter ( ) } )|{ Icon . ToFilter ( ) } |
61+ Photoshop ({ Photoshop . ToFilter ( ) } )|{ Photoshop . ToFilter ( ) } |
62+ Vector ({ Vector . ToFilter ( ) } )|{ Vector . ToFilter ( ) } |
63+ Camera ({ Camera . ToFilter ( ) } )|{ Camera . ToFilter ( ) } |
64+ Others ({ Others . ToFilter ( ) } )|{ Others . ToFilter ( ) } |
5165All Files (*.*)|*.*" ;
5266
5367 internal static bool IsSupported ( string filename ) => All . Contains ( Path . GetExtension ( filename ) . ToLower ( ) ) ;
0 commit comments