public void Text_Plottables_HaveSummaries()
 {
     foreach (Type plottableType in ScottPlot.Cookbook.Locate.GetPlottableTypes())
     {
         var t = new DocumentedClass(plottableType, LoadedXmlDocument);
         Assert.IsNotNull(t.Summary);
     }
 }
示例#2
0
        protected string OneLineInfo(DocumentedClass docClass, string baseUrl)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append($"<a href='{baseUrl}'><strong>{docClass.Name}</strong></a>");
            if (!string.IsNullOrWhiteSpace(docClass.Summary))
            {
                sb.Append(" - " + docClass.Summary);
            }
            return(sb.ToString());
        }
示例#3
0
        public PlottableApiPage(Type plottableType)
        {
            Title       = $"{plottableType.Name} - ScottPlot {Plot.Version} API";
            Description = $"API documentation for ScottPlot {Plot.Version}";

            var xmlDoc   = GetXmlDoc();
            var classDoc = new DocumentedClass(plottableType, xmlDoc);

            Add($"<div class='display-5 mt-3'>" +
                $"<a href='../../../' style='color: black;'>ScottPlot {Plot.Version} Cookbook</a>" +
                $"</div>" +
                $"<div class='fs-1 fw-light mb-4'>" +
                $"<a href='./' style='color: black;'>{plottableType.Name}</a>" +
                "</div>");

            AddVersionWarning("API documentation page");

            AddHeading($"Plot Type: {classDoc.Name}", 1);
            Add($"**Summary:** {classDoc.Summary}");
            Add($"**Full name:** `{classDoc.FullName}`");

            Add($"**{plottableType.Name} Public API:**");
            Add("![](TOC)");

            AddHeading("Fields", 2);
            foreach (var field in plottableType.GetFields().Select(x => new DocumentedField(x, xmlDoc)))
            {
                AddDetailedInfo(field);
            }

            AddHeading("Properties", 2);
            foreach (var property in plottableType.GetProperties().Select(x => new DocumentedProperty(x, xmlDoc)))
            {
                AddDetailedInfo(property);
            }

            AddHeading("Methods", 2);
            foreach (var method in plottableType.GetMethods()
                     .Where(x => !x.Name.StartsWith("get_"))
                     .Where(x => !x.Name.StartsWith("set_"))
                     .Where(x => !x.Name.StartsWith("add_"))
                     .Where(x => !x.Name.StartsWith("remove_"))
                     .Where(x => x.IsPublic)
                     .Where(x => x.DeclaringType.FullName != null)
                     .Where(x => x.Name != "GetType")
                     .Where(x => x.Name != "ToString")
                     .Where(x => x.Name != "Equals")
                     .Where(x => x.Name != "GetHashCode")
                     .Select(x => new DocumentedMethod(x, xmlDoc)))
            {
                AddDetailedInfo(method);
            }
        }
示例#4
0
        private void AddPlotApiSummary()
        {
            string    xmlPath = "../../../../../src/ScottPlot/ScottPlot.xml";
            XDocument xmlDoc  = XDocument.Load(xmlPath);

            AddHeading("The Plot Module", 1);
            Add("The Plot module is the primary way to interct with ScottPlot. " +
                "It has helper methods to make it easy to create and add Plottable objects. " +
                "Use the Render() method to render the plot as an image.");

            //AddHeading("Fields", 3);
            //foreach (var field in Locate.GetPlotFields().Select(x => new DocumentedField(x, xmlDoc)))
            //Add(OneLineInfo(field, "plot/"));

            AddHeading("Properties", 2);
            foreach (var property in Locate.GetPlotProperties().Select(x => new DocumentedProperty(x, xmlDoc)))
            {
                Add(OneLineInfo(property, "api/plot/"));
            }

            AddHeading("Methods", 2);
            foreach (var method in Locate.GetPlotMethodsNoAdd().Select(x => new DocumentedMethod(x, xmlDoc)))
            {
                Add(OneLineInfo(method, "api/plot/"));
            }

            AddHeading("Methods for Creating Plottables", 2);
            foreach (var method in Locate.GetPlotMethodsOnlyAdd().Select(x => new DocumentedMethod(x, xmlDoc)))
            {
                Add(OneLineInfo(method, "api/plot/"));
            }

            AddHeading("Plottable Types", 1);
            foreach (Type plottableType in Locate.GetPlottableTypes())
            {
                var classInfo = new DocumentedClass(plottableType, xmlDoc);
                Add(OneLineInfo(classInfo, $"api/plottable/{Sanitize(plottableType.Name)}/"));
            }
        }
