1919var markdownText = new StringBuilder ( ) ;
2020
2121foreach ( var file in Directory . EnumerateFiles ( folder , "*.wmf" ) )
22+ {
23+ ConvertImageFile ( file ) ;
24+ }
25+
26+ var markdownFile = Path . Join ( outputFolder , "README.md" ) ;
27+ File . WriteAllText ( markdownFile , markdownText . ToString ( ) ) ;
28+
29+ Console . WriteLine ( "Hello, World!" ) ;
30+
31+ void ConvertImageFile ( string file )
2232{
2333 var fileNameWithoutExtension = Path . GetFileNameWithoutExtension ( file ) ;
2434 var gdiFileName = $ "GDI_{ fileNameWithoutExtension } .png";
2535 var gdiFile = Path . Join ( outputFolder , gdiFileName ) ;
2636
27- var image = Image . FromFile ( file ) ;
28- image . Save ( gdiFile , ImageFormat . Png ) ;
37+ if ( OperatingSystem . IsWindowsVersionAtLeast ( 6 , 1 ) )
38+ {
39+ var image = Image . FromFile ( file ) ;
40+ image . Save ( gdiFile , ImageFormat . Png ) ;
41+ }
2942
3043 var wmfFileName = $ "WMF_{ fileNameWithoutExtension } .png";
3144 var testOutputFile = Path . Join ( outputFolder , wmfFileName ) ;
3548 (
3649 $ """
3750 ## { fileNameWithoutExtension }
38-
51+
3952 **GDI:**
40-
53+
4154 
42-
55+
4356 **WMF:**
44-
57+
4558 """
4659 ) ;
4760
48- if ( success )
61+ if ( success )
4962 {
5063 markdownText . AppendLine ( $ "") ;
5164 }
5568 }
5669
5770 markdownText . AppendLine ( "" ) ;
58- }
59-
60- var markdownFile = Path . Join ( outputFolder , "README.md" ) ;
61- File . WriteAllText ( markdownFile , markdownText . ToString ( ) ) ;
62-
63- Console . WriteLine ( "Hello, World!" ) ;
71+ }
0 commit comments