Beispiel #1
0
        //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();
                }
            }
        }
        //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();
                }
            }
        }
Beispiel #3
0
        //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();
                }
            }
        }
Beispiel #4
0
        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 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;
        }
Beispiel #6
0
        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);
        }