示例#5
0
        public static void Main(string[] args)
        {
            string myassembly = Assembly.GetExecutingAssembly().Location;

            monoroot    = new FileInfo(myassembly).Directory.Parent.Parent.Parent.Parent.FullName;
            monolibmono = monoroot + "/../Mono/builds/monodistribution/lib/mono/";

            string originalprofiledirectory = UnityProfilesUtils.DirectoryNameFromProfile(UnityProfiles.None);
            Dictionary <UnityProfiles, UnityProfilesDocumentation> docs = new Dictionary <UnityProfiles, UnityProfilesDocumentation> ();
            UnityProfilesDocumentation mergedDoc = new UnityProfilesDocumentation();

            Dictionary <string, MasterAssembly> masterInfos = new Dictionary <string, MasterAssembly> ();

            foreach (var file in Directory.GetFiles(monolibmono + originalprofiledirectory, "*.dll"))
            {
                if (!file.Contains("mscorlib") && !file.Contains("System."))
                {
                    continue;
                }
                // FIXME: for some reason, mono-api-info.exe fails on these assemblies (Cecil failure).
                if (file.Contains("System.Web.DynamicData.dll"))
                {
                    continue;
                }
                if (file.Contains("System.Web.Extensions.dll"))
                {
                    continue;
                }
                if (file.Contains("System.Web.Routing.dll"))
                {
                    continue;
                }
                if (file.Contains("System.Web.dll"))
                {
                    continue;
                }

                string assemblyname = Path.GetFileName(file);
                Console.WriteLine("Reading reference assembly {0}", assemblyname);

                string         originalxml = GenerateAPIInfo(file);
                MasterAssembly reference   = new MasterAssembly(originalxml);
                masterInfos [assemblyname] = reference;
            }

            foreach (UnityProfiles profile in UnityProfilesUtils.ListProfiles())
            {
                var newprofiledirectory = profile.DirectoryNameFromProfile();

                Console.WriteLine(" *** Working on profile {0} (directory {1})", profile, newprofiledirectory);

                foreach (var file in Directory.GetFiles(monolibmono + newprofiledirectory, "*.dll"))
                {
                    if (!file.Contains("mscorlib") && !file.Contains("System."))
                    {
                        continue;
                    }
                    // FIXME: for some reason, mono-api-info.exe fails on these assemblies (Cecil failure).
                    if (file.Contains("System.Web.DynamicData.dll"))
                    {
                        continue;
                    }
                    if (file.Contains("System.Web.Extensions.dll"))
                    {
                        continue;
                    }
                    if (file.Contains("System.Web.Routing.dll"))
                    {
                        continue;
                    }
                    if (file.Contains("System.Web.dll"))
                    {
                        continue;
                    }

                    string assemblyname = Path.GetFileName(file);
                    Console.WriteLine("Working on assembly {0}", assemblyname);

                    if (!masterInfos.ContainsKey(assemblyname))
                    {
                        Console.WriteLine("Assembly {0} from profile {1} not found in main master infos, skipping", assemblyname, profile);
                        continue;
                    }

                    Console.WriteLine("Reading assembly {0} in profile {1}", assemblyname, profile);
                    string newxml = GenerateAPIInfo(file);
                    GuiCompare.MasterAssembly target = new MasterAssembly(newxml);

                    GuiCompare.MasterAssembly  reference = masterInfos [assemblyname];
                    UnityProfilesDocumentation currentProfileDocumentation = new UnityProfilesDocumentation();
                    docs [profile] = currentProfileDocumentation;

                    CompareContext comparer = new CompareContext(() => reference, () => target, profile, currentProfileDocumentation);
                    //CompareContext comparer = new CompareContext(() => reference,() => target, profile, doc);

                    bool finished = false;
                    comparer.Finished        += (a, b) => finished = true;
                    comparer.ProgressChanged += (a, b) => Console.WriteLine(b.ToString());
                    comparer.Compare();
                    while (!finished)
                    {
                        Console.WriteLine("Waiting for comparison to finish...");
                        Thread.Sleep(2000);
                    }

                    // Handle errors here...
                }
            }

            // Merge profiles
            foreach (UnityProfiles profile in UnityProfilesUtils.ListProfiles())
            {
                Console.WriteLine(" *** Merging profile {0}", profile);
                UnityProfilesDocumentation currentDoc = docs [profile];
                foreach (DocumentedNamespace ns in currentDoc.Namespaces)
                {
                    DocumentedNamespace referenceNs = mergedDoc.AddReferenceNamespace(ns.Name);
                    foreach (DocumentedClass c in ns.Classes)
                    {
                        DocumentedClass referenceClass = referenceNs.AddReferenceClass(c.Name);
                        referenceClass.AddSupportedProfile(profile);
                        foreach (DocumentedMember member in c.Members)
                        {
                            DocumentedMember referenceMember;
                            if (member is DocumentedField)
                            {
                                referenceMember = referenceClass.AddReferenceField(member.Name);
                            }
                            else if (member is DocumentedProperty)
                            {
                                referenceMember = referenceClass.AddReferenceProperty(member.Name);
                            }
                            else if (member is DocumentedMethod)
                            {
                                referenceMember = referenceClass.AddReferenceMethod(member.Name);
                            }
                            else
                            {
                                referenceMember = null;
                            }
                            referenceMember.AddSupportedProfile(profile);
                        }
                    }
                }
            }

            // Generate report here...
            Console.WriteLine(" *** Dumping merged docs");
            //mergedDoc.DebugDump ();
        }