From 1aaf0c2137a89c31efbb47217d199ce948968af1 Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Thu, 7 Mar 2024 09:59:58 +0100 Subject: [PATCH 01/14] Add PresetSample folder. --- PresetSamples/ToLowBitrateMp3.xml | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 PresetSamples/ToLowBitrateMp3.xml diff --git a/PresetSamples/ToLowBitrateMp3.xml b/PresetSamples/ToLowBitrateMp3.xml new file mode 100644 index 0000000..f6104df --- /dev/null +++ b/PresetSamples/ToLowBitrateMp3.xml @@ -0,0 +1,42 @@ + + + + 3gp + 3gpp + avi + bik + flv + m4v + mkv + mov + mp4 + mpg + mpeg + ogv + rm + ts + vob + webm + wmv + aac + aiff + ape + cda + flac + m4a + m4b + mp3 + oga + ogg + opus + wav + wma + None + + + + + + (p)(f) + + \ No newline at end of file From 00fcb54a1e07fe292e973a2aca6a87b76255be81 Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Thu, 7 Mar 2024 10:34:27 +0100 Subject: [PATCH 02/14] Add: Change speed of audio files presets. --- PresetSamples/ChangeSpeedOfAudioFiles.xml | 81 +++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 PresetSamples/ChangeSpeedOfAudioFiles.xml diff --git a/PresetSamples/ChangeSpeedOfAudioFiles.xml b/PresetSamples/ChangeSpeedOfAudioFiles.xml new file mode 100644 index 0000000..2879b91 --- /dev/null +++ b/PresetSamples/ChangeSpeedOfAudioFiles.xml @@ -0,0 +1,81 @@ + + + + (p)(f) (fast) + None + 3gp + 3gpp + avi + bik + flv + m4v + mkv + mov + mp4 + mpg + mpeg + ogv + rm + ts + vob + webm + wmv + aac + aiff + ape + cda + flac + m4a + m4b + mp3 + oga + ogg + opus + wav + wma + + + + + + + + (p)(f) (slow) + None + 3gp + 3gpp + avi + bik + flv + m4v + mkv + mov + mp4 + mpg + mpeg + ogv + rm + ts + vob + webm + wmv + aac + aiff + ape + cda + flac + m4a + m4b + mp3 + oga + ogg + opus + wav + wma + + + + + + + \ No newline at end of file From b2199bca1e14af8955b6e7d38284bb30e47cb3fb Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Thu, 7 Mar 2024 10:41:50 +0100 Subject: [PATCH 03/14] Add: SampleRate preset. --- PresetSamples/To48kSampleRateWav.xml | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 PresetSamples/To48kSampleRateWav.xml diff --git a/PresetSamples/To48kSampleRateWav.xml b/PresetSamples/To48kSampleRateWav.xml new file mode 100644 index 0000000..dcbd69a --- /dev/null +++ b/PresetSamples/To48kSampleRateWav.xml @@ -0,0 +1,41 @@ + + + + (p)(f) + None + 3gp + 3gpp + avi + bik + flv + m4v + mkv + mov + mp4 + mpg + mpeg + ogv + rm + ts + vob + webm + wmv + aac + aiff + ape + cda + flac + m4a + m4b + mp3 + oga + ogg + opus + wav + wma + + + + + + \ No newline at end of file From ff0ddf16956ae491cf093ff113cd716b4f7e1358 Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Thu, 7 Mar 2024 10:51:44 +0100 Subject: [PATCH 04/14] Add: Fixed fps video preset --- PresetSamples/To24fpsMp4.xml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 PresetSamples/To24fpsMp4.xml diff --git a/PresetSamples/To24fpsMp4.xml b/PresetSamples/To24fpsMp4.xml new file mode 100644 index 0000000..d961d75 --- /dev/null +++ b/PresetSamples/To24fpsMp4.xml @@ -0,0 +1,28 @@ + + + + (p)(f) (24fps) + None + avi + bik + flv + mkv + mov + mp4 + 3gp + webm + wmv + m4v + mpeg + ogv + gif + + + + + + + + + + \ No newline at end of file From a99af42c6ae58a38b002363ac88feb707fdc43b4 Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Thu, 7 Mar 2024 14:12:09 +0100 Subject: [PATCH 05/14] Change: Update readme --- README.md | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index a582994..2f5d880 100644 --- a/README.md +++ b/README.md @@ -23,15 +23,6 @@ If you encounter any problem with File Converter, you can: * See the already known problems in the [troubleshooting section of the documentation](https://github.com/Tichau/FileConverter/wiki/Troubleshooting). * Or report an issue on the [bug tracker](https://github.com/Tichau/FileConverter/issues). -When you report an issue, please join the following informations: - -* Registry.xml -* Settings.user.xml -* The Diagnostics folder of the session that encountered the issue. -* A screenshot (if possible) and a description that shows/explain the issue. - -You will find the xml files and diagnostics folder in `c:\Users\[UserName]\AppData\Local\FileConverter\`. - ## Setup development environment ### Requirements @@ -52,17 +43,17 @@ Thanks to all the contributors of File Converter project. ### Localization -Thanks to **Khidreal** and **hugok79** for the Portuguese localization. -Thanks to **Marhc** for the Brazilian localization. -Thanks to **Chachak** for the Spanish localization. -Thanks to **Davide** for the Italian localization. -Thanks to **nikotschierske** for the German localization. -Thanks to **Snoopy1866** for the Simplified Chinese localization. -Thanks to **MayaC0re** for the Turkish localization. -Thanks to **vishveshjain** for the Hindi localization. -Thanks to **Mahmoud0Sultan** for the Arabic localization. -Thanks to **Sedimentary-Rock** for the Traditional Chinese localization. -Thanks to **CrisBalGreece** for the Greek localization. +* Thanks to **Khidreal** and **hugok79** for the Portuguese localization. +* Thanks to **Marhc** for the Brazilian localization. +* Thanks to **Chachak** for the Spanish localization. +* Thanks to **Davide** for the Italian localization. +* Thanks to **nikotschierske** for the German localization. +* Thanks to **Snoopy1866** for the Simplified Chinese localization. +* Thanks to **MayaC0re** for the Turkish localization. +* Thanks to **vishveshjain** for the Hindi localization. +* Thanks to **Mahmoud0Sultan** for the Arabic localization. +* Thanks to **Sedimentary-Rock** for the Traditional Chinese localization. +* Thanks to **CrisBalGreece** for the Greek localization. ## Middlewares @@ -79,7 +70,7 @@ And thanks to dlemstra for the C# wrapper of this software. [Github link](https: Thanks to ghostscript devs. [Download link](https://www.ghostscript.com/download/gsdnld.html) **SharpShell** to easily create windows context menu extensions. -Thanks to Dave Kerr for his work on SharpShell. [CodePlex link](https://sharpshell.codeplex.com) +Thanks to Dave Kerr for his work on SharpShell. [GitHub link](https://github.com/dwmkerr/sharpshell) **Ripper** and **yeti.mmedia** for CD Audio extraction. Thanks to Idael Cardoso for his work on CD Audio ripper. [Code project link](https://www.codeproject.com/Articles/5458/C-Sharp-Ripper) From c4264c38716b9ead891fb151626ec9f5854e6d49 Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Thu, 7 Mar 2024 21:12:21 +0100 Subject: [PATCH 06/14] Fixes: Issue where newly supported input types (ts, heic, ...) were not used in presets (issue #388). --- .../FileConverter/Settings.default.xml | 536 +++++++++++++----- CHANGELOG.md | 4 + 2 files changed, 400 insertions(+), 140 deletions(-) diff --git a/Application/FileConverter/Settings.default.xml b/Application/FileConverter/Settings.default.xml index b73161f..5fbfffc 100644 --- a/Application/FileConverter/Settings.default.xml +++ b/Application/FileConverter/Settings.default.xml @@ -15,6 +15,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -27,19 +31,23 @@ (p)(f) + gif + 3gp + 3gpp avi bik flv + m4v mkv mov mp4 - 3gp - webm - wmv - m4v + mpg mpeg ogv - gif + rm + ts + webm + wmv None @@ -52,7 +60,9 @@ (p)(f) + gif 3gp + 3gpp avi bik flv @@ -60,11 +70,13 @@ mkv mov mp4 + mpg mpeg ogv + rm + ts webm wmv - gif None @@ -77,19 +89,23 @@ (p)(f) + gif + 3gp + 3gpp avi bik flv + m4v mkv mov mp4 - 3gp - webm - wmv - m4v + mpg mpeg ogv - gif + rm + ts + webm + wmv None @@ -101,7 +117,9 @@ (p)(f) + gif 3gp + 3gpp avi bik flv @@ -109,11 +127,13 @@ mkv mov mp4 + mpg mpeg ogv + rm + ts webm wmv - gif None @@ -125,7 +145,9 @@ (p)(f) + gif 3gp + 3gpp avi bik flv @@ -133,11 +155,13 @@ mkv mov mp4 + mpg mpeg ogv + rm + ts webm wmv - gif None @@ -149,13 +173,36 @@ (p)(f) + xcf + gif + 3gp + 3gpp + avi + bik + flv + m4v + mkv + mov + mp4 + mpg + mpeg + ogv + rm + ts + webm + wmv arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg + nef png psd raf @@ -163,8 +210,18 @@ tga tif tiff + webp + None + + + + (p)(f) + + xcf + gif 3gp + 3gpp avi bik flv @@ -172,47 +229,32 @@ mkv mov mp4 + mpg mpeg ogv + rm + ts webm wmv - gif - webp - None - - - - (p)(f) - - arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg - raf + nef png psd + raf svg tga tif tiff - xcf - 3gp - avi - bik - flv - m4v - mkv - mov - mp4 - mpeg - ogv - webm - wmv - gif webp None @@ -221,15 +263,8 @@ (p)(f) - aac - aiff - ape - flac - m4a - mp3 - wma - wav 3gp + 3gpp avi bik flv @@ -237,11 +272,25 @@ mkv mov mp4 + mpg mpeg ogv + rm + ts webm wmv + aac + aiff + ape + flac + m4a + m4b + mp3 oga + ogg + opus + wav + wma None @@ -254,6 +303,7 @@ ape wma aiff + flac None @@ -269,19 +319,26 @@ mp3 ogg wma + oga + 3gp + 3gpp avi bik flv + m4v mkv mov mp4 - 3gp + mpg + mpeg + ogv + rm + ts webm wmv - m4v - oga - ogv - mpeg + m4b + opus + wav None @@ -297,20 +354,27 @@ m4a ogg wma + wav + oga + 3gp + 3gpp avi bik flv + m4v mkv mov mp4 - wav - 3gp - webm - wmv - m4v + mpg mpeg ogv - oga + rm + ts + webm + wmv + m4b + mp3 + opus None @@ -320,27 +384,34 @@ (p)(f) - aiff - ape - m4a - mp3 - ogg - wma + 3gp + 3gpp avi bik flv + m4v mkv mov mp4 - wav - flac - 3gp - webm - wmv - m4v + mpg mpeg ogv + rm + ts + webm + wmv + aac + aiff + ape + flac + m4a + m4b + mp3 oga + ogg + opus + wav + wma None @@ -429,24 +500,27 @@ (p:m)CDA Extraction\(f) + xcf arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg - raf + nef png psd + raf svg tga tif tiff - xcf webp - dng - nef None @@ -474,24 +548,27 @@ (p)(f) (n:i) of (n:c) + xcf arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg - raf + nef png psd + raf svg tga tif tiff - xcf webp - dng - nef None @@ -501,24 +578,27 @@ (p)(f) + xcf arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg - raf + nef png psd + raf svg tga tif tiff - xcf webp - dng - nef None @@ -528,39 +608,32 @@ (p)(f) + xcf + arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg + nef png psd + raf svg tga tif tiff - xcf webp None (p)(f) - arw - cr2 - bmp - exr - jpg - jpeg - raf - png - psd - svg - tga - tif - tiff xcf - webp doc docx odp @@ -570,13 +643,33 @@ pptx xls xlsx + arw + bmp + cr2 + dds dng + exr + heic + ico + jfif + jpg + jpeg nef + png + psd + raf + svg + tga + tif + tiff + webp None (p)(f) + gif 3gp + 3gpp avi bik flv @@ -584,11 +677,13 @@ mkv mov mp4 + mpg mpeg ogv + rm + ts webm wmv - gif None @@ -603,6 +698,7 @@ gif 3gp + 3gpp avi bik flv @@ -610,8 +706,11 @@ mkv mov mp4 + mpg mpeg ogv + rm + ts webm wmv None @@ -626,19 +725,23 @@ (p)(f) + gif + 3gp + 3gpp avi bik flv + m4v mkv mov mp4 - 3gp - webm - wmv - m4v + mpg mpeg ogv - gif + rm + ts + webm + wmv None @@ -650,7 +753,9 @@ (p)(f) + gif 3gp + 3gpp avi bik flv @@ -658,11 +763,13 @@ mkv mov mp4 + mpg mpeg ogv + rm + ts webm wmv - gif None @@ -674,7 +781,9 @@ (p)(f) + gif 3gp + 3gpp avi bik flv @@ -682,11 +791,13 @@ mkv mov mp4 + mpg mpeg ogv + rm + ts webm wmv - gif None @@ -698,24 +809,27 @@ (p)(f) + xcf arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg - raf + nef png psd + raf svg tga tif tiff - xcf webp - dng - nef None @@ -724,24 +838,27 @@ (p)(f)-small + xcf arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg - raf + nef png psd + raf svg tga tif tiff - xcf webp - dng - nef None @@ -751,24 +868,27 @@ (p)(f) + xcf arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg - raf + nef png psd + raf svg tga tif tiff - xcf webp - dng - nef None @@ -791,6 +911,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -816,6 +940,10 @@ ogv webm wmv + 3gpp + mpg + rm + ts None @@ -841,6 +969,10 @@ mpeg ogv gif + 3gpp + mpg + rm + ts None @@ -865,6 +997,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -889,6 +1025,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -900,24 +1040,27 @@ (p)(f) + xcf arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg - raf + nef png psd + raf svg tga tif tiff - xcf webp - dng - nef None @@ -926,24 +1069,27 @@ (p)(f)-small + xcf arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg - raf + nef png psd + raf svg tga tif tiff - xcf webp - dng - nef None @@ -953,24 +1099,27 @@ (p)(f) + xcf arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg - raf + nef png psd + raf svg tga tif tiff - xcf webp - dng - nef None @@ -993,6 +1142,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1018,6 +1171,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1043,6 +1200,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1067,6 +1228,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1091,6 +1256,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1111,10 +1280,14 @@ mov mp4 mpeg - ogv webm wmv gif + 3gpp + mpg + ogv + rm + ts None @@ -1140,6 +1313,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1165,6 +1342,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1189,6 +1370,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1213,6 +1398,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1237,6 +1426,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1262,6 +1455,10 @@ ogv webm wmv + 3gpp + mpg + rm + ts None @@ -1287,6 +1484,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1312,6 +1513,10 @@ mpeg ogv gif + 3gpp + mpg + rm + ts None @@ -1336,6 +1541,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1360,6 +1569,10 @@ ogv webm wmv + 3gpp + mpg + rm + ts None @@ -1374,20 +1587,23 @@ arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg - raf + nef png psd + raf svg tga tif tiff webp - dng - nef None @@ -1414,6 +1630,9 @@ webp dng nef + dds + heic + jfif None @@ -1441,6 +1660,9 @@ webp dng nef + jfif + heic + dds None @@ -1463,6 +1685,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1488,6 +1714,10 @@ mpeg ogv gif + 3gpp + mpg + rm + ts None @@ -1513,6 +1743,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1538,6 +1772,10 @@ mpeg ogv gif + 3gpp + mpg + rm + ts None @@ -1562,6 +1800,10 @@ webm wmv gif + 3gpp + mpg + rm + ts None @@ -1586,6 +1828,10 @@ ogv webm wmv + 3gpp + mpg + rm + ts None @@ -1601,7 +1847,6 @@ bmp cr2 exr - ico jpg jpeg raf @@ -1614,6 +1859,10 @@ webp dng nef + dds + heic + ico + jfif None @@ -1622,24 +1871,27 @@ (p)(f) + xcf arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg - raf + nef png psd + raf svg tga tif tiff - xcf webp - dng - nef None @@ -1649,24 +1901,27 @@ (p)(f) + xcf arw bmp cr2 + dds + dng exr + heic ico + jfif jpg jpeg - raf + nef png psd + raf svg tga tif tiff - xcf webp - dng - nef None @@ -1676,4 +1931,5 @@ (p)(f) true + false \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index fa9a031..470f3e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## Version 2.0.1 + +- Fixes: Issue where newly supported input types (ts, heic, ...) were not used in presets (github issue #388). + ## Version 2.0 - New: Possibility to create custom command line preset for types converted with FFMPEG (video and audio) (github issue #19 #18 #41 #61 #73 #128 #140 #153 #177 #182 #225 #255 #310 #314 #316 #325). From 1d63309e2858af3e98fb1b9bdd49f7c70006206d Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Thu, 7 Mar 2024 21:22:37 +0100 Subject: [PATCH 07/14] Add: Tempo and pitch conversion presets in default settings (issue #18). --- .../FileConverter/Settings.default.xml | 148 ++++++++++++++++++ CHANGELOG.md | 1 + PresetSamples/ChangeSpeedOfAudioFiles.xml | 81 ---------- 3 files changed, 149 insertions(+), 81 deletions(-) delete mode 100644 PresetSamples/ChangeSpeedOfAudioFiles.xml diff --git a/Application/FileConverter/Settings.default.xml b/Application/FileConverter/Settings.default.xml index 5fbfffc..0f8f4c7 100644 --- a/Application/FileConverter/Settings.default.xml +++ b/Application/FileConverter/Settings.default.xml @@ -1930,6 +1930,154 @@ (p)(f) + + 3gp + 3gpp + avi + bik + flv + m4v + mkv + mov + mp4 + mpg + mpeg + ogv + rm + ts + webm + wmv + aac + aiff + ape + flac + m4a + m4b + mp3 + oga + ogg + opus + wav + wma + None + + + + + + (p)(f) (slow) + + + 3gp + 3gpp + avi + bik + flv + m4v + mkv + mov + mp4 + mpg + mpeg + ogv + rm + ts + webm + wmv + aac + aiff + ape + flac + m4a + m4b + mp3 + oga + ogg + opus + wav + wma + None + + + + + + (p)(f) (fast) + + + 3gp + 3gpp + avi + bik + flv + m4v + mkv + mov + mp4 + mpg + mpeg + ogv + rm + ts + webm + wmv + aac + aiff + ape + flac + m4a + m4b + mp3 + oga + ogg + opus + wav + wma + None + + + + + + (p)(f) (-1st) + + + 3gp + 3gpp + avi + bik + flv + m4v + mkv + mov + mp4 + mpg + mpeg + ogv + rm + ts + webm + wmv + aac + aiff + ape + flac + m4a + m4b + mp3 + oga + ogg + opus + wav + wma + None + + + + + + (p)(f) (+1st) + true false \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 470f3e6..cf3c0cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Version 2.0.1 +- New: Tempo and pitch conversion presets in default settings (github issue #18). - Fixes: Issue where newly supported input types (ts, heic, ...) were not used in presets (github issue #388). ## Version 2.0 diff --git a/PresetSamples/ChangeSpeedOfAudioFiles.xml b/PresetSamples/ChangeSpeedOfAudioFiles.xml deleted file mode 100644 index 2879b91..0000000 --- a/PresetSamples/ChangeSpeedOfAudioFiles.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - (p)(f) (fast) - None - 3gp - 3gpp - avi - bik - flv - m4v - mkv - mov - mp4 - mpg - mpeg - ogv - rm - ts - vob - webm - wmv - aac - aiff - ape - cda - flac - m4a - m4b - mp3 - oga - ogg - opus - wav - wma - - - - - - - - (p)(f) (slow) - None - 3gp - 3gpp - avi - bik - flv - m4v - mkv - mov - mp4 - mpg - mpeg - ogv - rm - ts - vob - webm - wmv - aac - aiff - ape - cda - flac - m4a - m4b - mp3 - oga - ogg - opus - wav - wma - - - - - - - \ No newline at end of file From f7e41850a60d978fc90215e01e149ddfcbbd8498 Mon Sep 17 00:00:00 2001 From: Bugo Date: Sun, 10 Mar 2024 07:20:41 +0500 Subject: [PATCH 08/14] Add Russian translation --- .../Properties/Resources.ru-RU.resx | 595 ++++++++++++++++++ 1 file changed, 595 insertions(+) create mode 100644 Application/FileConverter/Properties/Resources.ru-RU.resx diff --git a/Application/FileConverter/Properties/Resources.ru-RU.resx b/Application/FileConverter/Properties/Resources.ru-RU.resx new file mode 100644 index 0000000..a4365a0 --- /dev/null +++ b/Application/FileConverter/Properties/Resources.ru-RU.resx @@ -0,0 +1,595 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + О программе + + + Разрешить выбор действий с входными файлами после успешного преобразования + + + Действие при успешном преобразовании + + + Новый пресет + + + Приложение + + + Аудио + + + Автоматически проверять наличие обновлений при запуске программы + + + Автоматический выход после завершения всех преобразований + + + Зажим с наименьшей мощностью 2 размера + + + Закрыть + + + Пресеты преобразования + + + Файлы для конвертации + + + Конвертировано из + + + Журнал + + + Журнал + + + Открыть документацию + + + Пожертвовать + + + Не забудьте вознаградить мою работу, если она вам понравится :) + + + Обновление будет загружено в фоновом режиме и установлено после выхода из программы. + + + Установить при выходе из программы + + + Кодирование : + + + Скорость кодирования : + + + File Converter — это расширение оболочки. + + + Это означает, что он интегрирован в проводник Windows. + + + Чтобы использовать File Converter, откройте проводник и щелкните правой кнопкой мыши любой файл, который вам нравится, чтобы открыть контекстное меню, в котором вы найдете доступные команды (см. файл readme, чтобы увидеть список совместимых форматов). + + + Шаблон имени файла + + + Кадров в секунду : + + + Открыть страницу проекта GitHub + + + справка ? + + + Пример исходного файла + + + Исходные форматы + + + Удалить + + + Переместить в папку архива + + + Нет + + + Обновление загружено. Выйдите из конвертера файлов, чтобы установить обновление. + + + Установить при выходе из программы + + + Сообщить о проблеме + + + Переместить вниз выбранный пресет + + + Переместить вверх выбранный пресет + + + Кодирование с постоянным битрейтом + + + Кодирование с переменным битрейтом + + + 90° + + + Вращение на 90° против часовой стрелки + + + Ok + + + 180° + + + Вращение на 180° + + + C:\Music\Artist\Album\Song.wav + + + Выходной файл + + + (p): путь к исходному файлу +(f): имя исходного файла +(o): расширение выходного файла +(i): расширение исходного файла +(d0): родительская папка исходного файла +(d1): вложенная папка исходного файла +... +(n:i): указатель номера страницы +(n:c): общее количество страниц + +Особые пути: +(p:d): путь к папке «Мои документы» +(p:m): путь к папке «Музыка» +(p:v): путь к папке «Видео» +(p:p): путь к папке «Изображения» + +используйте maj для версии в верхнем регистре + + + Выходной формат + + + Пресет + + + Название пресета + + + Качество : + + + Рекомендуемый диапазон битрейта выделен синим цветом. + + + Удалить + + + Повернуть : + + + Сохранить + + + Масштаб : + + + Посмотреть лог изменений... + + + Настройки + + + Настройки + + + 270° + + + Вращение на 90° по часовой стрелке + + + Доступно обновление. Настоятельно рекомендуется установить его как можно скорее! + + + Идёт загрузка обновления... + + + Обновления программы + + + Определите соотношение «размер файла» и «качество видео». Меньшее значение даст вам файл меньшего размера, большее значение обеспечит лучшее качество видео. + + + Побыстрее + + + Быстрая + + + Средняя + + + Помедленнее + + + Медленная + + + Очень быстрая + + + Определите соотношение «размер файла» и «продолжительность сжатия». Медленное сжатие позволит получить файл меньшего размера (при том же качестве видео), чем более быстрое сжатие. + + + Ультра быстрая + + + Очень быстрая + + + Очень медленная + + + Видео + + + PCM signed 16-bit little-endian + + + PCM signed 24-bit little-endian + + + PCM signed 32-bit little-endian + + + PCM signed 8-bit little-endian + + + Нет + + + Без вращения + + + Конверсия + + + Готово + + + Извлечение + + + Неудачно + + + В очереди + + + Чтение исходного изображения + + + Чтение документа + + + Анимированное изображение + + + Аудио + + + Документ + + + Изображение + + + Видео + + + Длительность ожидания перед выходом из приложения + + + Язык + + + Максимальное количество одновременных преобразований + + + Новый пресет + + + ###Загрузка журнала изменений ... + + + Архивы конверсий + + + Отменено. + + + Не удалось найти исполняемый файл ffmpeg. Вам следует попробовать переустановить приложение. + + + Не удалось извлечь дорожку аудио-CD. + + + CD-привод не готов. + + + Не удалось запустить ffmpeg. + + + Не удалось создать папки выходного пути. + + + Не удалось создать уникальный путь к выходному файлу. + + + Не могу прочитать компакт-диск «{0}». + + + Не удалось получить букву диска входного пути. + + + Не удалось получить номер дорожки из входного пути cda. + + + Не удалось использовать привод компакт-дисков, поскольку он открыт. + + + Тип входного файла несовместим с выбранным типом выходного файла. + + + Неверный выходной путь, созданный шаблоном пути к выходному файлу. + + + Неподдерживаемый формат вывода «{0}». + + + Количество каналов : + + + Измените количество каналов входного файла. + + + Моно + + + Как у исходного файла + + + Стерео + + + **Эта программа является бесплатным программным обеспечением**. + + + Вы можете распространять его и/или изменять в соответствии с условиями Стандартной общественной лицензии GNU. + + + Данная программа распространяется в надежде, что она будет полезна, но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ. Дополнительную информацию см. в Стандартной общественной лицензии GNU (доступна в папке установки: `LICENSE.md`). + + + Приложение завершается. + + + Приложение автоматически завершится через {0} секунд. + + + Приложение автоматически завершится через 1 секунду. + + + Разное + + + Не могу найти выходной(ые) файл(ы). + + + Задание преобразования не выполнено, но выходной файл существует. + + + Подготовить преобразование + + + Для преобразования документов Office необходимо установить Microsoft Office. + + + Не удалось открыть документ с помощью Microsoft Office (проверьте, действительна ли ваша лицензия/установка). + + + Для преобразования документов Excel необходимо установить Microsoft Excel. + + + Для преобразования документов PowerPoint необходимо установить Microsoft PowerPoint. + + + Для преобразования документов Word необходимо установить Microsoft Word. + + + Открыть веб-сайт конвертера файлов + + + Ошибка во время инициализации задания преобразования. + + + Новая папка + + + Новая папка + + + Папка + + + Имя папки + + + Расширенный режим + + + Пользовательские аргументы + + + Пользовательские аргументы командной строки FFMPEG + + + Не выбран пресет + + + Экспорт + + + Импорт + + + Дублировать пресет + + + Отмена + + + Ошибка + + + Невозможно загрузить пользовательские настройки конвертера файлов. Вы хотите вернуться к настройкам по умолчанию? + + + Копирование файлов в буфер обмена после конвертации + + \ No newline at end of file From 73a91a14bce27a90cd306428741f1959f518ea53 Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Sun, 10 Mar 2024 21:16:05 +0100 Subject: [PATCH 09/14] Tech: Simplify diagnostics api. --- Application/FileConverter/Application.xaml.cs | 63 +++++------ .../ConversionJobs/ConversionJob.cs | 22 ++-- .../ConversionJobs/ConversionJob_Excel.cs | 10 +- .../ConversionJob_ExtractCDA.cs | 4 +- .../ConversionJob_FFMPEG.Converters.cs | 2 +- .../ConversionJobs/ConversionJob_FFMPEG.cs | 8 +- .../ConversionJobs/ConversionJob_Gif.cs | 2 +- .../ConversionJobs/ConversionJob_Ico.cs | 2 +- .../ConversionJob_ImageMagick.cs | 22 ++-- .../ConversionJob_PowerPoint.cs | 12 +-- .../ConversionJobs/ConversionJob_Word.cs | 12 +-- .../FileConverter/Diagnostics/Debug.cs | 102 ++++++++++-------- Application/FileConverter/Registry.cs | 12 +-- .../Services/ConversionService.cs | 10 +- .../Services/NavigationService.cs | 4 +- .../FileConverter/Services/SettingsService.cs | 10 +- Application/FileConverter/Settings.cs | 2 +- 17 files changed, 154 insertions(+), 145 deletions(-) diff --git a/Application/FileConverter/Application.xaml.cs b/Application/FileConverter/Application.xaml.cs index 35ffbcf..78487ce 100644 --- a/Application/FileConverter/Application.xaml.cs +++ b/Application/FileConverter/Application.xaml.cs @@ -70,10 +70,15 @@ public void CancelAutoExit() } } + public static void AskForShutdown() + { + Application.Current.Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown(Debug.FirstErrorCode))); + } + protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); - + this.RegisterServices(); this.Initialize(); @@ -117,7 +122,7 @@ protected override void OnExit(ExitEventArgs e) if (!this.isSessionEnding && upgradeService.UpgradeVersionDescription != null && upgradeService.UpgradeVersionDescription.NeedToUpgrade) { - Debug.Log("A new version of file converter has been found: {0}.", upgradeService.UpgradeVersionDescription.LatestVersion); + Debug.Log($"A new version of file converter has been found: {upgradeService.UpgradeVersionDescription.LatestVersion}."); if (string.IsNullOrEmpty(upgradeService.UpgradeVersionDescription.InstallerPath)) { @@ -134,16 +139,16 @@ protected override void OnExit(ExitEventArgs e) string installerPath = upgradeService.UpgradeVersionDescription.InstallerPath; if (!System.IO.File.Exists(installerPath)) { - Debug.LogError("Can't find upgrade installer ({0}). Try to restart the application.", installerPath); + Debug.LogError($"Can't find upgrade installer ({installerPath}). Try to restart the application."); return; } // Start process. - Debug.Log("Start file converter upgrade from version {0} to {1}.", ApplicationVersion, upgradeService.UpgradeVersionDescription.LatestVersion); + Debug.Log($"Start file converter upgrade from version {ApplicationVersion} to {upgradeService.UpgradeVersionDescription.LatestVersion}."); ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(installerPath) { UseShellExecute = true, }; - Debug.Log("Start upgrade process: {0}{1}.", System.IO.Path.GetFileName(startInfo.FileName), startInfo.Arguments); + Debug.Log($"Start upgrade process: {System.IO.Path.GetFileName(startInfo.FileName)}{startInfo.Arguments}."); Process process = new System.Diagnostics.Process { StartInfo = startInfo }; process.Start(); @@ -172,7 +177,7 @@ private void RegisterServices() else { Debug.LogError("Can't retrieve view model locator."); - this.Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown())); + Application.AskForShutdown(); } if (this.TryFindResource("Upgrade") is UpgradeService upgradeService) @@ -182,7 +187,7 @@ private void RegisterServices() else { Debug.LogError("Can't retrieve Upgrade service."); - this.Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown())); + Application.AskForShutdown(); } services @@ -217,7 +222,7 @@ private void Initialize() for (int index = 0; index < args.Length; index++) { string argument = args[index]; - Debug.Log("Arg{0}: {1}", index, argument); + Debug.Log($"Arg{index}: {argument}"); } Debug.Log(string.Empty); @@ -233,7 +238,6 @@ private void Initialize() // Parse arguments. bool quitAfterStartup = false; - int quitExitCode = 0; List filePaths = new List(); string conversionPresetName = null; for (int index = 1; index < args.Length; index++) @@ -254,8 +258,7 @@ private void Initialize() case "post-install-init": if (!settingsService.PostInstallationInitialization()) { - quitExitCode = 0x0F; - Debug.LogError(quitExitCode, $"Failed to execute post install initialization."); + Debug.LogError(errorCode: 0x0F, $"Failed to execute post install initialization."); } quitAfterStartup = true; @@ -267,8 +270,7 @@ private void Initialize() if (index >= args.Length - 1) { - quitExitCode = 0x0B; - Debug.LogError(quitExitCode, $"Invalid format."); + Debug.LogError(errorCode: 0x0B, $"Invalid format."); break; } @@ -277,8 +279,7 @@ private void Initialize() if (!Helpers.RegisterShellExtension(shellExtensionPath)) { - quitExitCode = 0x0C; - Debug.LogError(quitExitCode, $"Failed to register shell extension {shellExtensionPath}."); + Debug.LogError(errorCode: 0x0C, $"Failed to register shell extension {shellExtensionPath}."); } break; @@ -290,8 +291,7 @@ private void Initialize() if (index >= args.Length - 1) { - quitExitCode = 0x0D; - Debug.LogError(quitExitCode, $"Invalid format."); + Debug.LogError(errorCode: 0x0D, $"Invalid format."); break; } @@ -300,8 +300,7 @@ private void Initialize() if (!Helpers.UnregisterExtension(shellExtensionPath)) { - quitExitCode = 0x0E; - Debug.LogError(quitExitCode, $"Failed to unregister shell extension {shellExtensionPath}."); + Debug.LogError(errorCode: 0x0E, $"Failed to unregister shell extension {shellExtensionPath}."); } break; @@ -320,8 +319,7 @@ private void Initialize() if (index >= args.Length - 1) { quitAfterStartup = true; - quitExitCode = 0x01; - Debug.LogError(quitExitCode, $"Invalid format."); + Debug.LogError(errorCode: 0x01, $"Invalid format."); break; } @@ -333,8 +331,7 @@ private void Initialize() if (index >= args.Length - 1) { quitAfterStartup = true; - quitExitCode = 0x02; - Debug.LogError(quitExitCode, $"Invalid format."); + Debug.LogError(errorCode: 0x02, $"Invalid format."); break; } @@ -353,8 +350,7 @@ private void Initialize() catch (Exception exception) { quitAfterStartup = true; - quitExitCode = 0x03; - Debug.LogError(quitExitCode, $"Can't read input files list: {exception}"); + Debug.LogError(errorCode: 0x03, $"Can't read input files list: {exception}"); } index++; @@ -368,7 +364,7 @@ private void Initialize() break; default: - Debug.LogError("Unknown application argument: '--{0}'.", parameterTitle); + Debug.LogError($"Unknown application argument: '--{parameterTitle}'."); return; } } @@ -380,18 +376,17 @@ private void Initialize() if (settingsService.Settings == null) { - Debug.LogError("Can't load File Converter settings. The application will now shutdown, if you want to fix the problem yourself please edit or delete the file: C:\\Users\\UserName\\AppData\\Local\\FileConverter\\Settings.user.xml."); + Debug.LogError(errorCode: 0x04, "Can't load File Converter settings. The application will now shutdown, if you want to fix the problem yourself please edit or delete the file: C:\\Users\\UserName\\AppData\\Local\\FileConverter\\Settings.user.xml."); quitAfterStartup = true; - quitExitCode = 13; } if (quitAfterStartup) { - Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown(quitExitCode))); + Application.AskForShutdown(); return; } - Debug.Assert(quitExitCode == 0, "An error happened during the initialization."); + Debug.Assert(Debug.FirstErrorCode == 0, "An error happened during the initialization."); // Check for upgrade. if (settingsService.Settings.CheckUpgradeAtStartup) @@ -407,8 +402,8 @@ private void Initialize() conversionPreset = settingsService.Settings.GetPresetFromName(conversionPresetName); if (conversionPreset == null) { - Debug.LogError("Invalid conversion preset '{0}'. (code 0x02)", conversionPresetName); - Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown())); + Debug.LogError(errorCode: 0x02, $"Invalid conversion preset '{conversionPresetName}'."); + Application.AskForShutdown(); return; } } @@ -418,7 +413,7 @@ private void Initialize() IConversionService conversionService = Ioc.Default.GetRequiredService(); // Create conversion jobs. - Debug.Log("Create jobs for conversion preset: '{0}'", conversionPreset.FullName); + Debug.Log($"Create jobs for conversion preset: '{conversionPreset.FullName}'"); try { for (int index = 0; index < filePaths.Count; index++) @@ -488,7 +483,7 @@ private void ConversionService_ConversionJobsTerminated(object sender, Conversio this.OnApplicationTerminate.Invoke(this, new ApplicationTerminateArgs(remainingTime)); } - this.Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown())); + Application.AskForShutdown(); } } } diff --git a/Application/FileConverter/ConversionJobs/ConversionJob.cs b/Application/FileConverter/ConversionJobs/ConversionJob.cs index e7e7ab6..ecf6854 100644 --- a/Application/FileConverter/ConversionJobs/ConversionJob.cs +++ b/Application/FileConverter/ConversionJobs/ConversionJob.cs @@ -312,7 +312,7 @@ public void PrepareConversion(params string[] outputFilePaths) this.State = ConversionState.Ready; } - Debug.Log("Job initialized: Preset: '{0}' Input: {1} Output: {2}", this.ConversionPreset.FullName, this.InputFilePath, this.OutputFilePath); + Debug.Log($"Job initialized: Preset: '{this.ConversionPreset.FullName}' Input: {this.InputFilePath} Output: {this.OutputFilePath}"); if (this.State != ConversionState.Failed) { @@ -332,7 +332,7 @@ public void StartConversion() throw new Exception("Invalid conversion state."); } - Debug.Log("Convert file {0} to {1}.", this.InputFilePath, this.OutputFilePath); + Debug.Log($"Convert file {this.InputFilePath} to {this.OutputFilePath}."); this.StartTime = DateTime.Now; this.State = ConversionState.InProgress; @@ -407,8 +407,8 @@ protected virtual void OnConversionFailed() } catch (Exception exception) { - Debug.Log("Can't delete file '{0}' after conversion job failure.", outputFilePath); - Debug.Log("An exception as been thrown: {0}.", exception.ToString()); + Debug.Log($"Can't delete file '{outputFilePath}' after conversion job failure."); + Debug.Log($"An exception as been thrown: {exception}."); } } } @@ -436,12 +436,12 @@ protected virtual void OnConversionSucceed() string newPath = PathHelpers.GenerateUniquePath(archivePath + "\\" + inputFilename); System.IO.File.Move(this.InputFilePath, newPath); - Debug.Log("Input file moved in archive folder: '{0}'", newPath); + Debug.Log($"Input file moved in archive folder: '{newPath}'"); break; case InputPostConversionAction.Delete: System.IO.File.Delete(this.InputFilePath); - Debug.Log("Input file deleted: '{0}'", this.initialInputPath); + Debug.Log($"Input file deleted: '{this.initialInputPath}'"); break; } @@ -455,7 +455,7 @@ protected virtual void OnConversionSucceed() protected void ConversionFailed(string exitingMessage) { - Debug.Log("Fail: {0}", exitingMessage); + Debug.Log($"Fail: {exitingMessage}"); if (this.State == ConversionState.Failed) { @@ -483,7 +483,7 @@ private void ChangeOutputFileTimestampToMatchOriginal() var originalFileCreationTime = System.IO.File.GetCreationTimeUtc(this.InputFilePath); var originalFileLastAccesTime = System.IO.File.GetLastAccessTimeUtc(this.InputFilePath); var originalFileLastWriteTime = System.IO.File.GetLastWriteTimeUtc(this.InputFilePath); - Debug.Log(" original timestamp: {0}, {1}, {2}", originalFileCreationTime, originalFileLastAccesTime, originalFileLastWriteTime); + Debug.Log($" original timestamp: {originalFileCreationTime}, {originalFileLastAccesTime}, {originalFileLastWriteTime}"); for (int index = 0; index < this.OutputFilePaths.Length; index++) { @@ -493,12 +493,12 @@ private void ChangeOutputFileTimestampToMatchOriginal() System.IO.File.SetCreationTimeUtc(outputFilePath, originalFileCreationTime); System.IO.File.SetLastAccessTimeUtc(outputFilePath, originalFileLastAccesTime); System.IO.File.SetLastWriteTimeUtc(outputFilePath, originalFileLastWriteTime); - Debug.Log(" output file '{0}' timestamp changed", outputFilePath); + Debug.Log($" output file '{outputFilePath}' timestamp changed"); } catch (Exception exception) { - Debug.Log("Can't change timestamp from file '{0}'", outputFilePath); - Debug.Log("An exception as been thrown: {0}.", exception.ToString()); + Debug.Log($"Can't change timestamp from file '{outputFilePath}'"); + Debug.Log($"An exception as been thrown: {exception}."); } } diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_Excel.cs b/Application/FileConverter/ConversionJobs/ConversionJob_Excel.cs index f03886c..6c9d57c 100644 --- a/Application/FileConverter/ConversionJobs/ConversionJob_Excel.cs +++ b/Application/FileConverter/ConversionJobs/ConversionJob_Excel.cs @@ -107,10 +107,10 @@ protected override void Convert() this.UserState = Properties.Resources.ConversionStateConversion; - Diagnostics.Debug.Log("Convert excel document to pdf."); + Debug.Log("Convert excel document to pdf."); this.document.ExportAsFixedFormat(Excel.XlFixedFormatType.xlTypePDF, this.intermediateFilePath); - Diagnostics.Debug.Log("Close excel document '{0}'.", this.InputFilePath); + Debug.Log($"Close excel document '{this.InputFilePath}'."); this.document.Close(false); this.document = null; @@ -126,7 +126,7 @@ protected override void Convert() Task updateProgress = this.UpdateProgress(); - Diagnostics.Debug.Log("Convert pdf to images."); + Debug.Log("Convert pdf to images."); this.pdf2ImageConversionJob.StartConversion(); @@ -138,7 +138,7 @@ protected override void Convert() if (!string.IsNullOrEmpty(this.intermediateFilePath)) { - Diagnostics.Debug.Log("Delete intermediate file {0}.", this.intermediateFilePath); + Debug.Log($"Delete intermediate file {this.intermediateFilePath}."); File.Delete(this.intermediateFilePath); } @@ -213,7 +213,7 @@ private bool TryLoadDocumentIfNecessary() if (this.document == null) { - Diagnostics.Debug.Log("Load excel document '{0}'.", this.InputFilePath); + Debug.Log($"Load excel document '{this.InputFilePath}'."); this.document = this.application.Workbooks.Open(this.InputFilePath, System.Reflection.Missing.Value, true); } diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_ExtractCDA.cs b/Application/FileConverter/ConversionJobs/ConversionJob_ExtractCDA.cs index 2e51793..66c8b38 100644 --- a/Application/FileConverter/ConversionJobs/ConversionJob_ExtractCDA.cs +++ b/Application/FileConverter/ConversionJobs/ConversionJob_ExtractCDA.cs @@ -167,7 +167,7 @@ protected override void Convert() return; } - Debug.Log("CDA extracted to {0}.", this.intermediateFilePath); + Debug.Log($"CDA extracted to {this.intermediateFilePath}."); Debug.Log(string.Empty); Debug.Log("Start compression."); @@ -188,7 +188,7 @@ protected override void Convert() } Debug.Log(string.Empty); - Debug.Log("Delete intermediate file {0}.", this.intermediateFilePath); + Debug.Log($"Delete intermediate file {this.intermediateFilePath}."); File.Delete(this.intermediateFilePath); } diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.Converters.cs b/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.Converters.cs index 934d102..a738389 100644 --- a/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.Converters.cs +++ b/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.Converters.cs @@ -75,7 +75,7 @@ private static string ComputeTransformArgs(ConversionPreset conversionPreset) } else { - Diagnostics.Debug.LogError("Unsupported rotation: {0}°", rotationAngleInDegrees); + Diagnostics.Debug.LogError($"Unsupported rotation: {rotationAngleInDegrees}°"); } } diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.cs b/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.cs index a935aad..cb9f3b3 100644 --- a/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.cs +++ b/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.cs @@ -68,7 +68,7 @@ protected override void Initialize() if (!System.IO.File.Exists(ffmpegPath)) { this.ConversionFailed(Properties.Resources.ErrorCantFindFFMPEG); - Diagnostics.Debug.Log("Can't find ffmpeg executable ({0}). Try to reinstall the application.", ffmpegPath); + Diagnostics.Debug.Log($"Can't find ffmpeg executable ({ffmpegPath}). Try to reinstall the application."); return; } @@ -419,7 +419,7 @@ protected override void Convert() this.UserState = currentPass.Name; this.ffmpegProcessStartInfo.Arguments = currentPass.Arguments; - Diagnostics.Debug.Log("Execute command: {0} {1}.", this.ffmpegProcessStartInfo.FileName, this.ffmpegProcessStartInfo.Arguments); + Diagnostics.Debug.Log($"Execute command: {this.ffmpegProcessStartInfo.FileName} {this.ffmpegProcessStartInfo.Arguments}."); Diagnostics.Debug.Log(string.Empty); try @@ -439,7 +439,7 @@ protected override void Convert() this.ParseFFMPEGOutput(result); - Diagnostics.Debug.Log("ffmpeg output: {0}", result); + Diagnostics.Debug.Log($"ffmpeg output: {result}"); } } @@ -465,7 +465,7 @@ protected override void Convert() continue; } - Diagnostics.Debug.Log("Delete intermediate file {0}.", currentPass.FileToDelete); + Diagnostics.Debug.Log($"Delete intermediate file {currentPass.FileToDelete}."); File.Delete(currentPass.FileToDelete); } diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_Gif.cs b/Application/FileConverter/ConversionJobs/ConversionJob_Gif.cs index 34c383c..bc9fde6 100644 --- a/Application/FileConverter/ConversionJobs/ConversionJob_Gif.cs +++ b/Application/FileConverter/ConversionJobs/ConversionJob_Gif.cs @@ -99,7 +99,7 @@ protected override void Convert() if (!string.IsNullOrEmpty(this.intermediateFilePath)) { - Diagnostics.Debug.Log("Delete intermediate file {0}.", this.intermediateFilePath); + Diagnostics.Debug.Log($"Delete intermediate file {this.intermediateFilePath}."); File.Delete(this.intermediateFilePath); } diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_Ico.cs b/Application/FileConverter/ConversionJobs/ConversionJob_Ico.cs index 2659cd1..9c6e323 100644 --- a/Application/FileConverter/ConversionJobs/ConversionJob_Ico.cs +++ b/Application/FileConverter/ConversionJobs/ConversionJob_Ico.cs @@ -76,7 +76,7 @@ protected override void Convert() return; } - Diagnostics.Debug.Log("Delete intermediate file {0}.", this.intermediateFilePath); + Diagnostics.Debug.Log($"Delete intermediate file {this.intermediateFilePath}."); File.Delete(this.intermediateFilePath); } diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_ImageMagick.cs b/Application/FileConverter/ConversionJobs/ConversionJob_ImageMagick.cs index dd8a387..1c95dff 100644 --- a/Application/FileConverter/ConversionJobs/ConversionJob_ImageMagick.cs +++ b/Application/FileConverter/ConversionJobs/ConversionJob_ImageMagick.cs @@ -92,7 +92,7 @@ protected override void Convert() using (MagickImage image = new MagickImage(this.InputFilePath, readSettings)) { - Debug.Log("Load image {0} succeed.", this.InputFilePath); + Debug.Log($"Load image {this.InputFilePath} succeed."); this.ConvertImage(image); } } @@ -106,12 +106,12 @@ private void ConvertPdf() float scaleFactor = this.ConversionPreset.GetSettingsValue(ConversionPreset.ConversionSettingKeys.ImageScale); if (Math.Abs(scaleFactor - 1f) >= 0.005f) { - Debug.Log("Apply scale factor: {0}%.", scaleFactor * 100); + Debug.Log($"Apply scale factor: {scaleFactor * 100}%."); dpi *= scaleFactor; } - Debug.Log("Density: {0}dpi.", dpi); + Debug.Log($"Density: {dpi}dpi."); settings.Density = new Density(dpi * PdfSuperSamplingRatio); this.UserState = Properties.Resources.ConversionStateReadDocument; @@ -120,7 +120,7 @@ private void ConvertPdf() { // Add all the pages of the pdf file to the collection images.Read(this.InputFilePath, settings); - Debug.Log("Load pdf {0} succeed.", this.InputFilePath); + Debug.Log($"Load pdf {this.InputFilePath} succeed."); this.pageCount = images.Count; @@ -128,7 +128,7 @@ private void ConvertPdf() foreach (MagickImage image in images) { - Debug.Log("Write page {0}/{1}.", this.CurrentOutputFilePathIndex + 1, this.pageCount); + Debug.Log($"Write page {this.CurrentOutputFilePathIndex + 1}/{this.pageCount}."); if (PdfSuperSamplingRatio > 1) { @@ -153,7 +153,7 @@ private void ConvertImage(MagickImage image, bool ignoreScale = false) float scaleFactor = this.ConversionPreset.GetSettingsValue(ConversionPreset.ConversionSettingKeys.ImageScale); if (Math.Abs(scaleFactor - 1f) >= 0.005f) { - Debug.Log("Apply scale factor: {0}%.", scaleFactor * 100); + Debug.Log($"Apply scale factor: {scaleFactor * 100}%."); image.Scale(new Percentage(scaleFactor * 100f)); } @@ -164,7 +164,7 @@ private void ConvertImage(MagickImage image, bool ignoreScale = false) float rotateAngleInDegrees = this.ConversionPreset.GetSettingsValue(ConversionPreset.ConversionSettingKeys.ImageRotation); if (Math.Abs(rotateAngleInDegrees - 0f) >= 0.05f) { - Debug.Log("Apply rotation: {0}°.", rotateAngleInDegrees); + Debug.Log($"Apply rotation: {rotateAngleInDegrees}°."); image.Rotate(rotateAngleInDegrees); } @@ -182,7 +182,7 @@ private void ConvertImage(MagickImage image, bool ignoreScale = false) size *= 2; } - Debug.Log("Clamp size to the nearest power of 2 size (from {0}x{1} to {2}x{2}).", image.Width, image.Height, size); + Debug.Log($"Clamp size to the nearest power of 2 size (from {image.Width}x{image.Height} to {size}x{size})."); image.Scale(size, size); } @@ -196,13 +196,13 @@ private void ConvertImage(MagickImage image, bool ignoreScale = false) int width = System.Math.Min(image.Width, maximumSize); int height = System.Math.Min(image.Height, maximumSize); - Debug.Log("Clamp size to maximum size of {2}x{2} (from {0}x{1} to {2}x{3}).", image.Width, image.Height, width, height); + Debug.Log($"Clamp size to maximum size of {width}x{width} (from {image.Width}x{image.Height} to {width}x{height})."); image.Scale(width, height); } } - Debug.Log("Convert image (output: {0}).", this.OutputFilePath); + Debug.Log($"Convert image (output: {this.OutputFilePath})."); switch (this.ConversionPreset.OutputType) { case OutputType.Png: @@ -215,7 +215,7 @@ private void ConvertImage(MagickImage image, bool ignoreScale = false) break; case OutputType.Pdf: - Debug.Log("Density: {0}dpi.", BaseDpiForPdfConversion); + Debug.Log($"Density: {BaseDpiForPdfConversion}dpi."); image.Density = new Density(BaseDpiForPdfConversion); break; diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_PowerPoint.cs b/Application/FileConverter/ConversionJobs/ConversionJob_PowerPoint.cs index 3242284..110d30b 100644 --- a/Application/FileConverter/ConversionJobs/ConversionJob_PowerPoint.cs +++ b/Application/FileConverter/ConversionJobs/ConversionJob_PowerPoint.cs @@ -96,10 +96,10 @@ protected override void Convert() this.UserState = Properties.Resources.ConversionStateConversion; - Diagnostics.Debug.Log("Convert PowerPoint document to pdf."); + Debug.Log("Convert PowerPoint document to pdf."); this.document.ExportAsFixedFormat(this.intermediateFilePath, PowerPoint.PpFixedFormatType.ppFixedFormatTypePDF); - Diagnostics.Debug.Log("Close PowerPoint document '{0}'.", this.InputFilePath); + Debug.Log($"Close PowerPoint document '{this.InputFilePath}'."); this.document.Close(); this.document = null; @@ -115,7 +115,7 @@ protected override void Convert() Task updateProgress = this.UpdateProgress(); - Diagnostics.Debug.Log("Convert pdf to images."); + Debug.Log("Convert pdf to images."); this.pdf2ImageConversionJob.StartConversion(); @@ -127,7 +127,7 @@ protected override void Convert() if (!string.IsNullOrEmpty(this.intermediateFilePath)) { - Diagnostics.Debug.Log("Delete intermediate file {0}.", this.intermediateFilePath); + Debug.Log($"Delete intermediate file {this.intermediateFilePath}."); File.Delete(this.intermediateFilePath); } @@ -144,7 +144,7 @@ protected override void InitializeOfficeApplicationInstanceIfNecessary() } // Initialize PowerPoint application. - Diagnostics.Debug.Log("Instantiate PowerPoint application via interop."); + Debug.Log("Instantiate PowerPoint application via interop."); this.application = new PowerPoint.Application(); } @@ -199,7 +199,7 @@ private bool TryLoadDocumentIfNecessary() if (this.document == null) { - Diagnostics.Debug.Log("Load PowerPoint document '{0}'.", this.InputFilePath); + Debug.Log($"Load PowerPoint document '{this.InputFilePath}'."); this.document = this.application.Presentations.Open(this.InputFilePath, ReadOnly: MsoTriState.msoTrue, WithWindow: MsoTriState.msoFalse); } diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_Word.cs b/Application/FileConverter/ConversionJobs/ConversionJob_Word.cs index 8442181..18eebc8 100644 --- a/Application/FileConverter/ConversionJobs/ConversionJob_Word.cs +++ b/Application/FileConverter/ConversionJobs/ConversionJob_Word.cs @@ -99,7 +99,7 @@ protected override void Convert() this.UserState = Properties.Resources.ConversionStateConversion; - Diagnostics.Debug.Log("Convert word document to pdf."); + Debug.Log("Convert word document to pdf."); // this.document.ExportAsFixedFormat(this.intermediateFilePath, Word.WdExportFormat.wdExportFormatPDF); this.document.ExportAsFixedFormat(this.intermediateFilePath, Word.WdExportFormat.wdExportFormatPDF, @@ -113,7 +113,7 @@ protected override void Convert() Word.WdExportCreateBookmarks.wdExportCreateHeadingBookmarks, true); - Diagnostics.Debug.Log("Close word document '{0}'.", this.InputFilePath); + Debug.Log($"Close word document '{this.InputFilePath}'."); this.document.Close(Word.WdSaveOptions.wdDoNotSaveChanges); this.document = null; @@ -129,7 +129,7 @@ protected override void Convert() Task updateProgress = this.UpdateProgress(); - Diagnostics.Debug.Log("Convert pdf to images."); + Debug.Log("Convert pdf to images."); this.pdf2ImageConversionJob.StartConversion(); @@ -141,7 +141,7 @@ protected override void Convert() if (!string.IsNullOrEmpty(this.intermediateFilePath)) { - Diagnostics.Debug.Log("Delete intermediate file {0}.", this.intermediateFilePath); + Debug.Log($"Delete intermediate file {this.intermediateFilePath}."); File.Delete(this.intermediateFilePath); } @@ -158,7 +158,7 @@ protected override void InitializeOfficeApplicationInstanceIfNecessary() } // Initialize word application. - Diagnostics.Debug.Log("Instantiate word application via interop."); + Debug.Log("Instantiate word application via interop."); this.application = new Microsoft.Office.Interop.Word.Application { Visible = false @@ -216,7 +216,7 @@ private bool TryLoadDocumentIfNecessary() if (this.document == null) { - Diagnostics.Debug.Log("Load word document '{0}'.", this.InputFilePath); + Debug.Log($"Load word document '{this.InputFilePath}'."); this.document = this.application.Documents.Open(this.InputFilePath, System.Reflection.Missing.Value, true); } diff --git a/Application/FileConverter/Diagnostics/Debug.cs b/Application/FileConverter/Diagnostics/Debug.cs index 6927c70..6dda006 100644 --- a/Application/FileConverter/Diagnostics/Debug.cs +++ b/Application/FileConverter/Diagnostics/Debug.cs @@ -5,6 +5,7 @@ namespace FileConverter.Diagnostics using System; using System.Collections.Generic; using System.ComponentModel; + using System.Diagnostics; using System.IO; using System.Linq; using System.Threading; @@ -41,53 +42,23 @@ static Debug() Debug.diagnosticsFolderPath = Path.Combine(path, diagnosticsFolderName); Debug.diagnosticsFolderPath = PathHelpers.GenerateUniquePath(Debug.diagnosticsFolderPath); Directory.CreateDirectory(Debug.diagnosticsFolderPath); - } - - public static event EventHandler StaticPropertyChanged; - - public static DiagnosticsData[] Data => Debug.diagnosticsDataById.Values.ToArray(); - public static void Log(string message, params object[] arguments) - { - string log = arguments.Length > 0 ? string.Format(message, arguments) : message; - Debug.Log(log, ConsoleColor.White); + Debug.Log($"Diagnostics stored at path '{Debug.diagnosticsFolderPath}'"); } - public static void Log(string message) + public static int FirstErrorCode { - Debug.Log(message, ConsoleColor.White); + get; + private set; } - public static void Log(string log, ConsoleColor color) - { - DiagnosticsData diagnosticsData; - - Thread currentThread = Thread.CurrentThread; - int threadId = currentThread.ManagedThreadId; - - // Display main thread logs in standard output. - if (threadId == Debug.mainThreadId) - { - Console.ForegroundColor = color; - Console.WriteLine(log); - Console.ResetColor(); - } - - lock (Debug.diagnosticsDataById) - { - if (!Debug.diagnosticsDataById.TryGetValue(threadId, out diagnosticsData)) - { - string threadName = Debug.threadCount > 0 ? $"{currentThread.Name} ({Debug.threadCount})" : "Application"; - diagnosticsData = new DiagnosticsData(threadName); - diagnosticsData.Initialize(Debug.diagnosticsFolderPath, threadId); - Debug.diagnosticsDataById.Add(threadId, diagnosticsData); - Debug.threadCount++; + public static event EventHandler StaticPropertyChanged; - StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs("Data")); - } - } + public static DiagnosticsData[] Data => Debug.diagnosticsDataById.Values.ToArray(); - diagnosticsData.Log(log); + public static void Log(string message) + { + Debug.LogInternal(error: false, message, ConsoleColor.White); } public static void Assert(bool condition) @@ -106,17 +77,20 @@ public static void Assert(bool condition, string message) } } - public static void LogError(string message, params object[] arguments) + public static void LogError(string message) { - string log = string.Format(message, arguments); - - MessageBox.Show(log, "Error", MessageBoxButton.OK, MessageBoxImage.Error); + MessageBox.Show(message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); - Debug.Log($"Error: {log}", ConsoleColor.Red); + Debug.LogInternal(error: true, $"Error: {message}", ConsoleColor.Red); } public static void LogError(int errorCode, string message) { + if (Debug.FirstErrorCode == 0) + { + Debug.FirstErrorCode = errorCode; + } + Debug.LogError($"{message} (code 0x{errorCode:X})"); } @@ -131,5 +105,45 @@ public static void Release() Debug.diagnosticsDataById.Clear(); } + + private static void LogInternal(bool error, string log, ConsoleColor color) + { + DiagnosticsData diagnosticsData; + + Thread currentThread = Thread.CurrentThread; + int threadId = currentThread.ManagedThreadId; + + // Display main thread logs in standard output. + if (threadId == Debug.mainThreadId) + { + Console.ForegroundColor = color; + if (error) + { + Console.Error.WriteLine(log); + } + else + { + Console.WriteLine(log); + } + + Console.ResetColor(); + } + + lock (Debug.diagnosticsDataById) + { + if (!Debug.diagnosticsDataById.TryGetValue(threadId, out diagnosticsData)) + { + string threadName = Debug.threadCount > 0 ? $"{currentThread.Name} ({Debug.threadCount})" : "Application"; + diagnosticsData = new DiagnosticsData(threadName); + diagnosticsData.Initialize(Debug.diagnosticsFolderPath, threadId); + Debug.diagnosticsDataById.Add(threadId, diagnosticsData); + Debug.threadCount++; + + StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs("Data")); + } + } + + diagnosticsData.Log(log); + } } } diff --git a/Application/FileConverter/Registry.cs b/Application/FileConverter/Registry.cs index 477248c..38edb0f 100644 --- a/Application/FileConverter/Registry.cs +++ b/Application/FileConverter/Registry.cs @@ -58,7 +58,7 @@ public Entry[] SerializableEntries if (this.registryEntries.ContainsKey(entry.Key)) { - Diagnostics.Debug.Log("Ignore registry entry {0}.", entry.Key); + Diagnostics.Debug.Log($"Ignore registry entry {entry.Key}."); continue; } @@ -106,7 +106,7 @@ private static string GetUserRegistryFilePath } catch (Exception exception) { - Diagnostics.Debug.LogError("Can't convert registry value: {0}.", exception.Message); + Diagnostics.Debug.LogError($"Can't convert registry value: {exception.Message}."); } return defaultValue; @@ -128,7 +128,7 @@ public static void SetValue(string key, T value) } catch (Exception exception) { - Diagnostics.Debug.LogError("Can't convert registry value: {0}.", exception.Message); + Diagnostics.Debug.LogError($"Can't convert registry value: {exception.Message}."); } } @@ -143,7 +143,7 @@ public void Dispose() } catch (Exception exception) { - Diagnostics.Debug.LogError("Fail to save registry. {0}", exception.Message); + Diagnostics.Debug.LogError($"Fail to save registry. {exception.Message}"); } } @@ -164,11 +164,11 @@ private static void Load() catch (Exception exception) { Registry.instance = new Registry(); - Diagnostics.Debug.LogError("Fail to load registry. {0}", exception.Message); + Diagnostics.Debug.LogError($"Fail to load registry. {exception.Message}"); while (exception.InnerException != null) { exception = exception.InnerException; - Diagnostics.Debug.LogError("Inner exception: {0}", exception.Message); + Diagnostics.Debug.LogError($"Inner exception: {exception.Message}"); } } } diff --git a/Application/FileConverter/Services/ConversionService.cs b/Application/FileConverter/Services/ConversionService.cs index 3445c54..6233d81 100644 --- a/Application/FileConverter/Services/ConversionService.cs +++ b/Application/FileConverter/Services/ConversionService.cs @@ -33,12 +33,12 @@ public ConversionService(ISettingsService settingsService) this.ConversionJobs = this.conversionJobs.AsReadOnly(); this.numberOfConversionThread = this.settingsService.Settings.MaximumNumberOfSimultaneousConversions; - Diagnostics.Debug.Log("Maximum number of conversion threads: {0}", this.numberOfConversionThread); + Debug.Log($"Maximum number of conversion threads: {this.numberOfConversionThread}"); if (this.numberOfConversionThread <= 0) { this.numberOfConversionThread = System.Math.Max(1, Environment.ProcessorCount / 2); - Diagnostics.Debug.Log("The number of processors on this computer is {0}. Set the default number of conversion threads to {0}", settingsService.Settings.MaximumNumberOfSimultaneousConversions); + Debug.Log($"The number of processors on this computer is {settingsService.Settings.MaximumNumberOfSimultaneousConversions}. Set the default number of conversion threads to {settingsService.Settings.MaximumNumberOfSimultaneousConversions}"); } } @@ -176,7 +176,7 @@ private void ExecuteConversionJob(object parameter) } catch (Exception exception) { - Debug.LogError("Failure during conversion: {0}", exception.ToString()); + Debug.LogError($"Failure during conversion: {exception}"); } } @@ -189,13 +189,13 @@ private void CopyFilesToClipboard(object _filePaths) Debug.Log("Output files copied to the clipboard:"); for (int index = 0; index < FilePaths.Count; index++) { - Debug.Log(" {0}", FilePaths[index]); + Debug.Log($" {FilePaths[index]}"); } } catch (Exception exception) { Debug.Log("Can't copy files to the clipboard."); - Debug.Log("An exception has been thrown: {0}.", exception.ToString()); + Debug.Log($"An exception has been thrown: {exception}."); } } } diff --git a/Application/FileConverter/Services/NavigationService.cs b/Application/FileConverter/Services/NavigationService.cs index 8b53acd..7355a5d 100644 --- a/Application/FileConverter/Services/NavigationService.cs +++ b/Application/FileConverter/Services/NavigationService.cs @@ -112,7 +112,7 @@ public void Close([NotNull] string pageKey, bool alreadyClosing) if (pageKey == Pages.Upgrade) { upgradeService.CancelUpgrade(); - Application.Current.Shutdown(); + Application.AskForShutdown(); } else { @@ -123,7 +123,7 @@ public void Close([NotNull] string pageKey, bool alreadyClosing) } else { - Application.Current.Shutdown(); + Application.AskForShutdown(); } } } diff --git a/Application/FileConverter/Services/SettingsService.cs b/Application/FileConverter/Services/SettingsService.cs index 18c81bf..443d2d3 100644 --- a/Application/FileConverter/Services/SettingsService.cs +++ b/Application/FileConverter/Services/SettingsService.cs @@ -59,7 +59,7 @@ public bool PostInstallationInitialization() } else { - Debug.LogError("Default settings not found at path {0}. You should try to reinstall the application.", FileConverterExtension.PathHelpers.DefaultSettingsFilePath); + Debug.LogError($"Default settings not found at path {FileConverterExtension.PathHelpers.DefaultSettingsFilePath}. You should try to reinstall the application."); return false; } @@ -82,7 +82,7 @@ public bool PostInstallationInitialization() { this.MigrateSettingsToCurrentVersion(userSettings); - Debug.Log("File converter settings have been imported from version {0} to version {1}.", userSettings.SerializationVersion, Settings.Version); + Debug.Log($"File converter settings have been imported from version {userSettings.SerializationVersion} to version {Settings.Version}."); userSettings.SerializationVersion = Settings.Version; } @@ -154,7 +154,7 @@ private Settings Load() { this.MigrateSettingsToCurrentVersion(userSettings); - Diagnostics.Debug.Log("File converter settings has been imported from version {0} to version {1}.", userSettings.SerializationVersion, Settings.Version); + Debug.Log($"File converter settings has been imported from version {userSettings.SerializationVersion} to version {Settings.Version}."); userSettings.SerializationVersion = Settings.Version; this.Save(userSettings); } @@ -171,12 +171,12 @@ private Settings Load() } catch (Exception exception) { - Debug.LogError("Fail to load file converter default settings. {0}", exception.Message); + Debug.LogError($"Fail to load file converter default settings. {exception.Message}"); } } else { - Debug.LogError("Default settings not found at path {0}. You should try to reinstall the application.", FileConverterExtension.PathHelpers.DefaultSettingsFilePath); + Debug.LogError($"Default settings not found at path {FileConverterExtension.PathHelpers.DefaultSettingsFilePath}. You should try to reinstall the application."); } } diff --git a/Application/FileConverter/Settings.cs b/Application/FileConverter/Settings.cs index 86076c9..4259a9f 100644 --- a/Application/FileConverter/Settings.cs +++ b/Application/FileConverter/Settings.cs @@ -254,7 +254,7 @@ public void OnDeserializationComplete() } else { - Diagnostics.Debug.Log("Can't find supported culture info for culture {0}. Fallback to default culture.", currentUICulture); + Diagnostics.Debug.Log($"Can't find supported culture info for culture {currentUICulture}. Fallback to default culture."); this.ApplicationLanguage = CultureInfo.GetCultureInfo("en"); } } From 47c425e777d1f839617dc0aad4ee72a270e04f93 Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Sun, 10 Mar 2024 21:17:47 +0100 Subject: [PATCH 10/14] Fixes: Issue where standard output was not activated when started from command line. --- Application/FileConverter/Application.xaml.cs | 11 ++++++++++- CHANGELOG.md | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Application/FileConverter/Application.xaml.cs b/Application/FileConverter/Application.xaml.cs index 78487ce..4d5181b 100644 --- a/Application/FileConverter/Application.xaml.cs +++ b/Application/FileConverter/Application.xaml.cs @@ -19,6 +19,7 @@ namespace FileConverter using System.Collections.Generic; using System.Diagnostics; using System.IO; + using System.Runtime.InteropServices; using System.Security.Principal; using System.Threading; using System.Windows; @@ -47,7 +48,12 @@ public partial class Application : System.Windows.Application private bool verbose; private bool showSettings; private bool showHelp; - + + [DllImport("kernel32.dll")] + static extern bool AttachConsole(uint dwProcessId); + + const uint ATTACH_PARENT_PROCESS = 0x0ffffffff; + public event EventHandler OnApplicationTerminate; public static Version ApplicationVersion => Application.Version; @@ -78,6 +84,9 @@ public static void AskForShutdown() protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); + + // Redirect standard output to the parent process in case the application is launch from command line. + AttachConsole(ATTACH_PARENT_PROCESS); this.RegisterServices(); diff --git a/CHANGELOG.md b/CHANGELOG.md index cf3c0cb..d3cbb0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - New: Tempo and pitch conversion presets in default settings (github issue #18). - Fixes: Issue where newly supported input types (ts, heic, ...) were not used in presets (github issue #388). +- Fixes: Issue where standard output was not activated when started from command line. ## Version 2.0 From c1e7a942eb03eaf950416b2c9113c4d807771668 Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Sun, 10 Mar 2024 22:13:38 +0100 Subject: [PATCH 11/14] Fixes: Issue where File Converter was not appearing in Windows explorer after a successful install (issue #389) --- Application/FileConverter/Helpers.cs | 59 +++++++++------------------- CHANGELOG.md | 1 + Installer/Product.wxs | 4 +- 3 files changed, 22 insertions(+), 42 deletions(-) diff --git a/Application/FileConverter/Helpers.cs b/Application/FileConverter/Helpers.cs index 6d7bb62..c86ca27 100644 --- a/Application/FileConverter/Helpers.cs +++ b/Application/FileConverter/Helpers.cs @@ -8,13 +8,11 @@ namespace FileConverter using System.IO; using System.Reflection; using System.Threading; - using System.ComponentModel.Composition.Hosting; using FileConverter.ConversionJobs; using FileConverter.Services; - using SharpShell; - using SharpShell.ServerRegistration; + using SharpShell.Helpers; using Microsoft.Win32; using CommunityToolkit.Mvvm.DependencyInjection; @@ -124,30 +122,20 @@ public static bool RegisterShellExtension(string shellExtensionPath) Diagnostics.Debug.Log($"Install and register shell extension: {shellExtensionPath}."); - try + var regasm = new RegAsm(); + var success = regasm.Register64(shellExtensionPath, true); + if (success) { - var catalog = new AssemblyCatalog(shellExtensionPath); - var container = new CompositionContainer(catalog); - var server = container.GetExport().Value; - - RegistrationType registrationType = RegistrationType.OS64Bit; -#if BUILD32 - registrationType = RegistrationType.OS32Bit; -#endif - - ServerRegistrationManager.InstallServer(server, registrationType, true); - Diagnostics.Debug.Log($"Shell extension has been installed correctly."); - - ServerRegistrationManager.RegisterServer(server, registrationType); - Diagnostics.Debug.Log($"Shell extension has been registered correctly."); + Diagnostics.Debug.Log($"{shellExtensionPath} installed and registered."); + Diagnostics.Debug.Log(regasm.StandardOutput); + return true; } - catch (Exception exception) + else { - Diagnostics.Debug.LogError($"An exception has been thrown during shell extension {shellExtensionPath} registration.\n{exception}"); + Diagnostics.Debug.LogError(errorCode: 0x05, $"{shellExtensionPath} failed to register."); + Diagnostics.Debug.LogError(regasm.StandardError); return false; } - - return true; } public static bool UnregisterExtension(string shellExtensionPath) @@ -166,29 +154,20 @@ public static bool UnregisterExtension(string shellExtensionPath) Diagnostics.Debug.Log($"Unregister and uninstall shell extension: {shellExtensionPath}."); - try + var regasm = new RegAsm(); + var success = regasm.Unregister64(shellExtensionPath); + if (success) { - var catalog = new AssemblyCatalog(shellExtensionPath); - var container = new CompositionContainer(catalog); - var server = container.GetExport().Value; - - RegistrationType registrationType = RegistrationType.OS64Bit; -#if BUILD32 - registrationType = RegistrationType.OS32Bit; -#endif - - ServerRegistrationManager.UnregisterServer(server, registrationType); - Diagnostics.Debug.Log($"Shell extension has been successfully unregistered."); - ServerRegistrationManager.UninstallServer(server, registrationType); - Diagnostics.Debug.Log($"Shell extension has been successfully uninstalled."); + Diagnostics.Debug.Log($"{shellExtensionPath} uninstalled."); + Diagnostics.Debug.Log(regasm.StandardOutput); + return true; } - catch (Exception exception) + else { - Diagnostics.Debug.LogError($"An exception has been thrown during shell extension {shellExtensionPath} unregistration.\n{exception}"); + Diagnostics.Debug.LogError(errorCode: 0x05, $"{shellExtensionPath} failed to uninstall."); + Diagnostics.Debug.LogError(regasm.StandardError); return false; } - - return true; } public static IEnumerable GetSupportedCultures() diff --git a/CHANGELOG.md b/CHANGELOG.md index d3cbb0f..1de4ee7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Version 2.0.1 - New: Tempo and pitch conversion presets in default settings (github issue #18). +- Fixes: Issue where File Converter was not appearing in Windows explorer after a successful install (issue #389). - Fixes: Issue where newly supported input types (ts, heic, ...) were not used in presets (github issue #388). - Fixes: Issue where standard output was not activated when started from command line. diff --git a/Installer/Product.wxs b/Installer/Product.wxs index 42b50ae..6c1d539 100644 --- a/Installer/Product.wxs +++ b/Installer/Product.wxs @@ -14,8 +14,8 @@ - - + + From eea2bc680eaabfc8f136c26b9b5b58c926d03f77 Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Sun, 10 Mar 2024 23:47:46 +0100 Subject: [PATCH 12/14] Change: Make installer only works for Windows 7+ --- Installer/Installer.wixproj | 2 +- Installer/Product.wxs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Installer/Installer.wixproj b/Installer/Installer.wixproj index af073de..2543c04 100644 --- a/Installer/Installer.wixproj +++ b/Installer/Installer.wixproj @@ -1,7 +1,7 @@  - 3.9 + 2.0 FileConverter-setup bin\$(Platform)\$(Configuration)\ obj\$(Platform)\$(Configuration)\ diff --git a/Installer/Product.wxs b/Installer/Product.wxs index 6c1d539..2c2c7d0 100644 --- a/Installer/Product.wxs +++ b/Installer/Product.wxs @@ -1,6 +1,6 @@  - + @@ -29,7 +29,7 @@ - + @@ -37,7 +37,7 @@ - + From 61761d18a33e31eb3fd4f6201dd4a8ccd244bb85 Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Sun, 10 Mar 2024 23:48:18 +0100 Subject: [PATCH 13/14] Update version number to 2.0.1 --- Application/FileConverter/Application.xaml.cs | 2 +- Installer/Installer.wixproj | 2 +- Installer/Product.wxs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Application/FileConverter/Application.xaml.cs b/Application/FileConverter/Application.xaml.cs index 4d5181b..c0b2428 100644 --- a/Application/FileConverter/Application.xaml.cs +++ b/Application/FileConverter/Application.xaml.cs @@ -39,7 +39,7 @@ public partial class Application : System.Windows.Application { Major = 2, Minor = 0, - Patch = 0, + Patch = 1, }; private bool needToRunConversionThread; diff --git a/Installer/Installer.wixproj b/Installer/Installer.wixproj index 2543c04..83d3986 100644 --- a/Installer/Installer.wixproj +++ b/Installer/Installer.wixproj @@ -1,7 +1,7 @@  - 2.0 + 2.0.1 FileConverter-setup bin\$(Platform)\$(Configuration)\ obj\$(Platform)\$(Configuration)\ diff --git a/Installer/Product.wxs b/Installer/Product.wxs index 2c2c7d0..a8121b6 100644 --- a/Installer/Product.wxs +++ b/Installer/Product.wxs @@ -1,6 +1,6 @@  - + From 2088fa2b4b67140ab57f24900b154d8d499841e2 Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Sun, 10 Mar 2024 23:55:25 +0100 Subject: [PATCH 14/14] - New: Russian translation (thanks to dragomano). --- Application/FileConverter/FileConverter.csproj | 1 + CHANGELOG.md | 1 + 2 files changed, 2 insertions(+) diff --git a/Application/FileConverter/FileConverter.csproj b/Application/FileConverter/FileConverter.csproj index d29711b..decb702 100644 --- a/Application/FileConverter/FileConverter.csproj +++ b/Application/FileConverter/FileConverter.csproj @@ -357,6 +357,7 @@ Resources.Designer.cs Designer + diff --git a/CHANGELOG.md b/CHANGELOG.md index 1de4ee7..5275e7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Version 2.0.1 - New: Tempo and pitch conversion presets in default settings (github issue #18). +- New: Russian translation (thanks to dragomano). - Fixes: Issue where File Converter was not appearing in Windows explorer after a successful install (issue #389). - Fixes: Issue where newly supported input types (ts, heic, ...) were not used in presets (github issue #388). - Fixes: Issue where standard output was not activated when started from command line.