-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Windows Store version of QuickLook
- Loading branch information
Showing
4 changed files
with
95 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.IO; | ||
using System.IO.Pipes; | ||
using System.Security.Principal; | ||
using System.Windows.Forms; | ||
|
||
namespace Bridge | ||
{ | ||
internal static class Program | ||
{ | ||
private static void Main(string[] args) | ||
{ | ||
if (args.Length != 1) | ||
{ | ||
MessageBox.Show("Usage: Bridge.exe \"<path of a file/folder>\""); | ||
return; | ||
} | ||
|
||
SendMessage(Toggle, args[0]); | ||
} | ||
|
||
private static readonly string PipeName = "QuickLook.App.Pipe." + WindowsIdentity.GetCurrent().User?.Value; | ||
private const string Toggle = "QuickLook.App.PipeMessages.Toggle"; | ||
|
||
private static void SendMessage(string pipeMessage, string path = null) | ||
{ | ||
if (path == null) | ||
path = ""; | ||
|
||
try | ||
{ | ||
using (var client = new NamedPipeClientStream(".", PipeName, PipeDirection.Out)) | ||
{ | ||
client.Connect(1000); | ||
|
||
using (var writer = new StreamWriter(client)) | ||
{ | ||
writer.WriteLine($"{pipeMessage}|{path}"); | ||
writer.Flush(); | ||
} | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
MessageBox.Show("QuickLook not found. Please install QuickLook (http://pooi.moe/QuickLook/) or specify a custom view command instead."); | ||
} | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters