Ejemplo n.º 1
0
        /// <summary>
        /// This is the main deal method in this sample.
        /// It invoke methods to read and write journal data and create a wall using these data
        /// </summary>
        public void CreateDocumentation(Document document, DocumentationSetting setting)
        {
            var manager = new DocumentationManager();

            if (CanReadData)
            {
                setting.SetSettings(commandData.JournalData);
                setting = ReadJournalData(setting);
                if (setting.DocumentFormat == DocumentFormat.Json)
                {
                    manager.CreateJsonFamilyDoc(document, setting);
                }
                else if (setting.DocumentFormat == DocumentFormat.Web)
                {
                    manager.CreateWebFamilyDoc(document, setting);
                }

                if (setting.DocumentFormat != DocumentFormat.None)
                {
                    JournalHelper.KillCurrentProcess();
                }
            }
            else
            {
                if (setting.DocumentFormat == DocumentFormat.Json)
                {
                    manager.CreateJsonFamilyDoc(document, setting);
                }
                WriteJournalData(setting);
            }
        }
Ejemplo n.º 2
0
        private IList <MemberInfo> TestDocumentationForType(object obj, MemberInfo expected)
        {
            var manager = new DocumentationManager();

            var documentation = manager.GenerateForTypes(obj.GetType());


            Assert.AreEqual(JsonConvert.SerializeObject(expected, Formatting.Indented), JsonConvert.SerializeObject(documentation[0], Formatting.Indented));

            return(documentation);
        }
Ejemplo n.º 3
0
        private static void OutputTheme(Options options)
        {
            StageStopwatch.Restart();
            Report.NewStatus("Outputting theme files... ");
            var themeParts     = DocumentationManager.RequiredThemeParts(options.SourceFilePaths.Select(Path.GetExtension));
            var themeOutputter = new AssetOutputter(themeParts);

            themeOutputter.Output(options.OverwriteExisting, options.OutputDirectory, options.ProjectFilePath, options.ThemeName, options.CopyPaths, options.CopyAndParsePaths);

            SaveTiming("theme-output", StageStopwatch.ElapsedMilliseconds);
            Report.ContinueStatus("Done");
        }
Ejemplo n.º 4
0
        public void SingleDefinition(string[] parts, string[] extensions)
        {
            DocumentationManager.RegisterDocumentationDefinition("test", ".f90", new TestDocDef());
            var actualParts = DocumentationManager.RequiredThemeParts(extensions).ToArray();

            DocumentationManager.Reset();
            var errorString = $"Expected: {parts.DelimiteredConcat(", ", " and ")}\nFound:    {actualParts.DelimiteredConcat(", ", " and ")}";

            Assert.AreEqual(parts.Length, actualParts.Length, errorString);
            foreach (var actual in actualParts)
            {
                Assert.IsTrue(parts.Contains(actual), errorString);
            }
        }
Ejemplo n.º 5
0
        private static XmlReader CreateSourceXml(Project project, Options options)
        {
            var xElements =
                from source in project.Sources
                let highlighter = DocumentationManager.TryGetDefinitionByIdentifier(source.Language)
                                  select new XElement(
                    "File",
                    new XElement("Identifier", source.Identifier),
                    highlighter.HighlightLines(source.OriginalLines));
            var reader = new XDocument(new XElement("Source", xElements)).CreateReader();

            if (options.SaveXmls)
            {
                new XDocument(new XElement("Source", xElements)).Save(EnvVar.XmlOutputPath(options.OutputDirectory, "source.xml"));
            }

            return(reader);
        }
Ejemplo n.º 6
0
        public XElement XEle(XElement xmlPassthrough)
        {
            var xEle = new XElement("Project");

            xEle.Add(xmlPassthrough);
            xEle.Add(new XElement("DocCreated", DateTime.Now.ToXElement()));
            xEle.Add(
                from info in this.SubObjects.OfType <Description>()
                select new XElement("Description", info.Basic, info.Detailed));

            var sourceXEle = new XElement(this.SourcesXmlHead);

            foreach (var source in this.Sources)
            {
                var generator = DocumentationManager.TryGetDefinitionByIdentifier(source.Language);
                sourceXEle.Add(generator.ParsedSourcesToXml(source));
            }

            xEle.Add(sourceXEle);
            return(xEle);
        }
        public void GenerateDocumentation()
        {
            using (var documentation = new DocumentationManager(_backendContext))
            {
                ButtonText = "Generating...";
                NotifyOfPropertyChange(() => ButtonText);

                Task.Run(() =>
                {
                    documentation.Generate(TemplatePath, DocumentOutputPath, DrawingOutputPath);

                    Execute.OnUIThread(() =>
                    {
                        MessageBox.Show("The documentation has been successfully generated.", "Documentation completed", MessageBoxButton.OK);

                        if (OnFinished != null)
                        {
                            OnFinished(this, new EventArgs());
                        }
                    });
                });
            }
        }
