diff options
author | Jeremie Laval <jeremie.laval@gmail.com> | 2012-05-02 21:06:35 +0400 |
---|---|---|
committer | Jeremie Laval <jeremie.laval@gmail.com> | 2012-05-02 21:07:48 +0400 |
commit | 830df8d190faa749dd5ededc6bbe087d6a457c69 (patch) | |
tree | c5725a3a6c2a83962040f456499c87e16467d321 /windoc | |
parent | 88993c65ae9b178b652e8c355cc547cf7ef33f2c (diff) |
[windoc] Redirect HTML content to a temp file to get correct asset path handling
Diffstat (limited to 'windoc')
-rw-r--r-- | windoc/WinDoc/MainWindow.cs | 5 | ||||
-rw-r--r-- | windoc/WinDoc/Program.cs | 14 |
2 files changed, 14 insertions, 5 deletions
diff --git a/windoc/WinDoc/MainWindow.cs b/windoc/WinDoc/MainWindow.cs index d9d0cbf4..730013d7 100644 --- a/windoc/WinDoc/MainWindow.cs +++ b/windoc/WinDoc/MainWindow.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Collections.Generic; using System.ComponentModel; using System.Linq; @@ -233,7 +234,9 @@ namespace WinDoc void LoadHtml (string html) { loadedFromString = true; - docBrowser.DocumentText = html; + var documentUri = Path.Combine (Program.MonoDocDir, "doc.html"); + File.WriteAllText (documentUri, html); + docBrowser.Navigate ("file://" + Path.GetFullPath (documentUri)); } bool ShowNodeInTree (Node node) diff --git a/windoc/WinDoc/Program.cs b/windoc/WinDoc/Program.cs index 4fe90371..e8c596af 100644 --- a/windoc/WinDoc/Program.cs +++ b/windoc/WinDoc/Program.cs @@ -11,7 +11,7 @@ namespace WinDoc { static class Program { - static string MonodocDir; + static string monodocDir; [STAThread] static void Main(string[] args) @@ -55,8 +55,8 @@ namespace WinDoc static void PrepareCache () { - MonodocDir = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "WinDoc", "Caches"); - var mdocimages = Path.Combine (MonodocDir, "mdocimages"); + monodocDir = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "WinDoc", "Caches"); + var mdocimages = Path.Combine (monodocDir, "mdocimages"); if (!Directory.Exists (mdocimages)){ try { Directory.CreateDirectory (mdocimages); @@ -72,7 +72,7 @@ namespace WinDoc if (!res.EndsWith (".png") || res.EndsWith (".jpg")) continue; - var image = Path.Combine (MonodocDir, "mdocimages", res); + var image = Path.Combine (monodocDir, "mdocimages", res); if (File.Exists (image)) continue; @@ -103,5 +103,11 @@ namespace WinDoc get; private set; } + + public static string MonoDocDir { + get { + return monodocDir; + } + } } } |