Skip to content

Commit 50004ae

Browse files
committed
Update readme.
Minor tweaks.
1 parent 948eccc commit 50004ae

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@
1212
4. Restart QuickLook.
1313
5. To configure which file types to preview via WebViewPlus, open an html file and click the gears button on the bottom right.
1414

15-
## Experimental
16-
This plugin currently uses experimental MS Edge APIs and requires a dev or beta build of WebView2.
17-
Install MS Edge from one of the insider channels: https://www.microsoftedgeinsider.com/en-us/download
18-
and then set a system environment variable so indicate which should be used.
19-
E.g. WEBVIEW2_RELEASE_CHANNEL_PREFERENCE = 1
20-
https://learn.microsoft.com/en-us/microsoft-edge/webview2/how-to/set-preview-channel#using-an-environment-variable
21-
22-
2315
## Development
2416

2517
1. Clone this project. Do not forget to update submodules.
26-
2. Build project with `Release` profile.
27-
3. Run `Scripts\pack-zip.ps1`.
28-
4. You should find a file named `QuickLook.Plugin.WebViewPlus.qlplugin` in the project directory.
18+
2. Copy WebViewPlus web app to `webApp` or set plugin config `WebAppUrl` - see `WebpagePanel.cs`
19+
3. Set `Output path` in `Debug` configuration to something like `..\QuickLook.upstream\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.WebViewPlus\`
20+
4. Build plugin project with `Debug` profile
21+
5. Build and run upstream Quicklook with `Debug` profile
22+
23+
# Release
24+
1. Build project with `Release` profile.
25+
2. Run `Scripts\pack-zip.ps1`.
26+
3. You should find a file named `QuickLook.Plugin.WebViewPlus.qlplugin` in the project directory.
2927

3028
## License
3129

WebpagePanel.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,21 @@ void sendFileData()
136136
if (isBinary)
137137
{
138138
_sharedBuffer = WebViewEnvironment.CreateSharedBuffer((ulong)_activeFileInfo.Length);
139-
using (Stream stream = _sharedBuffer.OpenStream())
140-
{
141-
using (BinaryWriter writer = new BinaryWriter(stream))
142-
{
143-
writer.Write(File.ReadAllBytes(_activeFileInfo.FullName));
144-
}
139+
using (BinaryWriter writer = new BinaryWriter(_sharedBuffer.OpenStream()))
140+
{
141+
using (var br = new BinaryReader(new FileStream(_activeFileInfo.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
142+
{
143+
writer.Write(br.ReadBytes((int)br.BaseStream.Length));
144+
}
145145
}
146146
}
147147
else
148148
{
149-
_sharedBuffer = WebViewEnvironment.CreateSharedBuffer(1);
150-
textContent = File.ReadAllText(_activeFileInfo.FullName);
149+
_sharedBuffer = WebViewEnvironment.CreateSharedBuffer(1);
150+
using (var sr = new StreamReader(new FileStream(_activeFileInfo.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
151+
{
152+
textContent = sr.ReadToEnd();
153+
}
151154
}
152155
var json = JsonConvert.SerializeObject(
153156
new FileData

0 commit comments

Comments
 (0)