Compare commits

..

279 Commits
0.2.1 ... 0.3.4

Author SHA1 Message Date
Paddy Xu
a20b4714ec fix possible crash (?) due to DateTime format 2018-02-18 19:07:44 +02:00
Paddy Xu
354bbfc1ca fix crash 2018-02-12 21:06:20 +02:00
Paddy Xu
4133d2148c do not show info icon; do not retain window position (fix for #179); update NuGet packages 2018-02-12 19:30:38 +02:00
Paddy Xu
4e356f9e77 remove useless code 2018-02-12 19:30:37 +02:00
Paddy Xu
39b93b11f1 Fix #173: new OpenWith icon 2018-02-12 19:30:32 +02:00
Paddy Xu
189e3a70d1 Fix #175: do not restore position when closing maximised 2018-02-12 19:30:32 +02:00
Paddy Xu
b04fbabae6 Fix windows timer resolution 2018-02-12 19:30:31 +02:00
Paddy Xu
dada8bc6e7 Revert "make xml"
This reverts commit 5c8c33633a7351c2cf3dccfe9246f61af44b9de1.
2018-02-12 19:30:31 +02:00
Paddy Xu
6f60f41d1c make xml 2018-02-12 19:30:30 +02:00
Paddy Xu
6bc990bbf9 move to Plugin namespace 2018-02-12 19:30:30 +02:00
Paddy Xu
197bfee1da fix path 2018-02-12 19:30:29 +02:00
Paddy Xu
57f129bda3 fix translations and settings 2018-02-12 19:30:29 +02:00
Paddy Xu
56af2311b9 abstract plugin interface 2018-02-12 19:30:28 +02:00
Paddy Xu
d50d757022 tooltip 2018-02-12 19:30:27 +02:00
Paddy Xu
fa0824bce9 remember volume 2018-02-12 19:30:27 +02:00
Paddy Xu
5b0da969af delete cover art when close 2018-02-12 19:30:04 +02:00
Paddy Xu
d2fdcd240b back to vlc 2018-02-12 19:30:01 +02:00
Paddy Xu
3f9794c2a4 Update README.md 2018-02-08 20:05:45 +02:00
Paddy Xu
aa716dd04b update FFME to fix IsDisposed issue: unosquare/ffmediaelement#147 2018-02-01 20:35:17 +02:00
Paddy Xu
804876a987 remove strong-name signing 2018-01-27 14:44:53 +02:00
Paddy Xu
a63fd77a50 shutdown old thread 2018-01-27 10:35:20 +02:00
Paddy Xu
914cc7c3a7 Merge branch 'master' of github.com:xupefei/QuickLook 2018-01-27 10:34:33 +02:00
Paddy Xu
bb7fb114f8 Revert "shutdown old thread"
This reverts commit 3ff693ac37.
2018-01-27 10:31:03 +02:00
Paddy Xu
3ff693ac37 shutdown old thread 2018-01-26 15:42:09 +02:00
Naoto Ishida
3c229a8526 Add Japanese language support (#164) 2018-01-25 18:18:24 +02:00
Patrick Sletvold
36484beb58 Add Norwegian (bokmål) translation (#171)
* Add Norwegian translation

* Add Norwegian translation
2018-01-25 18:12:32 +02:00
Paddy Xu
2af22cde92 temporary ugly fix for memory leak 2018-01-25 02:18:02 +02:00
Paddy Xu
a17b7f05d7 cancel waiting pipe commands 2018-01-24 23:01:29 +02:00
Paddy Xu
c1bcf311bc fix #115 and #129: use FFmpeg 3.4.0 GPL libs, use ffme 2.0.b9 with patch unosquare/ffmediaelement#147 and autogen 3.4.0.2 2018-01-24 23:01:00 +02:00
Paddy Xu
76dd2feb30 remove all destructors 2018-01-24 19:11:49 +02:00
Paddy Xu
4b9b6c7233 fix: window not closing when pressing Spacebar while having focus 2018-01-24 19:11:48 +02:00
Paddy Xu
6d78650b12 Update ViewWindowManager.cs 2018-01-21 16:43:16 +02:00
Paddy Xu
e40bac0924 Update ViewWindowManager.cs 2018-01-21 16:42:37 +02:00
Paddy Xu
5c0f88a961 write error log to file 2018-01-21 16:36:18 +02:00
Paddy Xu
5667f98a01 handle TagLib exception 2018-01-21 16:11:20 +02:00
Paddy Xu
35c22db10c Fix #163: add .ts and .tp (=m2ts) format 2018-01-21 13:43:51 +02:00
Paddy Xu
5c02a8c9cf Fix #162: switch preview when calling from command-line 2018-01-20 16:42:07 +02:00
Paddy Xu
2ba3fcdf6e Continue on f321e243ba: fix broken window positioning 2018-01-13 00:38:05 +02:00
Paddy Xu
a969687b7b Bring back transparent window 2018-01-12 23:30:25 +02:00
Paddy Xu
c622ed748a enlarge initial pdf page size: address #143. 2018-01-09 23:49:16 +02:00
Paddy Xu
3be25ac28f Continue on f321e243ba: adjust maximize behaviour 2018-01-08 21:04:40 +02:00
Paddy Xu
0914b264f4 Hide meta icon in Pdf viewing 2018-01-08 21:04:40 +02:00
Paddy Xu
c791add587 Update README.md 2017-12-29 21:22:40 +02:00
Paddy Xu
311d723bb3 write error log to Event 2017-12-28 22:46:15 +02:00
Paddy Xu
c78fbb009a Fix #153: determine imagetype by signature 2017-12-28 22:37:10 +02:00
Krasnaya Ploshchad’
a502b2363a Update README.md (#156)
Microsoft renamed Windows Store to Microsoft Store, this following that.
2017-12-25 10:16:12 +02:00
Paddy Xu
b4198f61f2 Show Exif info when previewing images 2017-12-22 19:24:17 +02:00
Paddy Xu
9369a94350 Update README.md 2017-12-22 13:58:46 +02:00
Paddy Xu
1052d873e1 update NuGet packages 2017-12-22 13:21:00 +02:00
Paddy Xu
97b749e64f async archive loading 2017-12-22 13:19:49 +02:00
Paddy Xu
dedac98702 Continue on f321e243ba: handle failure 2017-12-22 11:52:48 +02:00
Paddy Xu
3014b30358 do not show header 2017-12-22 11:52:10 +02:00
Paddy Xu
99d067ea2d remove useless references 2017-12-22 10:53:12 +02:00
Paddy Xu
abc80e046d fix Pdf zoom-to-fit issue when switching pages 2017-12-22 10:52:37 +02:00
Paddy Xu
fe39854b57 Fix #154: Switch to Pdfium; better PDF async loading 2017-12-22 01:28:30 +02:00
Paddy Xu
1bcfd8db08 handle icon exception 2017-12-21 22:15:11 +02:00
Paddy Xu
f0990faa56 Revert "Async call sometimes crash because NullReferenceException at <BeginShow>b__0()"
This reverts commit b0e4f19491.
2017-12-21 18:54:24 +02:00
Paddy Xu
b0e4f19491 Async call sometimes crash because NullReferenceException at <BeginShow>b__0() 2017-12-21 18:03:32 +02:00
Paddy Xu
f321e243ba Test: use new window each time (some people report a slowness... but I can't reproduce) 2017-12-20 22:23:07 +02:00
Paddy Xu
6cd837b423 Parallel PDF rendering 2017-12-09 15:55:24 +02:00
Paddy Xu
82994b69bc Merge branch 'master' of github.com:xupefei/QuickLook 2017-12-09 14:37:59 +02:00
Paddy Xu
b1e5ce0172 Fix #150: make use of color space assigned with image 2017-12-09 14:37:53 +02:00
ARL
50d839a02f French translation (#147)
* Add french language Translations.config

* Add french language TextViewer
2017-12-05 10:25:47 +02:00
Ecron
18f3f57606 Catalan translation (#142)
* Catalan translation

Added Catalan translation

* Added Catalan translation

Added Catalan translation
2017-12-01 12:11:57 +02:00
arca20
1988cd3c09 Translate in German(de-DE) (#141)
* -translate to German (de-DE)

* correction the Translations.config
2017-11-29 10:22:48 +02:00
Paddy Xu
d481bcdceb reformat 2017-11-23 22:21:58 +02:00
Paddy Xu
df0ba78298 Address #122: final solution for window resizing by bring macOS's logic 2017-11-23 22:20:25 +02:00
Paddy Xu
2fda049c26 fix 03807a1afb 2017-11-19 21:58:06 +02:00
Paddy Xu
f8d24aa191 add 1px border for keeping resizing 2017-11-17 20:08:37 +02:00
Paddy Xu
057126a7a0 deal with CreateProcess failure 2017-11-17 12:29:50 +02:00
Paddy Xu
1980ed1590 do not crash when Plugin.Prepare() failed 2017-11-17 12:14:49 +02:00
Paddy Xu
93dae0a8ca #116: indicate current zoom level for images 2017-11-16 22:47:23 +02:00
Paddy Xu
734b0e36e3 Fix #128: the "previous state" of a "DisposeOpPrevious" frame is its previous frame - for example,
1: APNGDisposeOpNone
2: APNGDisposeOpNone        // should use rendered frame 1
3: APNGDisposeOpPrevious    // should use rendered frame 1
4: APNGDisposeOpPrevious    // should use rendered frame 1, NOT frame 2
5: APNGDisposeOpNone        // should use rendered frame 4
2017-11-16 18:53:12 +02:00
Paddy Xu
0d07315253 Update README.md 2017-11-15 22:48:27 +02:00
Paddy Xu
0320ce13b4 Merge branch 'master' of github.com:xupefei/QuickLook 2017-11-15 20:45:26 +02:00
Paddy Xu
03807a1afb handle corrupted configuration when upgrading. 2017-11-15 20:45:11 +02:00
Paddy Xu
02f2cef5e3 Update README.md 2017-11-14 11:10:37 +02:00
Paddy Xu
462891951b Fix #121: do not preview when pressing Win key 2017-11-12 13:44:33 +02:00
Paddy Xu
5a83dce8ed sometime this throws 2017-11-09 20:22:42 +02:00
Paddy Xu
04b1180b26 add mts format 2017-11-09 20:22:24 +02:00
Paddy Xu
ba6efbe8ea Fix #56#issuecomment-342538426: use colourful icon on pre Windows 10 OSs 2017-11-07 18:39:21 +02:00
Paddy Xu
6b2a481cf2 preview size, continued 2017-11-07 18:34:27 +02:00
Paddy Xu
d6aa4d6959 Fix #114: now the preview window should big enough 2017-11-07 18:20:11 +02:00
Paddy Xu
e56c33cbd8 Merge branch 'master' of github.com:xupefei/QuickLook 2017-11-06 20:09:09 +02:00
Paddy Xu
0e5809120d Fix #113: read buffer before waiting 2017-11-06 20:09:01 +02:00
Paddy Xu
42cbf9ecdf Update README.md 2017-11-06 10:21:23 +02:00
Paddy Xu
a2660fc15c use vc2008 binaries 2017-11-06 00:26:05 +02:00
Paddy Xu
31279b1015 Partially revert "update scripts"
This reverts commit a5320b28ee.
2017-11-06 00:12:18 +02:00
Paddy Xu
ff7d9c0aa9 distribute long class 2017-11-05 23:10:10 +02:00
Paddy Xu
c643d9a4f5 Merge branch 'master' of github.com:xupefei/QuickLook 2017-11-05 22:59:47 +02:00
Paddy Xu
d34e1d379c adjust resize behaviour 2017-11-05 22:59:35 +02:00
Paddy Xu
c9ca36085e Merge pull request #111 from BarretoDiego/master
pt-BR localization
2017-11-05 02:16:48 +02:00
Paddy Xu
24fafc5746 Fix #106: display thumbnails 2017-11-05 02:15:00 +02:00
Diego Barreto da Cunha
de7e09acc7 pt-BR localization
Added string configuration for Brazilian Portuguese language.
2017-11-04 20:28:25 +00:00
Paddy Xu
edc073a0ea dark theme for ImageViewer 2017-11-04 16:30:56 +02:00
Paddy Xu
49e9ccd0ca Fix #98: preserve window size when switching to another file 2017-11-04 14:31:28 +02:00
Paddy Xu
775c63a301 use Windows SDK 16299 2017-11-04 13:45:04 +02:00
Paddy Xu
de07befb88 Fix #102: unfortunately QL does not run on Windows 10 S 2017-11-04 13:33:01 +02:00
Paddy Xu
59d957f06c Fix #93: do not hide title bar for ImageViewer 2017-11-04 11:07:17 +02:00
Paddy Xu
7ba410bb4e limit title-bar button width; minor fixes and cleanup 2017-11-02 22:32:49 +02:00
Paddy Xu
5055669981 Fix #103: make title-bar button wider 2017-11-02 22:32:11 +02:00
Paddy Xu
8440bc6fc7 remove transparent window 2017-11-02 21:49:20 +02:00
Paddy Xu
fe5e8bf730 fix again 2017-11-02 20:55:39 +02:00
Paddy Xu
9b2beb3d37 fix build 2017-11-02 20:18:40 +02:00
Paddy Xu
1b1b74f39b Merge branch 'master' of github.com:xupefei/QuickLook 2017-11-02 20:07:30 +02:00
Paddy Xu
5db88cffe3 bye vlc 2017-11-02 20:07:23 +02:00
Paddy Xu
c1406e6bfc Update README.md 2017-10-31 12:51:48 +02:00
Paddy Xu
6bfd26bf0c Merge pull request #108 from Cologler/patch-1
fixed #105
2017-10-30 15:44:33 +02:00
cologler
22fda2dbba fixed #105 2017-10-30 21:35:01 +08:00
Paddy Xu
470eb93a3f Update README.md 2017-10-29 12:29:58 +02:00
Paddy Xu
ea4c1cbb92 remove round corner in WIndows 7 2017-10-22 18:39:28 +03:00
Paddy Xu
c15f589a8f do not crash when other threads failed 2017-10-22 16:34:19 +03:00
Paddy Xu
778c578656 use LGPL builds 2017-10-22 16:33:26 +03:00
Paddy Xu
b34c890d3e update app icons 2017-10-22 15:40:32 +03:00
Paddy Xu
63e7b3dd89 fix memory leak 2017-10-19 22:31:58 +03:00
Paddy Xu
db9111ff22 Separate TopMost and Pin buttons 2017-10-17 00:18:58 +03:00
Paddy Xu
c11bd9dc7b HW acceleration for videos 2017-10-16 22:43:51 +03:00
Paddy Xu
61d4f7d2c2 go back to FFME. There is still a memory leak for cover arts. 2017-10-16 00:40:01 +03:00
Paddy Xu
95995eab0e remove Vlc libs and add home-cooked GPL ffmpeg libs 2017-10-15 20:01:00 +03:00
Paddy Xu
1b2f5fabfa Fix #101: Do not preview when Listary toolbar is visible 2017-10-15 18:04:22 +03:00
Paddy Xu
3f262dfcd2 upgrade NuGet packages 2017-10-15 16:27:17 +03:00
Paddy Xu
6e5e7cb891 Fix #92: Make sure the handle is closed 2017-10-15 16:10:29 +03:00
Paddy Xu
66fdeefe84 Revert "Limit max size of "open with" button"
This reverts commit 4d564e29de.
2017-10-14 23:32:43 +03:00
Paddy Xu
59c4216bca Fix #93: Ignore image resolutions 2017-10-14 22:32:05 +03:00
Paddy Xu
d36278fd5e Do not show page list for single-page PDFs 2017-10-14 19:00:30 +03:00
Paddy Xu
4d564e29de Limit max size of "open with" button 2017-10-14 19:00:29 +03:00
Paddy Xu
ebac276af7 Upgrade to new Windows SDK 2017-10-14 19:00:29 +03:00
Paddy Xu
5a3df33890 Merge pull request #99 from Retrobottega/master
Added Italian Translation
2017-10-07 20:22:14 +03:00
Salvatore Gentile
4f86e075e0 Added Italian Translation 2017-10-07 16:29:49 +02:00
Paddy Xu
333857ff81 Fix #78: Use Gif Disposal flag in the correct way 2017-10-05 20:54:57 +03:00
Paddy Xu
abd69a2acd Merge pull request #89 from Scarwoman/patch-5
Update Translations.config
2017-10-01 09:54:48 +02:00
Paddy Xu
a6bf4fc2fc Merge pull request #88 from Scarwoman/patch-3
Update Translations.config
2017-10-01 09:54:38 +02:00
Scarwoman
2ca07cafd0 Update Translations.config 2017-09-28 11:15:08 +02:00
Scarwoman
f2e6244b4a Update Translations.config
Dutch and belgium translation
2017-09-28 11:12:08 +02:00
Scarwoman
01d53fe29c Update Translations.config
Dutch translation
2017-09-28 10:56:12 +02:00
Paddy Xu
7c0380c25e change background color to (very) light gray 2017-08-19 13:39:15 +03:00
Paddy Xu
2a9777e3e7 Update README.md 2017-08-19 13:30:38 +03:00
Paddy Xu
96efbbcc9f Merge pull request #71 from emannxx/master
Portuguese language translation
2017-08-19 12:34:44 +03:00
Emanuel Alves
4d07fc41f0 Text-Viewer 2017-08-15 01:24:40 +01:00
Emanuel Alves
a1320fe8da Portuguese language translation 2017-08-15 01:16:36 +01:00
Paddy Xu
b4ed9b4e7d add volume slider 2017-08-13 23:01:07 +03:00
Paddy Xu
11ab3d7c42 restore determining PDF fiels via file content for previewing .ai files. 2017-08-13 22:27:55 +03:00
Paddy Xu
fcee5844cc use VS tile generator for tile images 2017-08-13 18:40:54 +03:00
Paddy Xu
bff0dcfb7a make blur invisible by default, remove colored title bar on InfoPanel 2017-08-13 11:08:20 +03:00
Paddy Xu
589693778a shorter auto-hide time 2017-08-13 11:03:18 +03:00
Paddy Xu
dbbdfe876c Fix #68: do not show preview when not activated 2017-08-13 11:00:14 +03:00
Paddy Xu
04b9f7b5c1 update readme 2017-08-13 01:08:41 +03:00
Paddy Xu
1d7c95a822 update tile images 2017-08-13 00:20:01 +03:00
Paddy Xu
e4ab7d0a32 new icons 2017-08-12 23:31:50 +03:00
Paddy Xu
6027a387b0 Fix ZoomToFit 2017-08-12 21:21:16 +03:00
Paddy Xu
3e2336a63d Fix #63: add Netpbm formats 2017-08-12 21:20:57 +03:00
Paddy Xu
1260afb2c4 Merge pull request #67 from xupefei/fluent
Redesigned UI according to the Fluent design system
2017-08-12 20:58:35 +03:00
Paddy Xu
dbee403b59 Merge branch 'master' into fluent 2017-08-12 20:55:33 +03:00
Paddy Xu
7676d5867b all operations pass though Pipe 2017-08-12 18:20:29 +03:00
Paddy Xu
6bae00361b minor zoom improvements 2017-08-12 01:19:10 +03:00
Paddy Xu
1c18890fbf add Segoe MDL2 font as assets: this font allows editable embedding 2017-08-11 23:16:35 +03:00
Paddy Xu
8e400e7ee5 fix blur coordinate error 2017-08-11 20:14:45 +03:00
Paddy Xu
cd9b713c41 Finish ViedoViewer (except volume slider) 2017-08-11 00:29:24 +03:00
Paddy Xu
9ce0776d53 almost done videoviewer. WIP modify app style to per-window one. 2017-08-10 01:15:32 +03:00
Paddy Xu
346ec59ea5 Merge pull request #64 from KrasnayaPloshchad/patch-3
Minor fix for zh-TW translation
2017-08-10 01:14:50 +03:00
Krasnaya Ploshchad’
bc533f3d18 Minor fix for zh-TW translation 2017-08-09 19:05:05 +08:00
Paddy Xu
efaca311fc wip videoviewer 2017-08-08 23:19:46 +03:00
Paddy Xu
2b3338cc43 dark theme; wip videopleyer 2017-08-06 23:33:01 +03:00
Paddy Xu
56cb31fd2a finish auto-hide 2017-08-06 21:01:02 +03:00
Paddy Xu
5b97e7ef60 wip 2 2017-08-06 17:27:30 +03:00
Paddy Xu
3a20245304 wip 2017-08-06 15:06:55 +03:00
Paddy Xu
768425ad0f add inner padding 2017-08-06 00:39:41 +03:00
Paddy Xu
60cd782c64 WIP: more new styles 2017-08-06 00:17:51 +03:00
Paddy Xu
8d59e7138c WIP #56: adjust shadows; add Gaussian blur, try out the new InfoPanel 2017-08-04 22:07:42 +03:00
Paddy Xu
e79de6c36d use native rotate method suggested by @dlemstra 2017-08-04 22:07:02 +03:00
Paddy Xu
810de851ff Merge pull request #60 from KrasnayaPloshchad/patch-3
Improve font family for zh-TW locale
2017-08-04 18:58:58 +03:00
Krasnaya Ploshchad’
15af258db0 Improve zh-TW font family
zh-TW locale generally does not use SimSun, use MingLiU instead.
2017-08-04 23:23:24 +08:00
Paddy Xu
15d94d2c4b Merge pull request #59 from KrasnayaPloshchad/patch-1
TextViewer: Add Korean fonts used for Korean locale
2017-08-04 16:50:59 +03:00
Krasnaya Ploshchad’
dae2a3a512 Add Korean fonts 2017-08-04 21:05:55 +08:00
Paddy Xu
2575d4c909 update vlclib caches 2017-08-02 00:50:34 +03:00
Paddy Xu
f15f65192d sign all compoments 2017-08-02 00:29:41 +03:00
Paddy Xu
dad0f0e962 add missing vlc libs 2017-08-02 00:13:21 +03:00
Paddy Xu
7d8a728925 move cover arts later as UWP is not happy with this 2017-08-02 00:00:00 +03:00
Paddy Xu
bf2f0f5ad7 Fix #50: window moved unexpectedly when new size is smaller than min size 2017-08-01 23:44:52 +03:00
Paddy Xu
3994039864 async Vlc disposal 2017-08-01 23:39:44 +03:00
Paddy Xu
a5320b28ee update scripts 2017-08-01 23:29:10 +03:00
Paddy Xu
94a18707dd let WPF do the decoding 2017-08-01 23:28:58 +03:00
Paddy Xu
67cc8aa480 refine 2017-08-01 23:06:38 +03:00
Paddy Xu
da66c27580 Fix #55: singular form for InfoPanel; add zh-TW translation 2017-08-01 23:00:00 +03:00
Paddy Xu
4acac51a8d do not rotate unless nessessary 2017-08-01 22:05:25 +03:00
Paddy Xu
94075595de switch to LibVlc 2017-08-01 21:28:50 +03:00
Paddy Xu
5ac88dbd1c remove languages other than en-us in AppxManifest.xml 2017-07-31 01:39:33 +03:00
Paddy Xu
24c03163f6 let textviewer be piror to videoviewer 2017-07-31 00:34:42 +03:00
Paddy Xu
4ffe24f427 useless 2017-07-31 00:19:40 +03:00
Paddy Xu
2f12127cc9 Use my home-made GIF and APNG animator. It's really save CPU compared to previous one! 2017-07-31 00:14:21 +03:00
Paddy Xu
071a3b4f22 remove handler when disposing 2017-07-31 00:11:58 +03:00
Paddy Xu
6465ea9ed6 minor changes 2017-07-30 23:37:07 +03:00
Paddy Xu
c97f932bc3 faster text checking 2017-07-30 23:35:52 +03:00
Paddy Xu
41aa42d897 refine UI and stability 2017-07-30 01:18:37 +03:00
Paddy Xu
76dbdcdfa0 Merge branch 'ffme' 2017-07-29 22:35:23 +03:00
Paddy Xu
76b6b648cc fix rm issue 2017-07-29 22:35:06 +03:00
Paddy Xu
694713ba17 set limit to button size 2017-07-29 22:34:59 +03:00
Paddy Xu
6c64aa7c3d switch to new FFME control 2017-07-29 22:29:06 +03:00
Paddy Xu
882078cd60 set limit to button size 2017-07-29 22:28:48 +03:00
Paddy Xu
19773884de fix rm issue 2017-07-29 22:28:26 +03:00
Paddy Xu
dad30d33bd move to new FFME control and probe media info 2017-07-29 16:20:16 +03:00
Paddy Xu
bf199478d7 Merge branch 'master' into ffme 2017-07-29 12:12:23 +03:00
Paddy Xu
a5df20851d add seek buttons 2017-07-29 11:49:48 +03:00
Paddy Xu
227cc6eb49 add FFmpeg 3.2.4 GPL binaries 2017-07-29 00:29:46 +03:00
Paddy Xu
f03719af81 modernise video player UI 2017-07-29 00:19:50 +03:00
Paddy Xu
73d131972a animate the pinned button 2017-07-28 22:25:07 +03:00
Paddy Xu
fa2e34a065 Fix #46: turn the 📌 icon into ✖ after pinned 2017-07-28 20:49:49 +03:00
Paddy Xu
2204f27b01 Hopefully fix a crash bug related to #32, #37 and #44 2017-07-27 23:36:30 +03:00
Paddy Xu
3fb18391df move cmd to ps 2017-07-25 23:29:51 +03:00
Paddy Xu
2138c0e123 add hi-res images to .appx packaging 2017-07-25 23:22:07 +03:00
Paddy Xu
3df710e1fc minor adjustments 2017-07-24 23:05:17 +03:00
Paddy Xu
f627011802 fix scrollbar bug 2017-07-24 21:41:04 +03:00
Paddy Xu
2ef607ecb9 unify file encoding 2017-07-23 22:43:17 +03:00
Paddy Xu
2820b840e4 show update log after upgraded 2017-07-23 22:39:44 +03:00
Paddy Xu
78fe8d2558 replace old Ude lib with new library 2017-07-23 20:18:27 +03:00
Paddy Xu
7b6fa41baf detect string encoding when previewing .zip files, fix #24. 2017-07-23 20:16:57 +03:00
Paddy Xu
44f52db289 Handle MHTML formats 2017-07-23 16:04:59 +03:00
Paddy Xu
75bed46029 add modifier key to menu item 2017-07-23 15:12:42 +03:00
Paddy Xu
fe5079a571 Merge pull request #40 from balboag/master
Spanish (Spain) translation
2017-07-23 15:03:23 +03:00
Paddy Xu
fd1fdf1c73 get rid of warning 2017-07-23 15:00:34 +03:00
Paddy Xu
45b7361e79 longer update notification time 2017-07-23 15:00:18 +03:00
Paddy Xu
b0e8a29f85 More natural scroll behaviour 2017-07-23 00:44:43 +03:00
Paddy Xu
86dacf6e73 pinch zoom gesture; rewrite zoomviewer 2017-07-22 23:51:39 +03:00
Paddy Xu
e05ef2e969 padding right 2017-07-22 13:35:03 +03:00
Paddy Xu
ea15722629 indicate UWP app in context menu 2017-07-21 19:37:24 +03:00
Paddy Xu
a370b8a7e1 Update README.md 2017-07-21 19:02:08 +03:00
Paddy Xu
83713412f2 Update README.md 2017-07-21 18:48:17 +03:00
Paddy Xu
c50aa6c312 Update README.md 2017-07-21 18:47:57 +03:00
Paddy Xu
5f6c5d0e07 Give buttons a slightly ligher colour 2017-07-18 20:43:14 +03:00
Gerardo
72d5f232d6 Spanish (Spain) translation 2017-07-17 21:24:09 +02:00
Paddy Xu
4cc98c59fd add files for packing .appx 2017-07-17 00:45:01 +03:00
Paddy Xu
61fc320b8f Dispose windows before exiting 2017-07-15 23:04:13 +03:00
Paddy Xu
9ca358bd5a Use signed Ude lib 2017-07-15 23:03:47 +03:00
Paddy Xu
61074fea2c Revert "Sign all projects with strong names"
This reverts commit d98afaa4dc.
2017-07-15 21:29:35 +03:00
Paddy Xu
6453b74a96 Update README.md 2017-07-15 15:50:57 +03:00
Paddy Xu
5240a8e75b deal with FileInUse exception when packing .zip 2017-07-15 15:33:56 +03:00
Paddy Xu
0c021217b1 deal with FileInUse exception when packing .zip 2017-07-15 15:20:50 +03:00
Paddy Xu
af9a5f3c92 useless reference 2017-07-15 15:13:32 +03:00
Paddy Xu
d98afaa4dc Sign all projects with strong names 2017-07-15 15:07:41 +03:00
Paddy Xu
95da093130 Update README.md 2017-07-15 13:53:05 +03:00
Paddy Xu
36e732ea75 Update README.md 2017-07-15 13:43:50 +03:00
Paddy Xu
8684e4ec62 Share and window status button, Configuration system, check update every week 2017-07-15 13:27:34 +03:00
Paddy Xu
88f892bd05 no need revemoving thr run button when pinned 2017-07-15 11:20:35 +03:00
Paddy Xu
147065e023 fix memory leak caused by shared plugin instances 2017-07-15 01:28:58 +03:00
Paddy Xu
3f49a26502 "Pin" a viewer window 2017-07-15 01:12:30 +03:00
Paddy Xu
cbfd5bfa7e eliminate translation doc names when calling GetString() 2017-07-14 23:24:39 +03:00
Paddy Xu
584d56731f rename translation files to make editor happy 2017-07-14 22:55:35 +03:00
Paddy Xu
4ab7a49d72 Update README.md 2017-07-14 22:47:23 +03:00
Paddy Xu
77b973ef7b Add English and Chinese translations 2017-07-14 22:40:32 +03:00
Paddy Xu
751bd6e28e Fix #39: detect file encoding 2017-07-14 18:49:55 +03:00
Paddy Xu
d855e80bdc Prevent hook helper from running when in UWP mode 2017-07-11 23:43:16 +03:00
Paddy Xu
031803a40e disable autorun and update check when running as an UWP 2017-07-07 22:45:46 +03:00
Paddy Xu
396d34f230 Update README.md 2017-07-04 00:58:31 +03:00
Paddy Xu
c5c478cc1c remove old build pkgs 2017-07-04 00:01:28 +03:00
Paddy Xu
97e8552e68 Make use of scroll bars in ScrollViewer 2017-07-03 23:50:37 +03:00
Paddy Xu
847611648c adjust scroll bars 2017-07-03 23:49:59 +03:00
Paddy Xu
32df836f08 update build scripts 2017-07-03 22:59:47 +03:00
Paddy Xu
a169cb0767 #36: support .msg and .eml files 2017-07-02 00:29:43 +03:00
Paddy Xu
5c081127c7 Refresh Nuget 2017-07-01 23:29:41 +03:00
Paddy Xu
3e9f9eeec9 Add csv viewer 2017-07-01 23:27:41 +03:00
Paddy Xu
a1e3920569 Enlarge scroll bars 2017-07-01 23:18:40 +03:00
Paddy Xu
0cdaad32af Allow full window mouse dragging 2017-07-01 23:17:55 +03:00
Paddy Xu
0a5ec182c9 #37: Print all exception information 2017-07-01 13:59:27 +03:00
Milly
924d8dd49e Use built-in method instead.
Squashed commit of the following:

commit f7887aeda7
Author: Milly <milly.ca@gmail.com>
Date:   Fri Jun 23 09:26:58 2017 +0900

    Replace "&", "<", ">" to HTML entities in Markdown.
2017-07-01 12:39:32 +03:00
Paddy Xu
574ef7d8a3 Update README.md 2017-06-29 23:03:34 +03:00
Paddy Xu
bb0c32c31d Update README.md 2017-06-29 23:01:32 +03:00
Paddy Xu
74a4d853ca Update .appveyor.yml 2017-06-29 22:55:37 +03:00
Paddy Xu
072488d8de Update .appveyor.yml 2017-06-29 22:51:52 +03:00
Paddy Xu
d65a3a109e Do not run exe again after uninstallation 2017-06-29 22:27:27 +03:00
Paddy Xu
57bf0e701a Update .appveyor.yml 2017-06-29 22:09:22 +03:00
Paddy Xu
889a9d38df Update .appveyor.yml 2017-06-29 22:07:40 +03:00
Paddy Xu
2e1b53965b Fix crash when switching preview while maximized 2017-06-27 21:44:37 +03:00
Paddy Xu
7e63636141 Refresh NuGet packages 2017-06-24 14:21:37 +03:00
Paddy Xu
a0712e4727 Fix #34: add .markdown file extension 2017-06-22 18:50:32 +03:00
Paddy Xu
8eff090e9f forgot to set WIN64 in release 2017-06-21 01:10:15 +03:00
Paddy Xu
b7c0e0d4f0 Fix fix f95fb120b5 2017-06-19 20:14:02 +03:00
Paddy Xu
35596ea641 Update README.md 2017-06-19 00:46:43 +03:00
Paddy Xu
46ff725166 DOPOUS✖ DOPUS ✔ 2017-06-18 18:32:00 +03:00
Paddy Xu
f075f420fc Update README.md 2017-06-18 17:36:10 +03:00
720 changed files with 15517 additions and 8671 deletions

View File

@@ -6,33 +6,22 @@ cache:
- packages -> **\packages.config
- '%USERPROFILE%\.nuget\packages -> **\project.json'
before_build:
- cmd: nuget restore
- ps: >-
$env:GIT_TAG = git describe --always --tags
nuget restore
build:
verbosity: minimal
after_build:
- cmd: >-
type GitVersion.cs
- ps: >-
Get-Content GitVersion.cs
cd Build
Move-Item Build\QuickLook-$env:GIT_TAG.msi QuickLook-$env:GIT_TAG.msi
Move-Item Build\QuickLook-$env:GIT_TAG.zip QuickLook-$env:GIT_TAG.zip
move QuickLook.msi ..\QuickLook-%APPVEYOR_REPO_TAG_NAME%.msi
dir ..\QuickLook-%APPVEYOR_REPO_TAG_NAME%.msi
7z a ..\QuickLook-%APPVEYOR_REPO_TAG_NAME%.zip .\Package\* -r
7z l ..\QuickLook-%APPVEYOR_REPO_TAG_NAME%.zip
artifacts:
- path: QuickLook-$(APPVEYOR_REPO_TAG_NAME).zip
name: QuickLook-$(APPVEYOR_REPO_TAG_NAME)
- path: QuickLook-$(APPVEYOR_REPO_TAG_NAME).msi
name: QuickLook-$(APPVEYOR_REPO_TAG_NAME)
deploy:
- provider: GitHub
auth_token:
secure: YwPL9DCYIWsHKBT7WMnx+IHTWph9fEOUBpnfZhZMTgz6VzWem01X+l/vZPlFxCG/
artifact: QuickLook-$(APPVEYOR_REPO_TAG_NAME)
draft: true
on:
branch: master
APPVEYOR_REPO_TAG: true
- path: QuickLook-%GIT_TAG%.zip
name: QuickLook-%GIT_TAG%
- path: QuickLook-%GIT_TAG%.msi
name: QuickLook-%GIT_TAG%

8
.gitignore vendored
View File

@@ -17,8 +17,6 @@
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
@@ -290,4 +288,8 @@ __pycache__/
/QuickLook.Plugin.PDFViewer/MoonPdfLib
/GitVersion.cs
/QuickLook.Installer/C_QuickLookComponents.wxs
/Build/
/Build/*
!/Build/Assets
!/Build/AppxManifest.*
!/Build/assetslayout.resfiles
!/Build/priconfig.xml

View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10">
<Identity Name="21090PaddyXu.QuickLook" Version="0.0.0.0"
Publisher='E=xupaddy@gmail.com, CN="Open Source Developer, Pengfei Xu", O=Open Source Developer, C=FI' />
<Properties>
<DisplayName>QuickLook</DisplayName>
<PublisherDisplayName>Paddy Xu</PublisherDisplayName>
<Description>Bring macOS &#8220;Quick Look&#8221; feature to Windows</Description>
<Logo>Assets\storelogo.png</Logo>
</Properties>
<Resources>
<Resource Language="en-us" />
<Resource uap:Scale="100" />
<Resource uap:Scale="125" />
<Resource uap:Scale="150" />
<Resource uap:Scale="200" />
<Resource uap:Scale="400" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14316.0" MaxVersionTested="10.0.15063.0" />
</Dependencies>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
<Applications>
<Application Id="Main" Executable="Package\QuickLook.exe" EntryPoint="Windows.FullTrustApplication">
<Extensions>
<desktop:Extension Category="windows.startupTask" Executable="Package\QuickLook.exe"
EntryPoint="Windows.FullTrustApplication">
<desktop:StartupTask TaskId="QuickLookTask" Enabled="true" DisplayName="QuickLook" />
</desktop:Extension>
</Extensions>
<uap:VisualElements DisplayName="QuickLook"
Description="Bring macOS &#8220;Quick Look&#8221; feature to Windows"
BackgroundColor="transparent"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"
Square310x310Logo="Assets\LargeTile.png"
Square71x71Logo="Assets\SmallTile.png">
<uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo" />
<uap:ShowOn Tile="wide310x150Logo" />
<uap:ShowOn Tile="square310x310Logo" />
</uap:ShowNameOnTiles>
</uap:DefaultTile>
</uap:VisualElements>
</Application>
</Applications>
</Package>

52
Build/AppxManifest.xml Normal file
View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10">
<Identity Name="21090PaddyXu.QuickLook" Version="0.0.0.0" Publisher="CN=CE36AF3D-FF94-43EB-9908-7EC8FD1D29FB" />
<Properties>
<DisplayName>QuickLook</DisplayName>
<PublisherDisplayName>Paddy Xu</PublisherDisplayName>
<Description>Bring macOS &#8220;Quick Look&#8221; feature to Windows</Description>
<Logo>Assets\storelogo.png</Logo>
</Properties>
<Resources>
<Resource Language="en-us" />
<Resource uap:Scale="100" />
<Resource uap:Scale="125" />
<Resource uap:Scale="150" />
<Resource uap:Scale="200" />
<Resource uap:Scale="400" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14316.0" MaxVersionTested="10.0.15063.0" />
</Dependencies>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
<Applications>
<Application Id="Main" Executable="Package\QuickLook.exe" EntryPoint="Windows.FullTrustApplication">
<Extensions>
<desktop:Extension Category="windows.startupTask" Executable="Package\QuickLook.exe"
EntryPoint="Windows.FullTrustApplication">
<desktop:StartupTask TaskId="QuickLookTask" Enabled="true" DisplayName="QuickLook" />
</desktop:Extension>
</Extensions>
<uap:VisualElements DisplayName="QuickLook"
Description="Bring macOS &#8220;Quick Look&#8221; feature to Windows"
BackgroundColor="transparent"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"
Square310x310Logo="Assets\LargeTile.png"
Square71x71Logo="Assets\SmallTile.png">
<uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo" />
<uap:ShowOn Tile="wide310x150Logo" />
<uap:ShowOn Tile="square310x310Logo" />
</uap:ShowNameOnTiles>
</uap:DefaultTile>
</uap:VisualElements>
</Application>
</Applications>
</Package>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1007 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -0,0 +1,40 @@
Assets\LargeTile.scale-100.png
Assets\LargeTile.scale-125.png
Assets\LargeTile.scale-150.png
Assets\LargeTile.scale-200.png
Assets\LargeTile.scale-400.png
Assets\SmallTile.scale-100.png
Assets\SmallTile.scale-125.png
Assets\SmallTile.scale-150.png
Assets\SmallTile.scale-200.png
Assets\SmallTile.scale-400.png
Assets\Square150x150Logo.scale-100.png
Assets\Square150x150Logo.scale-125.png
Assets\Square150x150Logo.scale-150.png
Assets\Square150x150Logo.scale-200.png
Assets\Square150x150Logo.scale-400.png
Assets\Square44x44Logo.altform-unplated_targetsize-16.png
Assets\Square44x44Logo.altform-unplated_targetsize-24.png
Assets\Square44x44Logo.altform-unplated_targetsize-32.png
Assets\Square44x44Logo.altform-unplated_targetsize-48.png
Assets\Square44x44Logo.altform-unplated_targetsize-256.png
Assets\Square44x44Logo.scale-100.png
Assets\Square44x44Logo.scale-125.png
Assets\Square44x44Logo.scale-150.png
Assets\Square44x44Logo.scale-200.png
Assets\Square44x44Logo.scale-400.png
Assets\Square44x44Logo.targetsize-16.png
Assets\Square44x44Logo.targetsize-24.png
Assets\Square44x44Logo.targetsize-32.png
Assets\Square44x44Logo.targetsize-48.png
Assets\Square44x44Logo.targetsize-256.png
Assets\storelogo.scale-100.png
Assets\storelogo.scale-125.png
Assets\storelogo.scale-150.png
Assets\storelogo.scale-200.png
Assets\storelogo.scale-400.png
Assets\Wide310x150Logo.scale-100.png
Assets\Wide310x150Logo.scale-125.png
Assets\Wide310x150Logo.scale-150.png
Assets\Wide310x150Logo.scale-200.png
Assets\Wide310x150Logo.scale-400.png

18
Build/priconfig.xml Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources targetOsVersion="10.0.0" majorVersion="1">
<index root="\" startIndexAt="..\assetslayout.resfiles">
<default>
<qualifier name="Language" value="en-US" />
<qualifier name="Contrast" value="standard" />
<qualifier name="Scale" value="100" />
<qualifier name="HomeRegion" value="001" />
<qualifier name="TargetSize" value="256" />
<qualifier name="LayoutDirection" value="LTR" />
<qualifier name="Configuration" value="" />
<qualifier name="AlternateForm" value="" />
<qualifier name="DXFeatureLevel" value="DX9" />
<qualifier name="Platform" value="UAP" />
</default>
<indexer-config type="RESFILES" qualifierDelimiter="." />
</index>
</resources>

View File

@@ -0,0 +1,152 @@
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using PixelFormat = System.Windows.Media.PixelFormat;
namespace QuickLook.Common.ExtensionMethods
{
public static class BitmapExtensions
{
public static BitmapSource ToBitmapSource(this Bitmap source)
{
var orgSource = source;
BitmapSource bs = null;
try
{
var data = source.LockBits(new Rectangle(0, 0, source.Width, source.Height),
ImageLockMode.ReadOnly, source.PixelFormat);
// BitmapSource.Create throws an exception when the image is scanned backward.
// The Clone() will make it back scanning forward.
if (data.Stride < 0)
{
source.UnlockBits(data);
source = (Bitmap) source.Clone();
data = source.LockBits(new Rectangle(0, 0, source.Width, source.Height),
ImageLockMode.ReadOnly, source.PixelFormat);
}
bs = BitmapSource.Create(source.Width, source.Height, Math.Floor(source.HorizontalResolution),
Math.Floor(source.VerticalResolution), ConvertPixelFormat(source.PixelFormat), null,
data.Scan0, data.Stride * source.Height, data.Stride);
source.UnlockBits(data);
bs.Freeze();
}
catch
{
// ignored
}
finally
{
if (orgSource != source)
source.Dispose();
}
return bs;
}
public static Bitmap ToBitmap(this BitmapSource source)
{
using (var outStream = new MemoryStream())
{
BitmapEncoder enc = new BmpBitmapEncoder();
enc.Frames.Add(BitmapFrame.Create(source));
enc.Save(outStream);
var bitmap = new Bitmap(outStream);
return new Bitmap(bitmap);
}
}
private static PixelFormat ConvertPixelFormat(
System.Drawing.Imaging.PixelFormat sourceFormat)
{
switch (sourceFormat)
{
case System.Drawing.Imaging.PixelFormat.Format24bppRgb:
return PixelFormats.Bgr24;
case System.Drawing.Imaging.PixelFormat.Format32bppArgb:
return PixelFormats.Bgra32;
case System.Drawing.Imaging.PixelFormat.Format32bppRgb:
return PixelFormats.Bgr32;
}
return new PixelFormat();
}
public static bool IsDarkImage(this Bitmap image)
{
// convert to 24-bit RGB image
image = image.Clone(new Rectangle(0, 0, image.Width, image.Height),
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
var sampleCount = (int) (0.2 * 400 * 400);
const int pixelSize = 24 / 8;
var data = image.LockBits(new Rectangle(0, 0, image.Width, image.Height),
ImageLockMode.ReadWrite, image.PixelFormat);
var darks = 0;
unsafe
{
var pFirst = (byte*) data.Scan0;
Parallel.For(0, sampleCount, n =>
{
var rand = new Random(n);
var row = rand.Next(0, data.Height);
var col = rand.Next(0, data.Width);
var pos = pFirst + row * data.Stride + col * pixelSize;
var b = pos[0];
var g = pos[1];
var r = pos[2];
var y = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
if (y < 0.5)
darks++;
});
}
image.UnlockBits(data);
image.Dispose();
return darks > 0.65 * sampleCount;
}
public static BitmapImage LoadBitmapImage(this Uri source)
{
var bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.CacheOption = BitmapCacheOption.OnLoad;
bitmap.UriSource = source;
bitmap.EndInit();
return bitmap;
}
}
}

View File

@@ -19,7 +19,7 @@ using System;
using System.Threading.Tasks;
using System.Windows.Threading;
namespace QuickLook.ExtensionMethods
namespace QuickLook.Common.ExtensionMethods
{
public static class DispatcherExtensions
{

View File

@@ -15,16 +15,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Windows.Media;
using System;
using System.Collections.Generic;
namespace QuickLook
namespace QuickLook.Common.ExtensionMethods
{
internal class MainWindowNoTransparent : MainWindowTransparent
public static class EnumerableExtensions
{
public MainWindowNoTransparent()
public static void ForEach<T>(this IEnumerable<T> enumeration, Action<T> action)
{
Background = new SolidColorBrush(Colors.White);
AllowsTransparency = false;
foreach (var item in enumeration)
action(item);
}
}
}

View File

@@ -0,0 +1,48 @@
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace QuickLook.Common.ExtensionMethods
{
public static class FileExtensions
{
public static string ToPrettySize(this long value, int decimalPlaces = 0)
{
const long OneKb = 1024;
const long OneMb = OneKb * 1024;
const long OneGb = OneMb * 1024;
const long OneTb = OneGb * 1024;
var asTb = Math.Round((double) value / OneTb, decimalPlaces);
var asGb = Math.Round((double) value / OneGb, decimalPlaces);
var asMb = Math.Round((double) value / OneMb, decimalPlaces);
var asKb = Math.Round((double) value / OneKb, decimalPlaces);
var chosenValue = asTb > 1
? $"{asTb} TB"
: asGb > 1
? $"{asGb} GB"
: asMb > 1
? $"{asMb} MB"
: asKb > 1
? $"{asKb} KB"
: $"{Math.Round((double) value, decimalPlaces)} bytes";
return chosenValue;
}
}
}

View File

@@ -17,9 +17,9 @@
using System;
namespace QuickLook.ExtensionMethods
namespace QuickLook.Common.ExtensionMethods
{
internal static class TypeExtensions
public static class TypeExtensions
{
public static T CreateInstance<T>(this Type t)
{

View File

@@ -1,4 +1,4 @@
// Copyright © 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
@@ -19,28 +19,25 @@ using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace QuickLook.Helpers
namespace QuickLook.Common.Helpers
{
internal static class DpiHelper
public static class DpiHelper
{
public const float DEFAULT_DPI = 96;
public const float DefaultDpi = 96;
public static Dpi GetCurrentDpi()
public static ScaleFactor GetCurrentScaleFactor()
{
var g = Graphics.FromHwnd(IntPtr.Zero);
var desktop = g.GetHdc();
var dpi = new Dpi
{
HorizontalDpi = GetDeviceCaps(desktop, (int) DeviceCap.LOGPIXELSX),
VerticalDpi = GetDeviceCaps(desktop, (int) DeviceCap.LOGPIXELSY)
};
var horizontalDpi = GetDeviceCaps(desktop, (int) DeviceCap.LOGPIXELSX);
var verticalDpi = GetDeviceCaps(desktop, (int) DeviceCap.LOGPIXELSY);
return dpi;
return new ScaleFactor {Horizontal = horizontalDpi / DefaultDpi, Vertical = verticalDpi / DefaultDpi};
}
[DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
public static extern int GetDeviceCaps(IntPtr hDC, int nIndex);
private static extern int GetDeviceCaps(IntPtr hDC, int nIndex);
private enum DeviceCap
{
@@ -54,10 +51,10 @@ namespace QuickLook.Helpers
LOGPIXELSY = 90
}
public struct Dpi
public struct ScaleFactor
{
public float HorizontalDpi;
public float VerticalDpi;
public float Horizontal;
public float Vertical;
}
}
}

View File

@@ -23,40 +23,41 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace QuickLook.Helpers
namespace QuickLook.Common.Helpers
{
internal class FileHelper
public class FileHelper
{
public static bool? GetAssocApplication(string path, out string appFriendlyName)
public static bool IsExecutable(string path, out string appFriendlyName)
{
appFriendlyName = string.Empty;
if (string.IsNullOrEmpty(path))
return null;
if (Directory.Exists(path))
return null;
if (!File.Exists(path))
return null;
var ext = Path.GetExtension(path).ToLower();
var isExe = new[] {".cmd", ".bat", ".pif", ".scf", ".exe", ".com", ".scr"}.Contains(ext.ToLower());
// no assoc. app. found
if (!isExe)
if (string.IsNullOrEmpty(GetAssocApplicationNative(ext, AssocStr.Command)))
if (string.IsNullOrEmpty(GetAssocApplicationNative(ext, AssocStr.AppId))) // UWP
return null;
appFriendlyName = isExe
? FileVersionInfo.GetVersionInfo(path).FileDescription
: GetAssocApplicationNative(ext, AssocStr.FriendlyAppName);
return false;
appFriendlyName = FileVersionInfo.GetVersionInfo(path).FileDescription;
if (string.IsNullOrEmpty(appFriendlyName))
appFriendlyName = Path.GetFileName(path);
return isExe;
return true;
}
public static bool GetAssocApplication(string path, out string appFriendlyName)
{
appFriendlyName = string.Empty;
var ext = Path.GetExtension(path).ToLower();
// no assoc. app. found
if (string.IsNullOrEmpty(GetAssocApplicationNative(ext, AssocStr.Command)))
if (string.IsNullOrEmpty(GetAssocApplicationNative(ext, AssocStr.AppId))) // UWP
return false;
appFriendlyName = GetAssocApplicationNative(ext, AssocStr.FriendlyAppName);
if (string.IsNullOrEmpty(appFriendlyName))
appFriendlyName = Path.GetFileName(path);
return true;
}
[DllImport("shlwapi.dll", CharSet = CharSet.Auto, SetLastError = true)]

View File

@@ -0,0 +1,79 @@
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Threading.Tasks;
using QuickLook.Common.NativeMethods;
namespace QuickLook.Common.Helpers
{
public class ProcessHelper
{
private const int ErrorInsufficientBuffer = 0x7A;
// ReSharper disable once InconsistentNaming
public static void PerformAggressiveGC()
{
// delay some time to make sure that all windows are closed
Task.Delay(2000).ContinueWith(t => GC.Collect(GC.MaxGeneration));
}
public static bool IsRunningAsUWP()
{
try
{
uint len = 0;
var r = Kernel32.GetCurrentPackageFullName(ref len, null);
return r == ErrorInsufficientBuffer;
}
catch (EntryPointNotFoundException)
{
return false;
}
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public static bool IsOnWindows10S()
{
const uint PRODUCT_CLOUD = 0x000000B2; // Windows 10 S
const uint PRODUCT_CLOUDN = 0x000000B3; // Windows 10 S N
Kernel32.GetProductInfo(Environment.OSVersion.Version.Major,
Environment.OSVersion.Version.Minor, 0, 0, out var osType);
return osType == PRODUCT_CLOUD || osType == PRODUCT_CLOUDN;
}
public static void WriteLog(string msg)
{
var logFilePath = Path.Combine(SettingHelper.LocalDataPath, @"QuickLook.Exception.log");
using (var writer = new StreamWriter(new FileStream(logFilePath, FileMode.OpenOrCreate,
FileAccess.ReadWrite, FileShare.Read)))
{
writer.BaseStream.Seek(0, SeekOrigin.End);
writer.WriteLine($"========{DateTime.Now}========");
writer.WriteLine(msg);
writer.WriteLine();
}
}
}
}

View File

@@ -0,0 +1,140 @@
// Copyright © 2018 Paddy Xu
//
// This file is part of QuickLook program.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Xml;
namespace QuickLook.Common.Helpers
{
public class SettingHelper
{
public static readonly string LocalDataPath =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"pooi.moe\QuickLook\");
private static readonly Dictionary<string, XmlDocument> FileCache = new Dictionary<string, XmlDocument>();
[MethodImpl(MethodImplOptions.NoInlining)]
public static T Get<T>(string id, T failsafe = default(T), Assembly calling = null)
{
if (!typeof(T).IsSerializable && !typeof(ISerializable).IsAssignableFrom(typeof(T)))
throw new InvalidOperationException("A serializable Type is required");
var file = Path.Combine(LocalDataPath,
(calling ?? Assembly.GetCallingAssembly()).GetName().Name + ".config");
var doc = GetConfigFile(file);
// try to get setting
var s = GetSettingFromXml(doc, id, failsafe);
return s != null ? s : failsafe;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static void Set(string id, object value, Assembly calling = null)
{
if (!value.GetType().IsSerializable)
throw new NotSupportedException("New value if not serializable.");
var file = Path.Combine(LocalDataPath,
(calling ?? Assembly.GetCallingAssembly()).GetName().Name + ".config");
WriteSettingToXml(GetConfigFile(file), id, value);
}
private static T GetSettingFromXml<T>(XmlDocument doc, string id, T failsafe)
{
var v = doc.SelectSingleNode($@"/Settings/{id}");
try
{
var result = v == null ? failsafe : (T) Convert.ChangeType(v.InnerText, typeof(T));
return result;
}
catch (Exception)
{
return failsafe;
}
}
private static void WriteSettingToXml(XmlDocument doc, string id, object value)
{
var v = doc.SelectSingleNode($@"/Settings/{id}");
if (v != null)
{
v.InnerText = value.ToString();
}
else
{
var node = doc.CreateNode(XmlNodeType.Element, id, doc.NamespaceURI);
node.InnerText = value.ToString();
doc.SelectSingleNode(@"/Settings")?.AppendChild(node);
}
doc.Save(new Uri(doc.BaseURI).LocalPath);
}
private static XmlDocument GetConfigFile(string file)
{
if (FileCache.ContainsKey(file))
return FileCache[file];
Directory.CreateDirectory(Path.GetDirectoryName(file));
if (!File.Exists(file))
CreateNewConfig(file);
var doc = new XmlDocument();
try
{
doc.Load(file);
}
catch (XmlException)
{
CreateNewConfig(file);
doc.Load(file);
}
if (doc.SelectSingleNode(@"/Settings") == null)
{
CreateNewConfig(file);
doc.Load(file);
}
FileCache.Add(file, doc);
return doc;
}
private static void CreateNewConfig(string file)
{
using (var writer = XmlWriter.Create(file))
{
writer.WriteStartDocument();
writer.WriteStartElement("Settings");
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Flush();
}
}
}
}

View File

@@ -0,0 +1,86 @@
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Xml.XPath;
namespace QuickLook.Common.Helpers
{
public class TranslationHelper
{
private static readonly CultureInfo CurrentCultureInfo = CultureInfo.CurrentUICulture;
//private static readonly CultureInfo CurrentCultureInfo = CultureInfo.GetCultureInfo("zh-CN");
private static readonly Dictionary<string, XPathNavigator> FileCache = new Dictionary<string, XPathNavigator>();
[MethodImpl(MethodImplOptions.NoInlining)]
public static string Get(string id, string file = null, CultureInfo locale = null, string failsafe = null,
Assembly calling = null)
{
if (file == null)
file = Path.Combine(Path.GetDirectoryName((calling ?? Assembly.GetCallingAssembly()).Location),
"Translations.config");
if (!File.Exists(file))
return failsafe ?? id;
if (locale == null)
locale = CurrentCultureInfo;
var nav = GetLangFile(file);
// try to get string
var s = GetStringFromXml(nav, id, locale);
if (s != null)
return s;
// try again for parent language
if (locale.Parent.Name != string.Empty)
s = GetStringFromXml(nav, id, locale.Parent);
if (s != null)
return s;
// use fallback language
s = GetStringFromXml(nav, id, CultureInfo.GetCultureInfo("en"));
if (s != null)
return s;
return failsafe ?? id;
}
private static string GetStringFromXml(XPathNavigator nav, string id, CultureInfo locale)
{
var result = nav.SelectSingleNode($@"/Translations/{locale.Name}/{id}");
return result?.Value;
}
private static XPathNavigator GetLangFile(string file)
{
if (FileCache.ContainsKey(file))
return FileCache[file];
var res = new XPathDocument(file).CreateNavigator();
FileCache.Add(file, res);
return res;
}
}
}

View File

@@ -17,25 +17,29 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Interop;
using System.Windows.Media;
using QuickLook.NativeMethods;
using QuickLook.Common.NativeMethods;
namespace QuickLook.Helpers
namespace QuickLook.Common.Helpers
{
internal static class WindowHelper
public static class WindowHelper
{
public enum WindowCompositionAttribute
{
WcaAccentPolicy = 19
}
public static Rect GetCurrentWindowRect()
{
var screen = Screen.FromPoint(Cursor.Position).WorkingArea;
var dpi = DpiHelper.GetCurrentDpi();
var scaleX = dpi.HorizontalDpi / DpiHelper.DEFAULT_DPI;
var scaleY = dpi.VerticalDpi / DpiHelper.DEFAULT_DPI;
var scale = DpiHelper.GetCurrentScaleFactor();
return new Rect(
new Point(screen.X / scaleX, screen.Y / scaleY),
new Size(screen.Width / scaleX, screen.Height / scaleY));
new Point(screen.X / scale.Horizontal, screen.Y / scale.Vertical),
new Size(screen.Width / scale.Horizontal, screen.Height / scale.Vertical));
}
public static void BringToFront(this Window window)
@@ -55,12 +59,11 @@ namespace QuickLook.Helpers
{
int pxLeft = 0, pxTop = 0;
if (left != 0 || top != 0)
window.TransformToPixels(left, top,
TransformToPixels(window, left, top,
out pxLeft, out pxTop);
int pxWidth, pxHeight;
window.TransformToPixels(width, height,
out pxWidth, out pxHeight);
TransformToPixels(window, width, height,
out var pxWidth, out var pxHeight);
User32.MoveWindow(new WindowInteropHelper(window).Handle, pxLeft, pxTop, pxWidth, pxHeight, true);
}
@@ -81,25 +84,74 @@ namespace QuickLook.Helpers
matrix = src.CompositionTarget.TransformToDevice;
}
pixelX = (int) (matrix.M11 * unitX);
pixelY = (int) (matrix.M22 * unitY);
pixelX = (int) Math.Round(matrix.M11 * unitX);
pixelY = (int) Math.Round(matrix.M22 * unitY);
}
internal static bool IsForegroundWindowBelongToSelf()
public static bool IsForegroundWindowBelongToSelf()
{
var hwnd = User32.GetForegroundWindow();
if (hwnd == IntPtr.Zero)
return false;
User32.GetWindowThreadProcessId(hwnd, out uint procId);
User32.GetWindowThreadProcessId(hwnd, out var procId);
return procId == Process.GetCurrentProcess().Id;
}
internal static void SetNoactivate(WindowInteropHelper window)
public static void SetNoactivate(WindowInteropHelper window)
{
User32.SetWindowLong(window.Handle, User32.GWL_EXSTYLE,
User32.GetWindowLong(window.Handle, User32.GWL_EXSTYLE) |
User32.WS_EX_NOACTIVATE);
}
public static void EnableBlur(Window window)
{
var accent = new AccentPolicy();
var accentStructSize = Marshal.SizeOf(accent);
accent.AccentState = AccentState.AccentEnableBlurbehind;
accent.AccentFlags = 2;
accent.GradientColor = 0x99FFFFFF;
var accentPtr = Marshal.AllocHGlobal(accentStructSize);
Marshal.StructureToPtr(accent, accentPtr, false);
var data = new WindowCompositionAttributeData
{
Attribute = WindowCompositionAttribute.WcaAccentPolicy,
SizeOfData = accentStructSize,
Data = accentPtr
};
User32.SetWindowCompositionAttribute(new WindowInteropHelper(window).Handle, ref data);
Marshal.FreeHGlobal(accentPtr);
}
[StructLayout(LayoutKind.Sequential)]
public struct WindowCompositionAttributeData
{
public WindowCompositionAttribute Attribute;
public IntPtr Data;
public int SizeOfData;
}
private enum AccentState
{
AccentDisabled = 0,
AccentEnableGradient = 1,
AccentEnableTransparentgradient = 2,
AccentEnableBlurbehind = 3,
AccentInvalidState = 4
}
[StructLayout(LayoutKind.Sequential)]
private struct AccentPolicy
{
public AccentState AccentState;
public int AccentFlags;
public uint GradientColor;
public readonly int AnimationId;
}
}
}

View File

@@ -17,15 +17,24 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace QuickLook.NativeMethods
namespace QuickLook.Common.NativeMethods
{
internal static class Kernel32
public static class Kernel32
{
[DllImport("kernel32.dll")]
internal static extern IntPtr LoadLibrary(string lpFileName);
public static extern IntPtr LoadLibrary(string lpFileName);
[DllImport("kernel32.dll")]
internal static extern IntPtr GetCurrentThreadId();
public static extern int GetCurrentPackageFullName(ref uint packageFullNameLength,
[MarshalAs(UnmanagedType.LPWStr)] StringBuilder packageFullName);
[DllImport("kernel32.dll")]
public static extern IntPtr GetCurrentThreadId();
[DllImport("kernel32.dll")]
public static extern bool GetProductInfo(int dwOSMajorVersion, int dwOSMinorVersion, int dwSpMajorVersion,
int dwSpMinorVersion, out uint pdwReturnedProductType);
}
}

View File

@@ -19,11 +19,14 @@ using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
using QuickLook.Common.Helpers;
namespace QuickLook.NativeMethods
namespace QuickLook.Common.NativeMethods
{
internal static class User32
public static class User32
{
public delegate int KeyboardHookProc(int code, int wParam, ref KeyboardHookStruct lParam);
[DllImport("user32.dll")]
public static extern int MoveWindow(IntPtr hWnd, int x, int y, int nWidth, int nHeight,
[MarshalAs(UnmanagedType.Bool)] bool bRepaint);
@@ -33,52 +36,54 @@ namespace QuickLook.NativeMethods
uint uFlags);
[DllImport("user32.dll")]
internal static extern IntPtr SetWindowsHookEx(int idHook, KeyboardHookProc callback, IntPtr hInstance,
public static extern IntPtr SetWindowsHookEx(int idHook, KeyboardHookProc callback, IntPtr hInstance,
uint threadId);
[DllImport("user32.dll")]
internal static extern bool UnhookWindowsHookEx(IntPtr hInstance);
public static extern bool UnhookWindowsHookEx(IntPtr hInstance);
[DllImport("user32.dll")]
internal static extern int CallNextHookEx(IntPtr idHook, int nCode, int wParam, ref KeyboardHookStruct lParam);
public static extern int CallNextHookEx(IntPtr idHook, int nCode, int wParam, ref KeyboardHookStruct lParam);
[DllImport("user32.dll")]
internal static extern IntPtr SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
public static extern IntPtr SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll")]
internal static extern int GetWindowLong(IntPtr hWnd, int nIndex);
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
internal static extern IntPtr GetForegroundWindow();
public static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
internal static extern IntPtr GetWindowThreadProcessId(IntPtr hWnd, IntPtr processId);
public static extern IntPtr GetWindowThreadProcessId(IntPtr hWnd, IntPtr processId);
[DllImport("user32.dll")]
internal static extern IntPtr GetWindowThreadProcessId(IntPtr hWnd, out uint processId);
public static extern IntPtr GetWindowThreadProcessId(IntPtr hWnd, out uint processId);
[DllImport("user32.dll")]
internal static extern IntPtr AttachThreadInput(IntPtr idAttach, IntPtr idAttachTo, bool fAttach);
public static extern IntPtr AttachThreadInput(IntPtr idAttach, IntPtr idAttachTo, bool fAttach);
[DllImport("user32.dll")]
internal static extern IntPtr GetFocus();
public static extern IntPtr GetFocus();
[DllImport("user32.dll", CharSet = CharSet.Auto)]
internal static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
public static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
[DllImport("user32.dll")]
internal static extern IntPtr GetParent(IntPtr hWnd);
public static extern IntPtr GetParent(IntPtr hWnd);
internal delegate int KeyboardHookProc(int code, int wParam, ref KeyboardHookStruct lParam);
[DllImport("user32.dll")]
public static extern int SetWindowCompositionAttribute(IntPtr hwnd,
ref WindowHelper.WindowCompositionAttributeData data);
[SuppressMessage("ReSharper", "InconsistentNaming")]
internal struct KeyboardHookStruct
public struct KeyboardHookStruct
{
internal int vkCode;
internal int scanCode;
internal int flags;
internal int time;
internal int dwExtraInfo;
public int vkCode;
public int scanCode;
public int flags;
public int time;
public int dwExtraInfo;
}
// ReSharper disable InconsistentNaming

View File

@@ -19,28 +19,27 @@ using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using QuickLook.Annotations;
using QuickLook.Helpers;
using QuickLook.Common.Annotations;
using QuickLook.Common.Helpers;
namespace QuickLook.Plugin
namespace QuickLook.Common.Plugin
{
/// <summary>
/// A runtime object which allows interaction between this plugin and QuickLook.
/// </summary>
public class ContextObject : INotifyPropertyChanged
{
private bool _canFocus;
private bool _canResize = true;
private bool _isBusy = true;
private string _title = "";
private bool _fullWindowDragging;
private bool _isBusy;
private string _title = string.Empty;
private bool _titlebarAutoHide;
private bool _titlebarBlurVisibility;
private bool _titlebarColourVisibility = true;
private bool _titlebarOverlap;
private bool _useDarkTheme;
private object _viewerContent;
/// <summary>
/// Get the viewer window.
/// </summary>
public MainWindowTransparent ViewerWindow { get; internal set; }
/// <summary>
/// Get or set the title of Viewer window.
/// </summary>
@@ -99,14 +98,82 @@ namespace QuickLook.Plugin
}
/// <summary>
/// Set whether user are allowed to set focus at the viewer window.
/// Set whether the full viewer window can be used for mouse dragging.
/// </summary>
public bool CanFocus
public bool FullWindowDragging
{
get => _canFocus;
get => _fullWindowDragging;
set
{
_canFocus = value;
_fullWindowDragging = value;
OnPropertyChanged();
}
}
/// <summary>
/// Set whether the viewer content is overlapped by the title bar
/// </summary>
public bool TitlebarOverlap
{
get => _titlebarOverlap;
set
{
_titlebarOverlap = value;
OnPropertyChanged();
}
}
/// <summary>
/// Set whether the title bar shows a blurred background
/// </summary>
public bool TitlebarBlurVisibility
{
get => _titlebarBlurVisibility;
set
{
if (value == _titlebarBlurVisibility) return;
_titlebarBlurVisibility = value;
OnPropertyChanged();
}
}
/// <summary>
/// Set whether the title bar shows a colour overlay
/// </summary>
public bool TitlebarColourVisibility
{
get => _titlebarColourVisibility;
set
{
if (value == _titlebarColourVisibility) return;
_titlebarColourVisibility = value;
OnPropertyChanged();
}
}
/// <summary>
/// Should the titlebar hides itself after a short period of inactivity?
/// </summary>
public bool TitlebarAutoHide
{
get => _titlebarAutoHide;
set
{
if (value == _titlebarAutoHide) return;
_titlebarAutoHide = value;
OnPropertyChanged();
}
}
/// <summary>
/// Switch to dark theme?
/// </summary>
public bool UseDarkTheme
{
get => _useDarkTheme;
set
{
_useDarkTheme = value;
OnPropertyChanged();
}
}
@@ -114,18 +181,7 @@ namespace QuickLook.Plugin
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Show a notification balloon.
/// </summary>
/// <param name="title">Title of the notification.</param>
/// <param name="content">The content.</param>
/// <param name="isError">Is this indicates a error?</param>
public void ShowNotification(string title, string content, bool isError = false)
{
TrayIconManager.GetInstance().ShowNotification(title, content, isError);
}
/// <summary>
/// Set the size of viewer window and shrink to fit (to screen resolution).
/// Set the size of viewer window, scale or shrink to fit (to screen resolution).
/// The window can take maximum (maxRatio*resolution) space.
/// </summary>
/// <param name="size">The desired size.</param>
@@ -135,7 +191,7 @@ namespace QuickLook.Plugin
if (maxRatio > 1)
maxRatio = 1;
var max = GetMaximumDisplayBound();
var max = WindowHelper.GetCurrentWindowRect();
var widthRatio = max.Width * maxRatio / size.Width;
var heightRatio = max.Height * maxRatio / size.Height;
@@ -148,23 +204,22 @@ namespace QuickLook.Plugin
return ratio;
}
/// <summary>
/// Get the device-independent resolution.
/// </summary>
public Rect GetMaximumDisplayBound()
public void Reset()
{
return WindowHelper.GetCurrentWindowRect();
}
internal void Reset()
{
ViewerWindow = null;
Title = "";
ViewerContent = null;
IsBusy = true;
Title = string.Empty;
// set to False to prevent showing loading icon
IsBusy = false;
PreferredSize = new Size();
CanResize = true;
CanFocus = false;
FullWindowDragging = false;
UseDarkTheme = false;
TitlebarOverlap = false;
TitlebarAutoHide = false;
TitlebarBlurVisibility = false;
TitlebarColourVisibility = true;
ViewerContent = null;
}
[NotifyPropertyChangedInvocator]

View File

@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace QuickLook.Plugin
namespace QuickLook.Common.Plugin
{
/// <summary>
/// Interface implemented by every QuickLook.Plugin
@@ -28,11 +28,6 @@ namespace QuickLook.Plugin
/// </summary>
int Priority { get; }
/// <summary>
/// Set whether the viewer window has blur effect.
/// </summary>
bool AllowsTransparency { get; }
/// <summary>
/// Do ont-time job when application starts. You may extract nessessary resource here.
/// </summary>

View File

@@ -25,7 +25,7 @@ using System;
// ReSharper disable MemberCanBeProtected.Global
// ReSharper disable InconsistentNaming
namespace QuickLook.Annotations
namespace QuickLook.Common.Annotations
{
/// <summary>
/// Indicates that the value of the marked element could be <c>null</c> sometimes,
@@ -449,10 +449,10 @@ namespace QuickLook.Annotations
}
[UsedImplicitly]
public ImplicitUseKindFlags UseKindFlags { get; private set; }
public ImplicitUseKindFlags UseKindFlags { get; }
[UsedImplicitly]
public ImplicitUseTargetFlags TargetFlags { get; private set; }
public ImplicitUseTargetFlags TargetFlags { get; }
}
[Flags]

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("QuickLook.Common")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QuickLook.Common")]
[assembly: AssemblyCopyright("Copyright © Paddy Xu 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("85fdd6ba-871d-46c8-bd64-f6bb0cb5ea95")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

View File

@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{85FDD6BA-871D-46C8-BD64-F6BB0CB5EA95}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>QuickLook.Common</RootNamespace>
<AssemblyName>QuickLook.Common</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Build\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\Build\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\GitVersion.cs">
<Link>Properties\GitVersion.cs</Link>
</Compile>
<Compile Include="Plugin\ContextObject.cs" />
<Compile Include="Helpers\DpiHelper.cs" />
<Compile Include="ExtensionMethods\BitmapExtensions.cs" />
<Compile Include="ExtensionMethods\DispatcherExtensions.cs" />
<Compile Include="ExtensionMethods\EnumerableExtensions.cs" />
<Compile Include="ExtensionMethods\FileExtensions.cs" />
<Compile Include="ExtensionMethods\TypeExtensions.cs" />
<Compile Include="Helpers\FileHelper.cs" />
<Compile Include="Plugin\IViewer.cs" />
<Compile Include="NativeMethods\Kernel32.cs" />
<Compile Include="Helpers\ProcessHelper.cs" />
<Compile Include="Properties\Annotations.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Helpers\SettingHelper.cs" />
<Compile Include="Helpers\TranslationHelper.cs" />
<Compile Include="NativeMethods\User32.cs" />
<Compile Include="Helpers\WindowHelper.cs" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -71,7 +71,7 @@
<UIRef Id="WixUI_InstallDir" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchApplication">1</Publish>
<Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchApplication">NOT Installed</Publish>
</UI>
</Product>
</Wix>

View File

@@ -18,6 +18,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\Build\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>PackageDir=$(SolutionDir)Build\Package\</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="C_QuickLookComponents.wxs" />
@@ -32,25 +33,26 @@
<ItemGroup>
<Content Include="gpl.rtf" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\QuickLook\QuickLook.csproj">
<Name>QuickLook</Name>
<Project>{8b4a9ce5-67b5-4a94-81cb-3771f688fdeb}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
</Target>
<PropertyGroup>
<PreBuildEvent>robocopy "$(SolutionDir)Build\$(Configuration)" "$(SolutionDir)Build\Package" %2a.%2a /e /njh /njs /ndl /nfl /nc /ns /np /xf %2a.pdb /xf %2a.obj /xf %2a.ipdb /xf %2a.iobj /xf %2a.exp /xf %2a.lib /xf %2a.ilk /xf %2a.xml
<PostBuildEvent>powershell -file "$(SolutionDir)Scripts\sign-msi.ps1"
"$(WIX)bin\heat" dir "$(SolutionDir)Build\Package" -dr INSTALLFOLDER -cg QuickLookComponents -gg -g1 -sf -srd -sreg -var "var.QuickLook.TargetDir" -out "$(ProjectDir)C_QuickLookComponents.wxs"</PreBuildEvent>
powershell -file "$(SolutionDir)Scripts\rename-msi.ps1"
powershell -file "$(SolutionDir)Scripts\pack-zip.ps1"</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>rmdir /S /Q "$(SolutionDir)Build\Package"
robocopy "$(SolutionDir)Build\$(Configuration)" "$(SolutionDir)Build\Package" %2a.%2a /e /njh /njs /ndl /nfl /nc /ns /np /xf %2a.pdb /xf %2a.obj /xf %2a.ipdb /xf %2a.iobj /xf %2a.exp /xf %2a.lib /xf %2a.ilk /xf %2a.xml
powershell -file "$(SolutionDir)Scripts\sign-package.ps1"
"$(WIX)bin\heat" dir "$(SolutionDir)Build\Package" -dr INSTALLFOLDER -cg QuickLookComponents -gg -g1 -sf -srd -sreg -var "var.PackageDir" -out "$(ProjectDir)C_QuickLookComponents.wxs"</PreBuildEvent>
</PropertyGroup>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
@@ -21,10 +21,10 @@
#include <iostream>
#define DOPOUS_IPC_LP_INFO 0x00000015
#define DOPOUS_IPC_LP_DATA L"listsel"
#define DOPOUS_CLASS L"DOpus.ParentWindow"
#define DOPOUS_NAME L"Directory Opus"
#define DOPUS_IPC_LP_INFO 0x00000015
#define DOPUS_IPC_LP_DATA L"listsel"
#define DOPUS_CLASS L"DOpus.ParentWindow"
#define DOPUS_NAME L"Directory Opus"
#define MSGWINDOW_CLASS L"QuickLook.Native.DOpus.MsgWindow"
HWND hMsgWnd;
@@ -59,13 +59,14 @@ void DOpus::GetSelected(PWCHAR buffer)
if (hMsgWnd == nullptr)
return;
PWCHAR data = DOPOUS_IPC_LP_DATA;
PWCHAR data = DOPUS_IPC_LP_DATA;
COPYDATASTRUCT cds;
cds.dwData = DOPOUS_IPC_LP_INFO;
cds.cbData = (wcslen(data) + 1) * sizeof WCHAR;
cds.dwData = DOPUS_IPC_LP_INFO;
cds.cbData = static_cast<DWORD>(wcslen(data) + 1) * sizeof WCHAR;
cds.lpData = data;
auto ret = SendMessage(FindWindow(DOPOUS_CLASS, DOPOUS_NAME), WM_COPYDATA, (WPARAM)hMsgWnd, (LPARAM)&cds);
auto ret = SendMessage(FindWindow(DOPUS_CLASS, DOPUS_NAME), WM_COPYDATA, reinterpret_cast<WPARAM>(hMsgWnd),
reinterpret_cast<LPARAM>(&cds));
if (!ret)
return;
@@ -111,7 +112,7 @@ void DOpus::ParseXmlBuffer(PWCHAR buffer)
void DOpus::PrepareMessageWindow()
{
WNDCLASSEX wx = {'\0'};
WNDCLASSEX wx = {sizeof wx};
wx.cbSize = sizeof(WNDCLASSEX);
wx.lpfnWndProc = msgWindowProc;
wx.lpszClassName = MSGWINDOW_CLASS;

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
@@ -34,6 +34,9 @@ static WCHAR filePathBuffer[MAX_PATH] = {'\0'};
void DialogHook::GetSelected(PWCHAR buffer)
{
if (HelperMethods::IsUWP())
return;
auto hwndfg = GetForegroundWindow();
DWORD pid = 0;
auto tid = GetWindowThreadProcessId(hwndfg, &pid);
@@ -96,7 +99,8 @@ void DialogHook::GetSelectedFromWoW64HookHelper(PWCHAR buffer)
if (hHelperWnd == nullptr)
return;
auto hMapFile = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, MAX_PATH * sizeof WCHAR, SHARED_MEM_NAME);
auto hMapFile = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, MAX_PATH * sizeof WCHAR,
SHARED_MEM_NAME);
if (hMapFile == nullptr)
return;

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
@@ -42,7 +42,7 @@ void HelperMethods::GetSelectedInternal(CComQIPtr<IWebBrowserApp> pwba, PWCHAR b
void HelperMethods::ObtainFirstItem(CComPtr<IDataObject> dao, PWCHAR buffer)
{
FORMATETC formatetc;
STGMEDIUM medium;
STGMEDIUM medium = {sizeof medium};
formatetc.cfFormat = CF_HDROP;
formatetc.ptd = nullptr;
@@ -63,11 +63,48 @@ void HelperMethods::ObtainFirstItem(CComPtr<IDataObject> dao, PWCHAR buffer)
DragQueryFile(HDROP(medium.hGlobal), 0, buffer, MAX_PATH - 1);
}
bool HelperMethods::IsListaryToolbarVisible()
{
auto CALLBACK findListaryWindowProc = [](__in HWND hwnd, __in LPARAM lParam)-> BOOL
{
WCHAR classBuffer[MAX_PATH] = {'\0'};
if (FAILED(GetClassName(hwnd, classBuffer, MAX_PATH)))
return TRUE;
if (wcsncmp(classBuffer, L"Listary_WidgetWin_", 18) == 0)
{
if (IsWindowVisible(hwnd))
{
*reinterpret_cast<bool*>(lParam) = true;
return FALSE;
}
}
return TRUE;
};
auto found = false;
EnumWindows(findListaryWindowProc, reinterpret_cast<LPARAM>(&found));
return found;
}
bool HelperMethods::IsCursorActivated(HWND hwnd)
{
auto tId = GetWindowThreadProcessId(hwnd, nullptr);
GUITHREADINFO gui = {sizeof gui};
GetGUIThreadInfo(tId, &gui);
return gui.flags || gui.hwndCaret;
return gui.flags || gui.hwndCaret || IsListaryToolbarVisible();
}
bool HelperMethods::IsUWP()
{
auto pGCPFN = decltype(&GetCurrentPackageFullName)(
GetProcAddress(GetModuleHandle(L"kernel32.dll"), "GetCurrentPackageFullName"));
if (!pGCPFN)
return false;
UINT32 pn = 0;
return pGCPFN(&pn, nullptr) == ERROR_INSUFFICIENT_BUFFER;
}

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
@@ -22,4 +22,8 @@ public:
static void GetSelectedInternal(CComQIPtr<IWebBrowserApp> pWebBrowserApp, PWCHAR buffer);
static void ObtainFirstItem(CComPtr<IDataObject> dao, PWCHAR buffer);
static bool IsCursorActivated(HWND hwndfg);
static bool HelperMethods::IsUWP();
private:
static bool IsListaryToolbarVisible();
};

View File

@@ -15,7 +15,7 @@
<ProjectGuid>{D31EE321-C2B0-4984-B749-736F7DE509F1}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>QuickLookNative32</RootNamespace>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
<ProjectName>QuickLook.Native32</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
@@ -106,12 +106,12 @@ void Shell32::getSelectedFromExplorer(PWCHAR buffer)
for (auto i = 0; i < count; i++)
{
VARIANT vi;
VariantInit(&vi);
V_VT(&vi) = VT_I4;
V_I4(&vi) = i;
CComPtr<IDispatch> pdisp;
// ReSharper disable once CppSomeObjectMembersMightNotBeInitialized
if (FAILED(psw->Item(vi, &pdisp)))
if (S_OK != psw->Item(vi, &pdisp))
continue;
CComQIPtr<IWebBrowserApp> pwba;
@@ -139,9 +139,11 @@ void Shell32::getSelectedFromDesktop(PWCHAR buffer)
if (FAILED(psw.CoCreateInstance(CLSID_ShellWindows)))
return;
VARIANT pvarLoc = {VT_EMPTY};
VARIANT pvarLoc;
VariantInit(&pvarLoc);
long phwnd;
if (FAILED(psw->FindWindowSW(&pvarLoc, &pvarLoc, SWC_DESKTOP, &phwnd, SWFO_NEEDDISPATCH, reinterpret_cast<IDispatch**>(&pwba))))
if (FAILED(psw->FindWindowSW(&pvarLoc, &pvarLoc, SWC_DESKTOP, &phwnd, SWFO_NEEDDISPATCH, reinterpret_cast<IDispatch**>(
&pwba))))
return;
if (HelperMethods::IsCursorActivated(reinterpret_cast<HWND>(LongToHandle(phwnd))))

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
@@ -17,6 +17,7 @@
#include "stdafx.h"
#include "WoW64HookHelper.h"
#include "HelperMethods.h"
#define HELPER_FILE L"\\QuickLook.WoW64HookHelper.exe"
#define RUN_ARG L"033A853A-E4B2-4552-9A91-E88789761C48"
@@ -37,6 +38,9 @@ bool WoW64HookHelper::Launch()
return true;
#endif
if (HelperMethods::IsUWP())
return true;
if (CheckStatus())
return true;
@@ -47,7 +51,7 @@ bool WoW64HookHelper::Launch()
auto p = wcsrchr(fullPath, L'\\');
memcpy(p, HELPER_FILE, wcslen(HELPER_FILE) * sizeof WCHAR);
STARTUPINFO si = {'\0'};
STARTUPINFO si = {sizeof si};
PROCESS_INFORMATION pi = {nullptr};
si.cb = sizeof si;
@@ -66,10 +70,11 @@ void WoW64HookHelper::createJob()
hJob = CreateJobObject(nullptr, nullptr);
JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation = {'\0'};
JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation = {sizeof BasicLimitInformation};
BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
JOBOBJECT_EXTENDED_LIMIT_INFORMATION lpJobObjectInfo = {'\0'};
JOBOBJECT_EXTENDED_LIMIT_INFORMATION lpJobObjectInfo = {sizeof lpJobObjectInfo};
lpJobObjectInfo.BasicLimitInformation = BasicLimitInformation;
SetInformationJobObject(hJob, JobObjectExtendedLimitInformation, &lpJobObjectInfo, sizeof JOBOBJECT_EXTENDED_LIMIT_INFORMATION);
SetInformationJobObject(hJob, JobObjectExtendedLimitInformation, &lpJobObjectInfo,
sizeof JOBOBJECT_EXTENDED_LIMIT_INFORMATION);
}

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
@@ -32,3 +32,4 @@
#include<Shlobj.h>
#include<Shellapi.h>
#include<Psapi.h>
#include<AppModel.h>

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//

View File

@@ -35,7 +35,7 @@
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{794E4DCF-F715-4836-9D30-ABD296586D23}</ProjectGuid>
<RootNamespace>QuickLookNative64</RootNamespace>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
<ProjectName>QuickLook.Native64</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
@@ -88,6 +88,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
@@ -34,9 +34,9 @@ HWND hMsgWindow = nullptr;
UINT WM_HOOK_NOTIFY = 0;
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
// do not run when double-clicking
if (wcsstr(GetCommandLine(), RUN_ARG) == nullptr)

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//

View File

@@ -15,7 +15,7 @@
<ProjectGuid>{2C58F9B2-D8FA-4586-942B-5170CECE5963}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>QuickLookWoW64HookHelper</RootNamespace>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
<ProjectName>QuickLook.WoW64HookHelper</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//

View File

@@ -1,4 +1,4 @@
// Copyright <EFBFBD> 2017 Paddy Xu
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//

View File

@@ -90,7 +90,7 @@
<TreeView BorderThickness="0" Focusable="False" Background="Transparent"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<TreeViewItem Focusable="False">
<TreeViewItem Focusable="False" Visibility="Collapsed">
<TreeViewItem.Header>
<Grid ShowGridLines="False">
<Grid.ColumnDefinitions>

View File

@@ -37,16 +37,11 @@ namespace QuickLook.Plugin.ArchiveViewer
IconManager.ClearCache();
}
~ArchiveFileListView()
{
Dispose();
}
public void SetDataContext(object context)
{
treeGrid.DataContext = context;
treeView.Loaded += (sender, e) =>
treeView.LayoutUpdated += (sender, e) =>
{
// return when empty
if (treeView.Items.Count == 0)

View File

@@ -7,21 +7,42 @@
mc:Ignorable="d"
x:Name="infoPanel"
d:DesignHeight="600" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- only for design -->
<ResourceDictionary Source="/QuickLook;component/Styles/MainWindowStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<local:Percent100ToVisibilityVisibleConverter x:Key="Percent100ToVisibilityVisibleConverter" />
<local:Percent100ToVisibilityCollapsedConverter x:Key="Percent100ToVisibilityCollapsedConverter" />
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<local:ArchiveFileListView Grid.Row="0" x:Name="fileListView" Focusable="False" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40*" />
<ColumnDefinition Width="30*" />
<ColumnDefinition Width="30*" />
</Grid.ColumnDefinitions>
<Label x:Name="archiveCount" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center">9 folders and 10 files, solid, password-protected</Label>
<Label x:Name="archiveSizeC" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">Compressed size 9999 bytes</Label>
<Label x:Name="archiveSizeU" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center">Uncompressed size 99999 bytes</Label>
<Grid ZIndex="9999"
Visibility="{Binding ElementName=infoPanel, Path=LoadPercent, Mode=OneWay, Converter={StaticResource Percent100ToVisibilityCollapsedConverter}}">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<Label FontSize="14" HorizontalAlignment="Center">Loading archive ...</Label>
<ProgressBar Height="13" Width="150"
Value="{Binding ElementName=infoPanel, Path=LoadPercent, Mode=OneWay}" />
</StackPanel>
</Grid>
<Grid
Visibility="{Binding ElementName=infoPanel, Path=LoadPercent, Mode=OneWay, Converter={StaticResource Percent100ToVisibilityVisibleConverter}}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<local:ArchiveFileListView Grid.Row="0" x:Name="fileListView" Focusable="False" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40*" />
<ColumnDefinition Width="30*" />
<ColumnDefinition Width="30*" />
</Grid.ColumnDefinitions>
<Label x:Name="archiveCount" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center">0 folders and 0 files, solid, password-protected</Label>
<Label x:Name="archiveSizeC" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">Compressed size 0 bytes</Label>
<Label x:Name="archiveSizeU" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center">Uncompressed size 0 bytes</Label>
</Grid>
</Grid>
</Grid>
</UserControl>

View File

@@ -17,9 +17,14 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Windows.Controls;
using QuickLook.Common.Annotations;
using QuickLook.Common.ExtensionMethods;
using SharpCompress.Archives;
using SharpCompress.Common;
using SharpCompress.Readers;
@@ -29,9 +34,11 @@ namespace QuickLook.Plugin.ArchiveViewer
/// <summary>
/// Interaction logic for ArchiveInfoPanel.xaml
/// </summary>
public partial class ArchiveInfoPanel : UserControl, IDisposable
public partial class ArchiveInfoPanel : UserControl, IDisposable, INotifyPropertyChanged
{
private readonly Dictionary<string, ArchiveFileEntry> _fileEntries = new Dictionary<string, ArchiveFileEntry>();
private bool _disposed;
private double _loadPercent;
private ulong _totalZippedSize;
private string _type;
@@ -39,57 +46,83 @@ namespace QuickLook.Plugin.ArchiveViewer
{
InitializeComponent();
LoadArchive(path);
// design-time only
Resources.MergedDictionaries.Clear();
fileListView.SetDataContext(_fileEntries[""].Children.Keys);
BeginLoadArchive(path);
}
public double LoadPercent
{
get => _loadPercent;
private set
{
if (value == _loadPercent) return;
_loadPercent = value;
OnPropertyChanged();
}
}
public void Dispose()
{
GC.SuppressFinalize(this);
_fileEntries.Clear();
_disposed = true;
fileListView.Dispose();
}
~ArchiveInfoPanel()
public event PropertyChangedEventHandler PropertyChanged;
private void BeginLoadArchive(string path)
{
Dispose();
}
private void LoadArchive(string path)
{
_totalZippedSize = (ulong) new FileInfo(path).Length;
LoadItemsFromArchive(path);
var folders = -1; // do not count root node
var files = 0;
ulong sizeU = 0L;
_fileEntries.ForEach(e =>
new Task(() =>
{
if (e.Value.IsFolder)
folders++;
_totalZippedSize = (ulong) new FileInfo(path).Length;
var root = new ArchiveFileEntry(Path.GetFileName(path), true);
_fileEntries.Add("", root);
LoadItemsFromArchive(path);
var folders = -1; // do not count root node
var files = 0;
ulong sizeU = 0L;
_fileEntries.ForEach(e =>
{
if (e.Value.IsFolder)
folders++;
else
files++;
sizeU += e.Value.Size;
});
string t;
var d = folders != 0 ? $"{folders} folders" : string.Empty;
var f = files != 0 ? $"{files} files" : string.Empty;
if (!string.IsNullOrEmpty(d) && !string.IsNullOrEmpty(f))
t = $", {d} and {f}";
else if (string.IsNullOrEmpty(d) && string.IsNullOrEmpty(f))
t = string.Empty;
else
files++;
t = $", {d}{f}";
sizeU += e.Value.Size;
});
Dispatcher.Invoke(() =>
{
if (_disposed)
return;
string t;
var d = folders != 0 ? $"{folders} folders" : string.Empty;
var f = files != 0 ? $"{files} files" : string.Empty;
if (!string.IsNullOrEmpty(d) && !string.IsNullOrEmpty(f))
t = $", {d} and {f}";
else if (string.IsNullOrEmpty(d) && string.IsNullOrEmpty(f))
t = string.Empty;
else
t = $", {d}{f}";
fileListView.SetDataContext(_fileEntries[""].Children.Keys);
archiveCount.Content =
$"{_type} archive{t}";
archiveSizeC.Content =
$"Compressed size {((long) _totalZippedSize).ToPrettySize(2)}";
archiveSizeU.Content = $"Uncompressed size {((long) sizeU).ToPrettySize(2)}";
});
archiveCount.Content =
$"{_type} archive{t}";
archiveSizeC.Content = $"Compressed size {_totalZippedSize.ToPrettySize(2)}";
archiveSizeU.Content = $"Uncompressed size {sizeU.ToPrettySize(2)}";
LoadPercent = 100d;
}).Start();
}
private void LoadItemsFromArchive(string path)
@@ -99,29 +132,33 @@ namespace QuickLook.Plugin.ArchiveViewer
// ReaderFactory is slow... so limit its usage
string[] useReader = {".tar.gz", ".tgz", ".tar.bz2", ".tar.lz", ".tar.xz"};
if (useReader.Any(i => path.EndsWith(i)))
if (useReader.Any(path.ToLower().EndsWith))
{
var reader = ReaderFactory.Open(stream);
var reader = ReaderFactory.Open(stream, new ChardetReaderOptions());
_type = reader.ArchiveType.ToString();
var root = new ArchiveFileEntry(Path.GetFileName(path), true);
_fileEntries.Add("", root);
while (reader.MoveToNextEntry())
{
if (_disposed)
return;
LoadPercent = 100d * stream.Position / stream.Length;
ProcessByLevel(reader.Entry);
}
}
else
{
var archive = ArchiveFactory.Open(stream);
var archive = ArchiveFactory.Open(stream, new ChardetReaderOptions());
_type = archive.Type.ToString();
var root = new ArchiveFileEntry(Path.GetFileName(path), true);
_fileEntries.Add("", root);
foreach (var entry in archive.Entries)
{
if (_disposed)
return;
LoadPercent = 100d * stream.Position / stream.Length;
ProcessByLevel(entry);
}
}
}
}
@@ -138,8 +175,7 @@ namespace QuickLook.Plugin.ArchiveViewer
if (_fileEntries.ContainsKey(f))
return;
ArchiveFileEntry parent;
_fileEntries.TryGetValue(GetDirectoryName(f), out parent);
_fileEntries.TryGetValue(GetDirectoryName(f), out var parent);
var afe = new ArchiveFileEntry(Path.GetFileName(f), true, parent);
@@ -151,8 +187,7 @@ namespace QuickLook.Plugin.ArchiveViewer
{
var file = pf.Last();
ArchiveFileEntry parent;
_fileEntries.TryGetValue(GetDirectoryName(file), out parent);
_fileEntries.TryGetValue(GetDirectoryName(file), out var parent);
_fileEntries.Add(file, new ArchiveFileEntry(Path.GetFileName(entry.Key), false, parent)
{
@@ -179,5 +214,11 @@ namespace QuickLook.Plugin.ArchiveViewer
return frags.Select((s, i) => frags.Take(i + 1).Aggregate((a, b) => a + "\\" + b)).ToArray();
}
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@@ -16,22 +16,32 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Text;
using SharpCompress.Common;
using SharpCompress.Readers;
using UtfUnknown;
namespace QuickLook.Helpers.BlurLibrary.PlatformsImpl
namespace QuickLook.Plugin.ArchiveViewer
{
public class OsNotSupportedWindowBlurController : IWindowBlurController
internal class ChardetReaderOptions : ReaderOptions
{
public void EnableBlur(IntPtr hwnd)
public ChardetReaderOptions()
{
throw new NotSupportedException();
ArchiveEncoding = new ArchiveEncoding
{
CustomDecoder = Chardet
};
}
public void DisableBlur(IntPtr hwnd)
public string Chardet(byte[] bytes, int index, int count)
{
throw new NotSupportedException();
}
var buffer = new byte[count];
public bool Enabled { get; } = false;
public bool CanBeEnabled { get; } = false;
Array.Copy(bytes, index, buffer, 0, count);
var encoding = CharsetDetector.DetectFromBytes(buffer).Detected?.Encoding ?? Encoding.Default;
return encoding.GetString(buffer);
}
}
}

View File

@@ -19,9 +19,44 @@ using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using QuickLook.Common.ExtensionMethods;
namespace QuickLook.Plugin.ArchiveViewer
{
public class Percent100ToVisibilityVisibleConverter : DependencyObject, IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
value = 0;
var percent = (double) value;
return Math.Abs(percent - 100) < 0.00001 ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class Percent100ToVisibilityCollapsedConverter : DependencyObject, IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
value = 0;
var percent = (double) value;
return Math.Abs(percent - 100) < 0.00001 ? Visibility.Collapsed : Visibility.Visible;
}
public object ConvertBack(object value, Type targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class LevelToIndentConverter : DependencyObject, IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
@@ -77,7 +112,7 @@ namespace QuickLook.Plugin.ArchiveViewer
var size = (ulong) values[0];
var isFolder = (bool) values[1];
return isFolder ? "" : size.ToPrettySize(2);
return isFolder ? "" : ((long) size).ToPrettySize(2);
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)

View File

@@ -47,31 +47,8 @@ namespace QuickLook.Plugin.ArchiveViewer
if (foundElement != null)
break;
}
return foundElement;
}
public static string ToPrettySize(this ulong value, int decimalPlaces = 0)
{
const long OneKb = 1024;
const long OneMb = OneKb * 1024;
const long OneGb = OneMb * 1024;
const long OneTb = OneGb * 1024;
var asTb = Math.Round((double) value / OneTb, decimalPlaces);
var asGb = Math.Round((double) value / OneGb, decimalPlaces);
var asMb = Math.Round((double) value / OneMb, decimalPlaces);
var asKb = Math.Round((double) value / OneKb, decimalPlaces);
var chosenValue = asTb > 1
? $"{asTb} TB"
: asGb > 1
? $"{asGb} GB"
: asMb > 1
? $"{asMb} MB"
: asKb > 1
? $"{asKb} KB"
: $"{Math.Round((double) value, decimalPlaces)} bytes";
return chosenValue;
}
}
}

View File

@@ -211,8 +211,10 @@ namespace QuickLook.Plugin.ArchiveViewer
public readonly IntPtr hIcon;
private readonly int iIcon;
private readonly uint dwAttributes;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MaxPath)] private readonly string szDisplayName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = Namesize)] private readonly string szTypeName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MaxPath)]
private readonly string szDisplayName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = Namesize)]
private readonly string szTypeName;
}
}

Some files were not shown because too many files have changed in this diff Show More