public static XmlNode GetNodeFromUrl (string url, RootTree tree) { Console.WriteLine ("Url is: {0}", url); string [] uSplit = ParseEditUrl (url); Console.WriteLine ("Results are: {0}\n{1}\n{2}", uSplit [0], uSplit [1], uSplit [2]); string xp = uSplit [2]; string id = uSplit [1]; XmlDocument d; if (uSplit[0].StartsWith("monodoc:///")) { int prov = int.Parse (uSplit [0].Substring("monodoc:///".Length)); d = tree.GetHelpSourceFromId (prov).GetHelpXmlWithChanges (id); } else if (uSplit[0].StartsWith("file:")) { d = new XmlDocument(); d.PreserveWhitespace = true; d.Load(uSplit[0].Substring(5)); } else { throw new NotImplementedException("Don't know how to load " + url); } return d.SelectSingleNode (xp); }
public BrowserWindow() { rootTree = RootTree.LoadTree(@"/Library/Frameworks/Mono.framework/Versions/Current/lib/monodoc"); MonoDocWebRequest.RegisterWithRootTree(rootTree); treeView = new DocTreeView(rootTree); treeView.SelectionChanged += treeView_SelectionChanged; scrollView = new ScrollView() { Scrollers = Axis.Both }; scrollView.DocumentView = treeView; webView = new WebView(); // splitView = new SplitView() // { // Margin = new Thickness(0, 0, 0, Window.SmallBottomBarHeight), // Width = double.NaN, // Height = double.NaN, // Orientation = Orientation.Horizontal, // DividerStyle = DividerStyle.Thin, // }; // splitView.Children.Add(scrollView); // splitView.Children.Add(webView); // Content.Children.Add(splitView); scrollView.HorizontalAlignment = HorizontalAlignment.Left; scrollView.Width = 250; scrollView.Margin = new Thickness(4, 4, 4, Window.SmallBottomBarHeight + 4); webView.HorizontalAlignment = HorizontalAlignment.Right; webView.Margin = new Thickness(258, 4, 4, Window.SmallBottomBarHeight + 4); Content.Children.Add(scrollView); Content.Children.Add(webView); CreateToolbarTemplate(); Toolbar = new Toolbar() { Customizable = true, TemplateName = "Main" }; BottomBarHeight = Window.SmallBottomBarHeight; Title = "Mono Documentation Browser"; }
public static void SaveChange (string url, RootTree tree, XmlNode node, string node_url) { string [] uSplit = ParseEditUrl (url); string xp = uSplit [2]; string id = uSplit [1]; if (uSplit[0].StartsWith("monodoc:///")) { int prov = int.Parse (uSplit [0].Substring("monodoc:///".Length)); HelpSource hs = tree.GetHelpSourceFromId (prov); changes.AddChange (hs.Name, hs.GetRealPath (id), xp, node, node_url); changes.Save (); } else if (uSplit[0].StartsWith("file:")) { uSplit[0] = uSplit[0].Substring(5); XmlDocument d = new XmlDocument(); d.PreserveWhitespace = true; d.Load(uSplit[0]); XmlNode original = d.SelectSingleNode(xp); original.ParentNode.ReplaceChild(d.ImportNode(node, true), original); d.Save(uSplit[0]); } else { throw new NotImplementedException("Don't know how to save to " + url); } }
private MonoDocWebRequest(Uri uri, RootTree rootTree) { requestUri = uri; this.rootTree = rootTree; getResponse = GetResponse; getRequestStream = GetRequestStream; }
public AppDelegate () { PrepareCache (); ExtractImages (); controller = new MonodocDocumentController (); // Some UI feature we use rely on Lion, so special case it try { var version = new NSDictionary ("/System/Library/CoreServices/SystemVersion.plist"); isOnLion = version.ObjectForKey (new NSString ("ProductVersion")).ToString ().StartsWith ("10.7"); } catch {} // Load documentation Root = RootTree.LoadTree (null); var macDocPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "macdoc"); if (!Directory.Exists (macDocPath)) Directory.CreateDirectory (macDocPath); IndexUpdateManager = new IndexUpdateManager (Root.HelpSources.Cast<HelpSource> ().Select (hs => Path.Combine (hs.BaseFilePath, hs.Name + ".zip")).Where (File.Exists), macDocPath); BookmarkManager = new BookmarkManager (macDocPath); AppleDocHandler = new AppleDocHandler ("/Library/Frameworks/Mono.framework/Versions/Current/etc/"); // Configure the documentation rendering. SettingsHandler.Settings.EnableEditing = false; SettingsHandler.Settings.preferred_font_size = 200; HelpSource.use_css = true; }
//FIXME: allow adding sources without restart when extension installed (will need to be async) // will also be tricky we cause we'll also have update any running MonoDoc viewer static void InitializeHelpTree () { lock (helpTreeLock) { if (helpTreeInitialized) return; Counters.HelpServiceInitialization.BeginTiming (); try { helpTree = RootTree.LoadTree (); foreach (var node in AddinManager.GetExtensionNodes ("/MonoDevelop/ProjectModel/MonoDocSources")) sources.Add (((MonoDocSourceNode)node).Directory); //remove nonexistent sources foreach (var s in sources.ToList ().Where (d => !Directory.Exists (d))) sources.Remove (s); foreach (var s in sources) helpTree.AddSource (s); } catch (Exception ex) { if (!(ex is ThreadAbortException) && !(ex.InnerException is ThreadAbortException)) LoggingService.LogError ("Monodoc documentation tree could not be loaded.", ex); } finally { helpTreeInitialized = true; Counters.HelpServiceInitialization.EndTiming (); } } }
//FIXME: allow adding sources without restart when extension installed (will need to be async) // will also be tricky we cause we'll also have update any running MonoDoc viewer static void InitializeHelpTree () { lock (helpTreeLock) { if (helpTreeInitialized) return; Counters.HelpServiceInitialization.BeginTiming (); try { helpTree = RootTree.LoadTree (); //FIXME: don't do this when monodoc itself does it or we'll get duplicates! if (PropertyService.IsMac) sources.Add ("/Library/Frameworks/Mono.framework/External/monodoc"); foreach (var node in AddinManager.GetExtensionNodes ("/MonoDevelop/ProjectModel/MonoDocSources")) sources.Add (((MonoDocSourceNode)node).Directory); foreach (var s in sources) if (Directory.Exists (s)) helpTree.AddSource (s); } catch (Exception ex) { if (!(ex is ThreadAbortException) && !(ex.InnerException is ThreadAbortException)) LoggingService.LogError ("Monodoc documentation tree could not be loaded.", ex); } finally { helpTreeInitialized = true; Counters.HelpServiceInitialization.EndTiming (); } } }
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); }
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)); }
public AppDelegate () { PrepareCache (); ExtractImages (); // Load documentation Root = RootTree.LoadTree (null); // Configure the documentation rendering. SettingsHandler.Settings.EnableEditing = false; SettingsHandler.Settings.preferred_font_size = 200; HelpSource.use_css = true; }
public static void RemoveChange(string url, RootTree tree) { /*string [] uSplit = ParseEditUrl (url); * * string xp = uSplit [2]; * string id = uSplit [1]; * * if (uSplit[0].StartsWith("monodoc:///")) { * int prov = int.Parse (uSplit [0].Substring("monodoc:///".Length)); * HelpSource hs = tree.GetHelpSourceFromId (prov); * * changes.RemoveChange (hs.Name, hs.GetRealPath (id), xp); * changes.Save (); * } else if (uSplit[0].StartsWith("file:")) { * //TODO: Not implemented * }*/ }
static void InitializeHelpTree () { lock (helpTreeLock) { if (helpTreeInitialized) return; try { var cacheDir = GetMonoDocCacheRoot (); if (!cacheDir.IsNullOrEmpty) helpTree = RootTree.LoadTree (cacheDir); else helpTree = RootTree.LoadTree (); } catch (Exception ex) { if (!(ex is ThreadAbortException) && !(ex.InnerException is ThreadAbortException)) LoggingService.LogError ("Monodoc documentation tree could not be loaded.", ex); } finally { helpTreeInitialized = true; LoggingService.Trace ("Ide.HelpService", "[ASYNC] Initialized Help Service"); } } }
//FIXME: allow adding sources without restart when extension installed (will need to be async) // will also be tricky we cause we'll also have update any running MonoDoc viewer static void InitializeHelpTree() { lock (helpTreeLock) { if (helpTreeInitialized) return; //Counters.HelpServiceInitialization.BeginTiming(); try { //foreach (var node in AddinManager.GetExtensionNodes("/MonoDevelop/ProjectModel/MonoDocSources")) // sources.Add(((MonoDocSourceNode)node).Directory); sources.Add("/usr/lib/monodoc"); sources.Add("/Library/Frameworks/Mono.framework/Versions/Current/lib/monodoc/"); //remove nonexistent sources foreach (var s in sources.ToList().Where(d => !Directory.Exists(d))) sources.Remove(s); //foreach (var s in sources) // helpTree.AddSource(s); helpTree = RootTree.LoadTree(sources.First()); } catch (Exception ex) { if (!(ex is ThreadAbortException) && !(ex.InnerException is ThreadAbortException)) //LoggingService.LogError("Monodoc documentation tree could not be loaded.", ex); Console.WriteLine("Monodoc documentation tree could not be loaded." + ex); } finally { helpTreeInitialized = true; //Counters.HelpServiceInitialization.EndTiming(); } } }
//FIXME: allow adding sources without restart when extension installed (will need to be async) // will also be tricky we cause we'll also have update any running MonoDoc viewer static void InitializeHelpTree () { lock (helpTreeLock) { if (helpTreeInitialized) return; Counters.HelpServiceInitialization.BeginTiming (); try { helpTree = RootTree.LoadTree (); foreach (var node in AddinManager.GetExtensionNodes ("/MonoDevelop/ProjectModel/MonoDocSources")) sources.Add (((MonoDocSourceNode)node).Directory); if (Platform.IsWindows) { // windoc defines a special external directory used by XA. we need to read these docs too. // Not sure why it wasn't defined in monodoc.dll var commonAppData = Environment.GetFolderPath (Environment.SpecialFolder.CommonApplicationData); sources.Add (Path.Combine (commonAppData, "Monodoc")); } //remove nonexistent sources foreach (var s in sources.ToList ().Where (d => !Directory.Exists (d))) sources.Remove (s); foreach (var s in sources) helpTree.AddSource (s); } catch (Exception ex) { if (!(ex is ThreadAbortException) && !(ex.InnerException is ThreadAbortException)) LoggingService.LogError ("Monodoc documentation tree could not be loaded.", ex); } finally { helpTreeInitialized = true; Counters.HelpServiceInitialization.EndTiming (); } } }
public static void RemoveChange (string url, RootTree tree) { string [] uSplit = ParseEditUrl (url); string xp = uSplit [2]; string id = uSplit [1]; if (uSplit[0].StartsWith("monodoc:///")) { int prov = int.Parse (uSplit [0].Substring("monodoc:///".Length)); HelpSource hs = tree.GetHelpSourceFromId (prov); changes.RemoveChange (hs.Name, hs.GetRealPath (id), xp); changes.Save (); } else if (uSplit[0].StartsWith("file:")) { //TODO: Not implemented } }
public static RootTree LoadTree (string indexDir, XmlDocument docTree, IEnumerable<string> sourceFiles) { if (docTree == null) { docTree = new XmlDocument (); using (var defTree = typeof(RootTree).Assembly.GetManifestResourceStream ("monodoc.xml")) docTree.Load (defTree); } sourceFiles = sourceFiles ?? new string [0]; // // Load the layout // RootTree root = new RootTree (); root.basedir = indexDir; XmlNodeList nodes = docTree.SelectNodes ("/node/node"); root.name_to_node ["root"] = root; root.name_to_node ["libraries"] = root; root.Populate (root, nodes); Node third_party = root.LookupEntryPoint ("various"); if (third_party == null) { Console.Error.WriteLine ("No 'various' doc node! Check monodoc.xml!"); third_party = root; } // // Load the sources // foreach (var sourceFile in sourceFiles){ root.AddSourceFile (sourceFile); } foreach (string path in UncompiledHelpSources) { EcmaUncompiledHelpSource hs = new EcmaUncompiledHelpSource(path); hs.RootTree = root; root.help_sources.Add (hs); string epath = "extra-help-source-" + hs.Name; Node hsn = root.CreateNode (hs.Name, "root:/" + epath); root.name_to_hs [epath] = hs; hsn.EnsureNodes (); foreach (Node n in hs.Tree.Nodes){ hsn.AddNode (n); } } // Clean the tree PurgeNode(root); root.Sort (); return root; }
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 (); }
public Browser (string basedir, IEnumerable<string> sources, string engine) { #if MACOS try { InitMacAppHandlers(); } catch (Exception ex) { Console.Error.WriteLine ("Installing Mac AppleEvent handlers failed. Skipping.\n" + ex); } #endif this.engine = engine; ui = new Glade.XML (null, "browser.glade", "window1", null); ui.Autoconnect (this); MainWindow = (Gtk.Window) ui["window1"]; MainWindow.DeleteEvent += new DeleteEventHandler (delete_event_cb); MainWindow.KeyPressEvent += new KeyPressEventHandler (keypress_event_cb); MainWindow.KeyReleaseEvent += new KeyReleaseEventHandler (keyrelease_event_cb); Stream icon = GetResourceImage ("monodoc.png"); if (icon != null) { monodoc_pixbuf = new Gdk.Pixbuf (icon); MainWindow.Icon = monodoc_pixbuf; } //ellipsizing label for the title title_label = new ELabel (""); title_label.Xalign = 0; Pango.FontDescription fd = new Pango.FontDescription (); fd.Weight = Pango.Weight.Bold; title_label.ModifyFont (fd); title_label.Layout.FontDescription = fd; title_label_box.Add (title_label); title_label.Show (); //colour the bar according to the current style bar_style = bar_eb.Style.Copy (); bar_eb.Style = bar_style; MainWindow.StyleSet += new StyleSetHandler (BarStyleSet); BarStyleSet (null, null); help_tree = Driver.LoadTree (basedir, sources); tree_browser = new TreeBrowser (help_tree, reference_tree, this); // Bookmark Manager init; bookmark_manager = new BookmarkManager(this); // // Tab Notebook and first tab // tabs_nb = new Notebook(); //the Notebook that holds tabs tabs_nb.Scrollable = true; tabs_nb.SwitchPage += new SwitchPageHandler(ChangeTab); help_container.Add(tabs_nb); AddTab(); if ((capabilities & Capabilities.Fonts) != 0) { // Add Menu entries for changing the font Menu aux = (Menu) view1.Submenu; MenuItem sep = new SeparatorMenuItem (); sep.Show (); aux.Append (sep); AccelGroup accel = new AccelGroup (); MainWindow.AddAccelGroup (accel); textLarger = new MenuItem ("_Larger text"); textLarger.Activated += new EventHandler (TextLarger); textLarger.Show (); aux.Append (textLarger); AccelKey ak = new AccelKey (Gdk.Key.plus, Gdk.ModifierType.ControlMask, AccelFlags.Visible); textLarger.AddAccelerator ("activate", accel, ak); textSmaller = new MenuItem ("_Smaller text"); textSmaller.Activated += new EventHandler (TextSmaller); textSmaller.Show (); aux.Append (textSmaller); ak = new AccelKey (Gdk.Key.minus, Gdk.ModifierType.ControlMask, AccelFlags.Visible); textSmaller.AddAccelerator ("activate", accel, ak); textNormal = new MenuItem ("_Original size"); textNormal.Activated += new EventHandler (TextNormal); textNormal.Show (); aux.Append (textNormal); ak = new AccelKey (Gdk.Key.Key_0, Gdk.ModifierType.ControlMask, AccelFlags.Visible); textNormal.AddAccelerator ("activate", accel, ak); } // restore the editing setting editing1.Active = SettingsHandler.Settings.EnableEditing; comments1.Active = SettingsHandler.Settings.ShowComments; cut1.Sensitive = false; paste1.Sensitive = false; // // Other bits // search_index = help_tree.GetSearchIndex(); if (search_index == null) { ppanel = new ProgressPanel ("<b>No Search index found</b>", "Generate", RootTree.MakeSearchIndex, CreateSearchPanel); search_vbox.Add (ppanel); search_vbox.Show (); } else { CreateSearchPanel (); } bookList = new ArrayList (); index_browser = IndexBrowser.MakeIndexBrowser (this); MainWindow.ShowAll(); #if MACOS try { InstallMacMainMenu (); ((MenuBar)ui["menubar1"]).Hide (); } catch (Exception ex) { Console.Error.WriteLine ("Installing Mac IGE Main Menu failed. Skipping.\n" + ex); } #endif }
public GtkHtmlHtmlRender (RootTree help_tree) { this.help_tree = help_tree; }
public MonoWebBrowserHtmlRender (RootTree help_tree) { this.help_tree = help_tree; }
public static void MakeSearchIndex(RootTree root) { root.GenerateSearchIndex(); }
public void Setup () { root = RootTree.LoadTree (BaseDir, includeExternal: false); generator = new HtmlGenerator (defaultCache: null); }
public MonodocService() : base() { helpTree = RootTree.LoadTree (); }
public static void RenderEditPreview (string url, RootTree tree, XmlNode new_node, XmlWriter w) { string [] uSplit = ParseEditUrl (url); if (uSplit[0].StartsWith("monodoc:///")) { int prov = int.Parse (uSplit [0].Substring("monodoc:///".Length)); HelpSource hs = tree.GetHelpSourceFromId (prov); hs.RenderPreviewDocs (new_node, w); } else { foreach (HelpSource hs in tree.HelpSources) { if (hs is EcmaUncompiledHelpSource) { // It doesn't matter which EcmaHelpSource is chosen. hs.RenderPreviewDocs (new_node, w); break; } } } }
public static void MakeIndex (RootTree root) { if (root == null) return; IndexMaker index_maker = new IndexMaker (); foreach (HelpSource hs in root.help_sources){ hs.PopulateIndex (index_maker); } // if the user has no write permissions use config dir string path = Path.Combine (root.basedir, "monodoc.index"); try { index_maker.Save (path); } catch (System.UnauthorizedAccessException) { path = Path.Combine (SettingsHandler.Path, "monodoc.index"); try { index_maker.Save (path); } catch (System.UnauthorizedAccessException) { Console.WriteLine ("Unable to write index file in {0}", Path.Combine (SettingsHandler.Path, "monodoc.index")); return; } } if (IsUnix){ // No octal in C#, how lame is that chmod (path, 0x1a4); } Console.WriteLine ("Documentation index at {0} updated", path); }
public static void MakeSearchIndex (RootTree root) { // Loads the RootTree Console.WriteLine ("Loading the monodoc tree..."); if (root == null) return; string dir = Path.Combine (root.basedir, "search_index"); IndexWriter writer; //try to create the dir to store the index try { if (!Directory.Exists (dir)) Directory.CreateDirectory (dir); writer = new IndexWriter(Mono.Lucene.Net.Store.FSDirectory.GetDirectory(dir, true), new StandardAnalyzer(), true); } catch (UnauthorizedAccessException) { //try in the .config directory try { dir = Path.Combine (SettingsHandler.Path, "search_index"); if (!Directory.Exists (dir)) Directory.CreateDirectory (dir); writer = new IndexWriter(Mono.Lucene.Net.Store.FSDirectory.GetDirectory(dir, true), new StandardAnalyzer(), true); } catch (UnauthorizedAccessException) { Console.WriteLine ("You don't have permissions to write on " + dir); return; } } //Collect all the documents Console.WriteLine ("Collecting and adding documents..."); foreach (HelpSource hs in root.HelpSources) hs.PopulateSearchableIndex (writer); //Optimize and close Console.WriteLine ("Closing..."); writer.Optimize(); writer.Close(); }
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); }
public TreeBrowser (RootTree help_tree, TreeView reference_tree, Browser browser) { this.browser = browser; tree_view = reference_tree; iter_to_node = new Hashtable (); node_to_iter = new Hashtable (); node_parent = new Hashtable (); // Setup the TreeView tree_view.AppendColumn ("name_col", new CellRendererText (), "text", 0); // Bind events tree_view.RowExpanded += new Gtk.RowExpandedHandler (RowExpanded); tree_view.Selection.Changed += new EventHandler (RowActivated); tree_view.RowActivated += new Gtk.RowActivatedHandler (RowClicked); // Setup the model this.help_tree = help_tree; store = new TreeStore (typeof (string)); root_iter = store.AppendValues ("Mono Documentation"); iter_to_node [root_iter] = help_tree; node_to_iter [help_tree] = root_iter; PopulateNode (help_tree, root_iter); reference_tree.Model = store; }
public void Setup () { rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false); }
public static string GetHtml (string url, HelpSource help_source, RootTree help_tree) { Node _; return GetHtml (url, help_source, help_tree, out _); }
static void Main(string[] args) { var initialUrl = string.Empty; var docSources = new List<string> (); new OptionSet { { "url=|u=", u => initialUrl = u }, { "docdir=", dir => docSources.Add (dir) }, }.Parse (args); if (initialUrl.StartsWith ("mdoc://")) { initialUrl = initialUrl.Substring ("mdoc://".Length); // Remove leading scheme initialUrl = initialUrl.Substring (0, initialUrl.Length - 1); // Remove trailing '/' initialUrl = Uri.UnescapeDataString (initialUrl); // Unescape URL } // Don't crash if any of these steps fails try { PrepareCache (); SetupLogging (); ExtractImages (); } catch (Exception e) { Console.WriteLine ("Non-fatal exception during initialization: {0}", e); } // Load documentation Directory.SetCurrentDirectory (Path.GetDirectoryName (typeof (Program).Assembly.Location)); Root = RootTree.LoadTree (); foreach (var dir in docSources) Root.AddSource (dir); if (Directory.Exists (externalMonodocPath)) Root.AddSource (externalMonodocPath); var winDocPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "WinDoc"); if (!Directory.Exists (winDocPath)) Directory.CreateDirectory (winDocPath); IndexUpdateManager = new IndexUpdateManager (Root.HelpSources .Cast<HelpSource> () .Select (hs => Path.Combine (hs.BaseFilePath, hs.Name + ".zip")) .Where (File.Exists), winDocPath); BookmarkManager = new BookmarkManager (winDocPath); Application.ApplicationExit += (s, e) => BookmarkManager.SaveBookmarks (); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault (false); Application.Run(new MainWindow (initialUrl)); }
public static void MakeSearchIndex (RootTree root) { root.GenerateSearchIndex (); }
public AppDelegate () { PrepareCache (); ExtractImages (); controller = new MonodocDocumentController (); // Some UI feature we use rely on Lion or better, so special case it try { var version = new NSDictionary ("/System/Library/CoreServices/SystemVersion.plist"); var osxVersion = Version.Parse (version.ObjectForKey (new NSString ("ProductVersion")).ToString ()); isOnLion = osxVersion.Major == 10 && osxVersion.Minor >= 7; } catch {} // Load documentation var args = Environment.GetCommandLineArgs (); IEnumerable<string> extraDocs = null, extraUncompiledDocs = null; if (args != null && args.Length > 1) { var extraDirs = args.Skip (1); extraDocs = extraDirs .Where (d => d.StartsWith ("+")) .Select (d => d.Substring (1)) .Where (d => Directory.Exists (d)); extraUncompiledDocs = extraDirs .Where (d => d.StartsWith ("@")) .Select (d => d.Substring (1)) .Where (d => Directory.Exists (d)); } if (extraUncompiledDocs != null) foreach (var dir in extraUncompiledDocs) RootTree.UncompiledHelpSources.Add (dir); Root = RootTree.LoadTree (null); if (extraDocs != null) foreach (var dir in extraDocs) Root.AddSource (dir); var macDocPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "macdoc"); if (!Directory.Exists (macDocPath)) Directory.CreateDirectory (macDocPath); var helpSources = Root.HelpSources .Cast<HelpSource> () .Where (hs => !string.IsNullOrEmpty (hs.BaseFilePath) && !string.IsNullOrEmpty (hs.Name)) .Select (hs => Path.Combine (hs.BaseFilePath, hs.Name + ".zip")) .Where (File.Exists); IndexUpdateManager = new IndexUpdateManager (helpSources, macDocPath); BookmarkManager = new BookmarkManager (macDocPath); AppleDocHandler = new AppleDocHandler ("/Library/Frameworks/Mono.framework/Versions/Current/etc/"); // Configure the documentation rendering. SettingsHandler.Settings.EnableEditing = false; SettingsHandler.Settings.preferred_font_size = 200; HelpSource.use_css = true; }
static Controller() { help_tree = RootTree.LoadTree(); }
public GeckoHtmlRender (RootTree help_tree) { this.help_tree = help_tree; }