Ejemplo n.º 8
0
        private void OpenDocumentationAction()
        {
            switch (SelectedApplication.Name)
            {
            case ApplicationViewManager.Name.NetworkInterface:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_NetworkInterface);
                break;

            case ApplicationViewManager.Name.IPScanner:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_IPScanner);
                break;

            case ApplicationViewManager.Name.PortScanner:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_PortScanner);
                break;

            case ApplicationViewManager.Name.Ping:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_Ping);
                break;

            case ApplicationViewManager.Name.Traceroute:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_Traceroute);
                break;

            case ApplicationViewManager.Name.DNSLookup:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_DNSLookup);
                break;

            case ApplicationViewManager.Name.RemoteDesktop:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_RemoteDesktop);
                break;

            case ApplicationViewManager.Name.PuTTY:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_PuTTY);
                break;

            case ApplicationViewManager.Name.SNMP:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_SNMP);
                break;

            case ApplicationViewManager.Name.WakeOnLAN:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_WakeOnLAN);
                break;

            case ApplicationViewManager.Name.HTTPHeaders:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_HTTPHeaders);
                break;

            case ApplicationViewManager.Name.SubnetCalculator:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_SubnetCalculator);
                break;

            case ApplicationViewManager.Name.Lookup:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_Lookup);
                break;

            case ApplicationViewManager.Name.Connections:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_Connections);
                break;

            case ApplicationViewManager.Name.Listeners:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_Listeners);
                break;

            case ApplicationViewManager.Name.ARPTable:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Application_ARPTable);
                break;

            default:
                DocumentationManager.OpenDocumentation(DocumentationManager.DocumentationIdentifier.Default);
                break;
            }
        }
Ejemplo n.º 9
0
        public void Test()
        {
            var manager = new DocumentationManager();

            var documentation = manager.GenerateForTypes(typeof(Settings));

            var implementations = new List <MemberInfo>()
            {
                new MemberInfo()
                {
                    Type       = "Class1",
                    Name       = "Class1",
                    MemberType = MemberType.Class,
                    Children   = new List <MemberInfo>()
                    {
                        new MemberInfo()
                        {
                            Type = "bool",
                            Name = "CommonField"
                        },
                        new MemberInfo()
                        {
                            Type = "string",
                            Name = "Field1"
                        },
                    }
                },
                new MemberInfo()
                {
                    Type       = "Class2",
                    Name       = "Class2",
                    MemberType = MemberType.Class,
                    Children   = new List <MemberInfo>()
                    {
                        new MemberInfo()
                        {
                            Type = "bool",
                            Name = "CommonField"
                        },
                        new MemberInfo()
                        {
                            Type = "string",
                            Name = "Field2"
                        },
                    }
                },
            };

            var expected = new MemberInfo()
            {
                Type       = nameof(Settings),
                Name       = nameof(Settings),
                MemberType = MemberType.Class,
                Children   = new List <MemberInfo>()
                {
                    new MemberInfo()
                    {
                        Name            = "Interface",
                        Type            = "IInterface",
                        MemberType      = MemberType.Class,
                        Implementations = implementations,
                        Children        = new List <MemberInfo>()
                        {
                            new MemberInfo()
                            {
                                Type = "bool",
                                Name = "CommonField"
                            }
                        }
                    },
                    new MemberInfo()
                    {
                        Name       = "Interfaces",
                        Type       = "IInterface[]",
                        MemberType = MemberType.Array,
                        Children   = new List <MemberInfo>()
                        {
                            new MemberInfo()
                            {
                                Name            = "Item",
                                Type            = "IInterface",
                                MemberType      = MemberType.Class,
                                Implementations = implementations,
                                Children        = new List <MemberInfo>()
                                {
                                    new MemberInfo()
                                    {
                                        Type = "bool",
                                        Name = "CommonField"
                                    }
                                }
                            }
                        }
                    }
                }
            };

            Assert.AreEqual(JsonConvert.SerializeObject(expected, Formatting.Indented), JsonConvert.SerializeObject(documentation[0], Formatting.Indented));
        }
 private void OpenDocumentationAction(object id)
 {
     Process.Start(DocumentationManager.GetLocalizedURLbyID(int.Parse((string)id)));
 }