<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Reflection;
using System.Text;
using System.Xml.Linq;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using System.Runtime.Serialization;
using System.IO;

namespace SharePointPnP.PowerShell.CmdletHelpGenerator
{
    class Program
    {
        static void Main(string[] args)
        {
            var cmdlets = new List<CmdletInfo>();
            var inFile = args[0];

            var outFile = args[1];
            var toc = new List<CmdletInfo>();

            // Specify an additional (third) parameter pointing to the Solution folder to generate Markdown. The markdown 
            // will be created in the Documentation folder underneath the solution folder.
            bool generateMarkdown = false;
            string solutionDir = null;
            string spVersion = "Online";
            if (args.Length > 2)
            {
                var configuration = args[2];
                solutionDir = args[3];
                generateMarkdown = true;
                switch (configuration.ToLowerInvariant())
                {
                    case "debug":
                    case "release":
                        {
                            spVersion = "Online";
                            break;
                        }
                    case "debug15":
                    case "release15":
                        {
                            spVersion = "2013";
                            break;

                        }
                    case "debug16":
                    case "release16":
                        {
                            spVersion = "2016";
                            break;
                        }
                }
            }
            var doc = new XDocument(new XDeclaration("1.0", "UTF-8", string.Empty));

            XNamespace ns = "http://msh";
            var helpItems = new XElement(ns + "helpItems", new XAttribute("schema", "maml"));
            doc.Add(helpItems);


            XNamespace maml = "http://schemas.microsoft.com/maml/2004/10";
            XNamespace command = "http://schemas.microsoft.com/maml/dev/command/2004/10";
            XNamespace dev = "http://schemas.microsoft.com/maml/dev/2004/10";

            var mamlNsAttr = new XAttribute(XNamespace.Xmlns + "maml", "http://schemas.microsoft.com/maml/2004/10");
            var commandNsAttr = new XAttribute(XNamespace.Xmlns + "command", "http://schemas.microsoft.com/maml/dev/command/2004/10");
            var devNsAttr = new XAttribute(XNamespace.Xmlns + "dev", "http://schemas.microsoft.com/maml/dev/2004/10");

            var assembly = Assembly.LoadFrom(inFile);
            var types = assembly.GetTypes();
            //        System.Diagnostics.Debugger.Launch();

            var cmdletsToExport = new List<string>();
            var aliasesToCreate = new List<KeyValuePair<string, string>>();

            foreach (var t in types)
            {
                Console.WriteLine(t.BaseType.Name);
                if (t.BaseType.Name == "SPOCmdlet" || t.BaseType.Name == "PSCmdlet" || t.BaseType.Name == "SPOWebCmdlet" || t.BaseType.Name == "SPOAdminCmdlet" || t.BaseType.Name == "PnPGraphCmdlet" ||t.BaseType.Name == "PnPWebRetrievalCmdlet`1")
                {

                    var verb = string.Empty;
                    var noun = string.Empty;
                    var description = string.Empty;
                    var detaileddescription = string.Empty;
                    var copyright = string.Empty;
                    var version = string.Empty;
                    var category = string.Empty;
                    var attrs = t.GetCustomAttributes();
                    var examples = new List<CmdletExampleAttribute>();
                    var relatedLinks = new List<CmdletRelatedLinkAttribute>();
                    Type outputType = null;
                    var outputTypeLink = string.Empty;
                    var outputTypeDescription = string.Empty;
                    var aliases = new List<string>();
                    var additionalParameters = new List<CmdletAdditionalParameter>();
                    // Get info from attributes<commit_msg>Removed debug output<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Reflection;
using System.Text;
using System.Xml.Linq;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using System.Runtime.Serialization;
using System.IO;

namespace SharePointPnP.PowerShell.CmdletHelpGenerator
{
    class Program
    {
        static void Main(string[] args)
        {
            var cmdlets = new List<CmdletInfo>();
            var inFile = args[0];

            var outFile = args[1];
            var toc = new List<CmdletInfo>();

            // Specify an additional (third) parameter pointing to the Solution folder to generate Markdown. The markdown 
            // will be created in the Documentation folder underneath the solution folder.
            bool generateMarkdown = false;
            string solutionDir = null;
            string spVersion = "Online";
            if (args.Length > 2)
            {
                var configuration = args[2];
                solutionDir = args[3];
                generateMarkdown = true;
                switch (configuration.ToLowerInvariant())
                {
                    case "debug":
                    case "release":
                        {
                            spVersion = "Online";
                            break;
                        }
                    case "debug15":
                    case "release15":
                        {
                            spVersion = "2013";
                            break;

                        }
                    case "debug16":
                    case "release16":
                        {
                            spVersion = "2016";
                            break;
                        }
                }
            }
            var doc = new XDocument(new XDeclaration("1.0", "UTF-8", string.Empty));

            XNamespace ns = "http://msh";
            var helpItems = new XElement(ns + "helpItems", new XAttribute("schema", "maml"));
            doc.Add(helpItems);


            XNamespace maml = "http://schemas.microsoft.com/maml/2004/10";
            XNamespace command = "http://schemas.microsoft.com/maml/dev/command/2004/10";
            XNamespace dev = "http://schemas.microsoft.com/maml/dev/2004/10";

            var mamlNsAttr = new XAttribute(XNamespace.Xmlns + "maml", "http://schemas.microsoft.com/maml/2004/10");
            var commandNsAttr = new XAttribute(XNamespace.Xmlns + "command", "http://schemas.microsoft.com/maml/dev/command/2004/10");
            var devNsAttr = new XAttribute(XNamespace.Xmlns + "dev", "http://schemas.microsoft.com/maml/dev/2004/10");

            var assembly = Assembly.LoadFrom(inFile);
            var types = assembly.GetTypes();
            //        System.Diagnostics.Debugger.Launch();

            var cmdletsToExport = new List<string>();
            var aliasesToCreate = new List<KeyValuePair<string, string>>();

            foreach (var t in types)
            {
                if (t.BaseType.Name == "SPOCmdlet" || t.BaseType.Name == "PSCmdlet" || t.BaseType.Name == "SPOWebCmdlet" || t.BaseType.Name == "SPOAdminCmdlet" || t.BaseType.Name == "PnPGraphCmdlet" ||t.BaseType.Name == "PnPWebRetrievalCmdlet`1")
                {

                    var verb = string.Empty;
                    var noun = string.Empty;
                    var description = string.Empty;
                    var detaileddescription = string.Empty;
                    var copyright = string.Empty;
                    var version = string.Empty;
                    var category = string.Empty;
                    var attrs = t.GetCustomAttributes();
                    var examples = new List<CmdletExampleAttribute>();
                    var relatedLinks = new List<CmdletRelatedLinkAttribute>();
                    Type outputType = null;
                    var outputTypeLink = string.Empty;
                    var outputTypeDescription = string.Empty;
                    var aliases = new List<string>();
                    var additionalParameters = new List<CmdletAdditionalParameter>();
                    // Get info from attributes
{'fraction_non_alphanumeric': 0.0995421997887076, 'fraction_numerical': 0.014320929686582932, 'mean_word_length': 1.4875912408759124, 'pattern_counts': {'":': 12, '<': 21, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3491796', 'n_tokens_mistral': 2222, 'n_tokens_neox': 2030, 'n_words': 488}