internal Response(Uri uri, RootTree rootTree) { responseUri = uri; headerCollection = new WebHeaderCollection(); headerCollection.Add("Content-Type", "text/html; Charset=utf-16"); var data = Encoding.Unicode.GetBytes(rootTree.RenderUrl(uri.ToString(), out node)); responseStream = new MemoryStream(data, false); }
public void FinishLoading(Notification aNotification) { drawer.Open(); mainWindow.Show(); indexBrowser.DoubleAction += new EventHandler(OnBrowserDoubleAction); outlineView.DoubleAction += new EventHandler(OnOutlineViewDoubleAction); // use history. webView.HasBackForwardList = true; webView.BackForwardList.Capacity = 100; forwardMenuItem.Click += new ActionHandler(goForward); backMenuItem.Click += new ActionHandler(goBack); Node match; string content = help_tree.RenderUrl("root:", out match); content = content.Replace("a href='", "a href='http://monodoc/load?"); content = content.Replace("a href=\"", "a href=\"http://monodoc/load?"); webView.Render(content); addHistoryItem("root:"); }
static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage: mod.exe Url"); return; } RootTree help_tree = RootTree.LoadTree(); Node n; Console.WriteLine(help_tree.RenderUrl(args[0], out n)); }
static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("Usage: mod.exe Url"); return; } bool index = (args.Length == 2); RootTree help_tree = RootTree.LoadTree(); if (index) { Console.WriteLine("Building index"); RootTree.MakeIndex(); return; } Node n; Console.WriteLine(help_tree.RenderUrl(args[0], out n)); }
public static string GetHtml (string url, HelpSource help_source, RootTree help_tree, out Node match) { match = null; string html_content = null; if (help_source != null) html_content = help_source.GetText (url, out match); if (html_content == null && help_tree != null) { html_content = help_tree.RenderUrl (url, out match); if (html_content != null && match != null && match.tree != null) help_source = match.tree.HelpSource; } if (html_content == null) return null; var html = new StringWriter (); html.Write ("<html>\n"); html.Write (" <head>\n"); html.Write (" <title>"); html.Write (url); html.Write ("</title>\n"); if (help_source != null && help_source.InlineCss != null) { html.Write (" <style type=\"text/css\">\n"); html.Write (help_source.InlineCss); html.Write (" </style>\n"); } if (help_source != null && help_source.InlineJavaScript != null) { html.Write (" <script type=\"text/JavaScript\">\n"); html.Write (help_source.InlineJavaScript); html.Write (" </script>\n"); } html.Write (" </head>\n"); html.Write (" <body>\n"); html.Write (html_content); html.Write (" </body>\n"); html.Write ("</html>"); return html.ToString (); }
static int Main(string [] args) { string topic = null; for (int i = 0; i < args.Length; i++) { switch (args [i]) { case "--html": if (i + 1 == args.Length) { Console.WriteLine("--html needed argument"); return(1); } Node n; RootTree help_tree = RootTree.LoadTree(); string res = help_tree.RenderUrl(args [i + 1], out n); if (res != null) { Console.WriteLine(res); return(0); } else { return(1); } case "--make-index": RootTree.MakeIndex(); return(0); case "--help": Console.WriteLine("Options are:\n" + "browser [--html TOPIC] [--make-index] [TOPIC] [--merge-changes CHANGE_FILE TARGET_DIR+]"); return(0); case "--merge-changes": if (i + 2 == args.Length) { Console.WriteLine("--merge-changes 2+ args"); return(1); } ArrayList targetDirs = new ArrayList(); for (int j = i + 2; j < args.Length; j++) { targetDirs.Add(args [j]); } EditMerger e = new EditMerger( GlobalChangeset.LoadFromFile(args [i + 1]), targetDirs ); e.Merge(); return(0); default: topic = args [i]; break; } } Settings.RunningGUI = true; DocumentBrowser browser = new DocumentBrowser(); browser.Run(); return(0); }