public void ReachabilityWithShortGenericNotationTest () { var rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false); Node result; var generator = new CheckGenerator (); Assert.IsTrue (rootTree.RenderUrl ("T:System.Collections.Concurrent.IProducerConsumerCollection`1", generator, out result), "#1"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Collections.Generic.Dictionary`2", generator, out result), "#2"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Action`4", generator, out result), "#3"); Assert.IsTrue (rootTree.RenderUrl ("T:System.EventHandler`1", generator, out result), "#4"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`5", generator, out result), "#5a"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`4", generator, out result), "#5b"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`6", generator, out result), "#5c"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`7", generator, out result), "#5d"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`3", generator, out result), "#5e"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`2", generator, out result), "#5f"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`1", generator, out result), "#5g"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`8", generator, out result), "#5h"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`9", generator, out result), "#5i"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Action`3", generator, out result), "#6a"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Action`2", generator, out result), "#6b"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Action`4", generator, out result), "#6c"); Assert.IsTrue (rootTree.RenderUrl ("T:System.IComparable`1", generator, out result), "#7"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Lazy`1", generator, out result), "#8"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Tuple`1", generator, out result), "#9a"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Tuple`2", generator, out result), "#9b"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Tuple`3", generator, out result), "#9c"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Tuple`4", generator, out result), "#9d"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Collections.Generic.Dictionary`2+ValueCollection", generator, out result), "#10"); Assert.IsFalse (rootTree.RenderUrl ("T:System.EventHandler`2", generator, out result), "#11"); Assert.IsFalse (rootTree.RenderUrl ("T:System.Lazy`2", generator, out result), "#12"); }
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"); } } }
public override void Run (IEnumerable<string> args) { string rootPath = null; var options = new OptionSet () { { "r=|root=", "Specify which documentation root to use. Default is $libdir/monodoc", v => rootPath = v }, }; var extra = Parse (options, args, "index", "[OPTIONS]+ ACTION", "Create Monodoc indexes depending on ACTION. Possible values are \"tree\" or \"search\" for, respectively, mdoc tree and lucene search"); if (extra == null) return; var root = string.IsNullOrEmpty (rootPath) ? RootTree.LoadTree () : RootTree.LoadTree (rootPath); foreach (var action in extra) { switch (action) { case "tree": RootTree.MakeIndex (root); break; case "search": RootTree.MakeSearchIndex (root); break; } } }
public void ReachabilityTest() { var rootTree = RootTree.LoadTree(GetBaseDir(), false); Node result; var generator = new CheckGenerator(); int errorCount = 0; int testCount = 0; foreach (var leaf in GetLeaves(rootTree.RootNode)) { if (!rootTree.RenderUrl(leaf.PublicUrl, generator, out result) || leaf.PublicUrl != result.PublicUrl) { Console.WriteLine("Error: {0} with HelpSource {1} ", leaf.PublicUrl, leaf.Tree.HelpSource.Name); errorCount++; } testCount++; } //Assert.AreEqual (0, errorCount, errorCount + " / " + testCount.ToString ()); // HACK: in reality we have currently 17 known issues, mostly which are due to duplicated namespaces across // doc sources, something that was never supported and that we need to improve/fix at some stage. // also some issues with operators. Assert.That(errorCount, Is.LessThanOrEqualTo(17), errorCount + " / " + testCount.ToString()); }
void GenerateCache(string basePath, string treeFile, string outDir) { Tree tree = new Tree(null, treeFile); RootTree docRoot = RootTree.LoadTree(); string helpSourceName = Path.GetFileName(basePath); HelpSource hs = docRoot.HelpSources.Cast <HelpSource> () .FirstOrDefault(h => h.Name == helpSourceName); if (hs == null) { throw new Exception("Only installed .tree and .zip files are supported."); } foreach (Node node in tree.TraverseDepthFirst <Node, Node> (t => t, t => t.Nodes.Cast <Node> ())) { var url = node.URL; Message(TraceLevel.Info, "\tProcessing URL: {0}", url); if (string.IsNullOrEmpty(url)) { continue; } var file = XmlDocUtils.GetCachedFileName(outDir, url); using (var o = File.AppendText(file)) { Node _; // Sometimes the HelpSource won't directly support a url. // Case in point: the Tree will contain N:Enter.Namespace.Here nodes // which aren't supported by HelpSource.GetText. // If this happens, docRoot.RenderUrl() works. // (And no, we can't always use docRoot.RenderUrl() for URLs like // "ecma:0#Foo/", as that'll just grab the 0th stream contents from // the first EcmaHelpSource found... string contents = hs.GetText(url, out _) ?? docRoot.RenderUrl(url, out _); o.Write(contents); } } }
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)); }
//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 void InitializeHelpTree() { lock (helpTreeLock) { if (helpTreeInitialized) { return; } // Only attempt on Windows if we can find monodoc.xml (currently not the case). // This avoids a first-chance FileNotFoundException in LoadTree. if (Platform.IsWindows && !File.Exists("monodoc.xml")) { LoggingService.LogError("Monodoc documentation tree could not be loaded because monodoc.xml was not found."); helpTreeInitialized = true; 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 void ReachabilityWithShortGenericNotationTest() { var rootTree = RootTree.LoadTree(Path.GetFullPath(BaseDir), false); Node result; var generator = new CheckGenerator(); Assert.IsTrue(rootTree.RenderUrl("T:System.Collections.Concurrent.IProducerConsumerCollection`1", generator, out result), "#1"); Assert.IsTrue(rootTree.RenderUrl("T:System.Collections.Generic.Dictionary`2", generator, out result), "#2"); Assert.IsTrue(rootTree.RenderUrl("T:System.Action`4", generator, out result), "#3"); }
public void PerformSearchIndexCreation() { FireSearchIndexCreationEvent(true); RootTree.MakeSearchIndex(); RootTree.MakeIndex(); IsFresh = true; FireSearchIndexCreationEvent(false); if (md5sums != null) { SerializeDictionary(Path.Combine(baseUserDir, sumFile), md5sums); } }
public static void Main(string[] args) { Console.WriteLine("Let's Render!"); string contentPath = IO.Path.GetDirectoryName(typeof(MainClass).Assembly.Location); RootTree tree = RootTree.LoadTree(contentPath, includeExternal: false); MyRenderer renderer = new MyRenderer(); string renderedOutput = tree.RenderUrl("T:My.Sample.SomeClass", renderer); Console.WriteLine(renderedOutput); }
public void AspNetStyleUrlReachabilityTest () { var rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false); Node result; var generator = new CheckGenerator (); Assert.IsTrue (rootTree.RenderUrl ("T:System.Collections.Generic.Dictionary{TKey,TValue}", generator, out result), "#1"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Action{T1,T2}", generator, out result), "#2"); Assert.IsTrue (rootTree.RenderUrl ("T:System.EventHandler{TEventArgs}", generator, out result), "#3"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Func{T1,T2,T3,TResult}", generator, out result), "#4"); Assert.IsTrue (rootTree.RenderUrl ("T:System.Collections.Generic.Dictionary{TKey,TValue}+ValueCollection", generator, out result), "#5"); Assert.IsTrue (rootTree.RenderUrl ("T:System.IComparable{T}", generator, out result), "#6"); }
//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/"); string monodoc = System.Environment.GetEnvironmentVariable("MONO_MONODOC"); if (monodoc != null) { foreach (string searchPath in monodoc.Split(':')) { sources.Add(searchPath); } } //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(); } } }
public void ReachabilityWithCrefsTest () { var rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false); Node result; var htmlGenerator = new HtmlGenerator (null); var crefs = new HashSet<string> (); var generator = new CheckGenerator (); int errorCount = 0; foreach (var leaf in GetLeaves (rootTree.RootNode)) { Dictionary<string, string> context; string internalId = leaf.Tree.HelpSource.GetInternalIdForUrl (leaf.PublicUrl, out result, out context); if (leaf.Tree.HelpSource.GetDocumentTypeForId (internalId) != DocumentType.EcmaXml) continue; string content = null; if (string.IsNullOrEmpty (content = rootTree.RenderUrl (leaf.PublicUrl, htmlGenerator, out result)) || leaf != result) { Console.WriteLine ("Error: {0} with HelpSource {1} ", leaf.PublicUrl, leaf.Tree.HelpSource.Name); continue; } HtmlDocument doc = new HtmlDocument(); try { doc.LoadHtml (content); } catch { Console.WriteLine ("Couldn't load a HTML document for URL {0}", leaf.PublicUrl); continue; } foreach (HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href]")) { var newUrl = link.Attributes["href"].Value; var hashIndex = newUrl.IndexOf ('#'); if (hashIndex != -1) newUrl = newUrl.Substring (0, hashIndex); if (newUrl.Length > 1 && newUrl[1] == ':' && char.IsLetter (newUrl, 0) && char.ToLowerInvariant (newUrl[0]) != 'c') crefs.Add (newUrl); } foreach (var cref in crefs) { if (!rootTree.RenderUrl (cref, generator, out result) || result == null) { Console.WriteLine ("Error with cref: `{0}'", cref); errorCount++; } } crefs.Clear (); } Assert.AreEqual (0, errorCount, errorCount + " / " + crefs.Count); }
string GenerateMasterRootPage(RootTree rootTree) { if (rootTree == null) { return(string.Empty); } var assembly = System.Reflection.Assembly.GetAssembly(typeof(HtmlGenerator)); var hpStream = assembly.GetManifestResourceStream("home.html"); var home = new StreamReader(hpStream).ReadToEnd(); var links = string.Join(Environment.NewLine, rootTree.RootNode.ChildNodes.Select(n => string.Format("<li><a href=\"{0}\">{1}</a></li>", n.Element, n.Caption))); return(home.Replace("@@API_DOCS@@", links)); }
public override void Run(IEnumerable <string> args) { var validFormats = RootTree.GetSupportedFormats(); string cur_format = ""; var formats = new Dictionary <string, List <string> > (); var options = new OptionSet() { { "f|format=", "The documentation {FORMAT} used in FILES. " + "Valid formats include:\n " + string.Join("\n ", validFormats) + "\n" + "If not specified, no HelpSource is used. This may " + "impact the PublicUrls displayed for nodes.", v => { if (Array.IndexOf(validFormats, v) < 0) { Error("Invalid documentation format: {0}.", v); } cur_format = v; } }, { "<>", v => AddFormat(formats, cur_format, v) }, }; List <string> files = Parse(options, args, "dump-tree", "[OPTIONS]+ FILES", "Print out the nodes within the assembled .tree FILES,\n" + "as produced by 'mdoc assemble'."); if (files == null) { return; } foreach (string format in formats.Keys) { foreach (string file in formats[format]) { HelpSource hs = format == "" ? null : RootTree.GetHelpSource(format, file.Replace(".tree", "")); Tree t = new Tree(hs, file); Node.PrintTree(t); } } }
//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); } //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(); 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(); } } }
public void PublicUrlOnUnattachedHelpSourceRoot() { // Unattached help source have no root:/ URL attributed var hs = new EcmaHelpSource(Path.Combine(BaseDir, "sources", "netdocs"), false); var rootTree = RootTree.LoadTree(Path.GetFullPath(BaseDir), false); hs.RootTree = rootTree; Assert.IsNull(hs.Tree.RootNode.PublicUrl); var nsChildUrl = hs.Tree.RootNode.ChildNodes.First().PublicUrl; Assert.IsNotNull(nsChildUrl); StringAssert.StartsWith("N:", nsChildUrl); // Verify GetNodeTypeParent var typeNode = hs.Tree.RootNode.ChildNodes.First().ChildNodes.First(); var metaNode = typeNode.ChildNodes.First(cn => cn.Element == "M"); StringAssert.StartsWith(typeNode.PublicUrl, metaNode.PublicUrl); }
void GenerateCache(Options opts, string basePath, string format, string outDir) { var hs = RootTree.GetHelpSource(format, basePath); if (hs == null) { Error("Unable to find a HelpSource for provider '{0}' and file '{1}.tree'.", format, basePath); } var tree = hs.Tree; RootTree docRoot = null; if (!opts.UseSystemSources) { docRoot = RootTree.LoadTree(null, null, opts.Sources); } else { docRoot = RootTree.LoadTree(); foreach (var source in opts.Sources) { docRoot.AddSourceFile(source); } } hs.RootTree = docRoot; string helpSourceName = Path.GetFileName(basePath); foreach (Node node in tree.TraverseDepthFirst <Node, Node> (t => t, t => t.Nodes.Cast <Node> ())) { var url = node.URL; Message(TraceLevel.Info, "\tProcessing URL: {0}", url); if (string.IsNullOrEmpty(url)) { continue; } var file = XmlDocUtils.GetCachedFileName(outDir, url); using (var o = File.AppendText(file)) { Node _; string contents = hs.GetText(url, out _) ?? hs.RenderNamespaceLookup(url, out _); o.Write(contents); } } }
public void PerformSearchIndexCreation() { FireSearchIndexCreationEvent(true); try { RootTree.MakeSearchIndex(); } catch (Exception e) { Logger.LogError("Error making search index", e); } try { RootTree.MakeIndex(); } catch (Exception e) { Logger.LogError("Error making normal index", e); } IsFresh = true; FireSearchIndexCreationEvent(false); if (md5sums != null) { SerializeDictionary(Path.Combine(baseUserDir, sumFile), md5sums); } }
public void ReachabilityTest() { var rootTree = RootTree.LoadTree(Path.GetFullPath(BaseDir), false); Node result; var generator = new CheckGenerator(); int errorCount = 0; int testCount = 0; foreach (var leaf in GetLeaves(rootTree.RootNode)) { if (!rootTree.RenderUrl(leaf.PublicUrl, generator, out result) || leaf != result) { Console.WriteLine("Error: " + leaf.PublicUrl); errorCount++; } testCount++; } Assert.AreEqual(0, errorCount, errorCount + " / " + testCount.ToString()); }
/// <summary> /// Gets the input field used in the demo. /// </summary> /// <returns>The input field used in the demo.</returns> public SystemKeyboardInputHelper GetDemoInputField() { return(RootTree.GetComponentInChildren <SystemKeyboardInputHelper>(true)); }
public void Setup () { rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false); }
public void Setup() { rootTree = RootTree.LoadTree(Path.GetFullPath(BaseDir), false); }
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.AddUncompiledSource(dir); } } if (ConfigurationManager.AppSettings == null) { Logger.Log("Setting default settings because ConfigurationManager.AppSettings is null"); var keyValueConfigurationCollection = new KeyValueConfigurationCollection(); keyValueConfigurationCollection.Add("docPath", "/Library/Frameworks/Mono.framework/Versions/Current/lib/monodoc/"); keyValueConfigurationCollection.Add("docExternalPath", ""); typeof(Config).GetField("exeConfig", BindingFlags.NonPublic | BindingFlags.Static).SetValue(null, keyValueConfigurationCollection); Lucene.Net.Support.AppSettings.Set("java.version", ""); Lucene.Net.Support.AppSettings.Set("java.vendor", ""); } Root = RootTree.LoadTree(); 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); }
public void LinkCTSTypes(Class currentClass, CTSType ctsType) { if (ctsType == null || ctsType.Feature != CTSType.FeatureType.Object || ctsType.Value == null || ctsType.Value == "" || ctsType.Value == "void" || ctsType.Value.Contains("<") ) { return; } List <Class> cSet = RootTree.FindClassByName(ctsType.Value); if (cSet.Count == 0 || cSet[0].FilledFromRepository == false) { // if (ctsType.Value.Contains(">")) Debugger.Break(); Console.WriteLine("\t\tCould not find " + ctsType.Value + " in memory"); List <Element> collection; if (ctsType.Value.Contains("::")) { collection = GetElementsByQuery("FindByName", ctsType.Value.Substring(ctsType.Value.LastIndexOf("::") + 2)); } else { collection = GetElementsByQuery("FindByName", ctsType.Value); } if (collection != null) { foreach (var element in collection) { if (!element.IsSpec && // explicitly excluded element.ParentID == 0 && // no nested classes element.IsTempleClass(_repo) && // no parameterised interfaces element.Stereotype != "typedef" && // in this context all typedefs are templates.. so exlcude !element.Name.Contains("<") && element.Name != "engine" && element.Name != "arguments" && element.Name != "results" && element.Name != "Point" ) { Class cclass = RootTree.FindClassByElement(element); if (cclass == null) { cclass = new Class(element, RootTree, this); Package rt = RootTree.GetById(element.PackageId.Value); rt.Classes.Add(cclass.Name, cclass); } cSet.Add(cclass); } } } foreach (Class cclass in cSet) { cclass.FilledFromRepository = true; } } // OK there must be at least one.. lets pick the nearest if (cSet.Count > 0) { Class matchedByFile = null; Class matchedByPackage = null; Class matchedByName = null; Class matchedByParent = null; Class matched; // best from above foreach (Class cclass in cSet) { if (matchedByFile == null && cclass.FileName == currentClass.FileName) { matchedByFile = cclass; } if (matchedByParent == null && cclass.ParentID == currentClass.Id) { matchedByParent = cclass; } if (matchedByPackage == null && cclass.Package == currentClass.Package) { matchedByPackage = cclass; } if (matchedByName == null && cclass.Name == ctsType.Value) { matchedByName = cclass; } } matched = (matchedByFile != null ? matchedByFile : (matchedByParent != null ? matchedByParent : (matchedByPackage != null ? matchedByPackage : matchedByName))); // fill in the matching class reference, and do the same for any similar references in this class. if (matched != null) { ctsType.Class = matched; matched.References.Add(ctsType); foreach (Method method in currentClass.Methods) { if (method.ReturnType != null && method.ReturnType.Value != null && method.ReturnType.Value == ctsType.Value) { method.ReturnType.Class = matched; } foreach (KeyValuePair <int, Parameter> pair in method.Parameters) { if (pair.Value.ParameterType.Value != null && pair.Value.ParameterType.Value == ctsType.Value) { pair.Value.ParameterType.Class = matched; } } } } } }
public void Setup() { rootTree = RootTree.LoadTree(GetBaseDir(), false); }
public void Setup() { root = RootTree.LoadTree(GetBaseDir(), includeExternal: false); generator = new HtmlGenerator(defaultCache: null); }
public void Setup() { rootTree = RootTree.LoadTree(BaseDir, false); }
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 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; }
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.AddUncompiledSource(dir); } } Root = RootTree.LoadTree(); 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); }