コード例 #1
0
ファイル: assembler.cs プロジェクト: raj581/Marvin
        public override void Run(IEnumerable <string> args)
        {
            var    formats       = new Dictionary <string, List <string> > ();
            string prefix        = "tree";
            string cur_format    = "ecma";
            var    formatOptions = CreateFormatOptions(this, formats);
            var    options       = new OptionSet()
            {
                formatOptions [0],
                { "o|out=",
                  "Provides the output file prefix; the files {PREFIX}.zip and " +
                  "{PREFIX}.tree will be created.\n" +
                  "If not specified, `tree' is the default PREFIX.",
                  v => prefix = v },
                formatOptions [1],
            };
            List <string> extra = Parse(options, args, "assemble",
                                        "[OPTIONS]+ DIRECTORIES",
                                        "Assemble documentation within DIRECTORIES for use within the monodoc browser.");

            if (extra == null)
            {
                return;
            }

            List <Provider> list = new List <Provider> ();
            EcmaProvider    ecma = null;
            bool            sort = false;

            foreach (string format in formats.Keys)
            {
                switch (format)
                {
                case "ecma":
                    if (ecma == null)
                    {
                        ecma = new EcmaProvider();
                        list.Add(ecma);
                        sort = true;
                    }
                    foreach (string dir in formats[format])
                    {
                        ecma.AddDirectory(dir);
                    }
                    break;

                case "xhtml":
                case "hb":
                    list.AddRange(formats [format].Select(d => (Provider) new XhtmlProvider(d)));
                    break;

                case "man":
                    list.Add(new ManProvider(formats [format].ToArray()));
                    break;

                case "simple":
                    list.AddRange(formats [format].Select(d => (Provider) new SimpleProvider(d)));
                    break;

                case "error":
                    list.AddRange(formats [format].Select(d => (Provider) new ErrorProvider(d)));
                    break;

                case "ecmaspec":
                    list.AddRange(formats [format].Select(d => (Provider) new EcmaSpecProvider(d)));
                    break;

                case "addins":
                    list.AddRange(formats [format].Select(d => (Provider) new AddinsProvider(d)));
                    break;
                }
            }

            HelpSource hs = new HelpSource(prefix, true);

            hs.TraceLevel = TraceLevel;

            foreach (Provider p in list)
            {
                p.PopulateTree(hs.Tree);
            }

            if (sort && hs.Tree != null)
            {
                hs.Tree.Sort();
            }

            //
            // Flushes the EcmaProvider
            //
            foreach (Provider p in list)
            {
                p.CloseTree(hs, hs.Tree);
            }

            hs.Save();
        }
コード例 #2
0
ファイル: assembler.cs プロジェクト: nobled/mono
	public override void Run (IEnumerable<string> args)
	{
		bool replaceNTypes = false;
		var formats = new Dictionary<string, List<string>> ();
		string prefix = "tree";
		var formatOptions = CreateFormatOptions (this, formats);
		var options = new OptionSet () {
			formatOptions [0],
			{ "o|out=",
				"Provides the output file prefix; the files {PREFIX}.zip and " + 
					"{PREFIX}.tree will be created.\n" +
					"If not specified, `tree' is the default PREFIX.",
				v => prefix = v },
			formatOptions [1],
			{"dropns=","The namespace that has been dropped from this version of the assembly.", v => droppedNamespace = v },
			{"ntypes","Replace references to native types with their original types.", v => replaceNTypes=true },
		};
		List<string> extra = Parse (options, args, "assemble", 
				"[OPTIONS]+ DIRECTORIES",
				"Assemble documentation within DIRECTORIES for use within the monodoc browser.");
		if (extra == null)
			return;

		List<Provider> list = new List<Provider> ();
		EcmaProvider ecma = null;
		bool sort = false;
		
		foreach (string format in formats.Keys) {
			switch (format) {
			case "ecma":
				if (ecma == null) {
					ecma = new EcmaProvider ();
					list.Add (ecma);
					sort = true;
				}
				ecma.FileSource = new MDocFileSource(droppedNamespace, string.IsNullOrWhiteSpace(droppedNamespace) ? ApiStyle.Unified : ApiStyle.Classic) {
					ReplaceNativeTypes = replaceNTypes
				};
				foreach (string dir in formats [format])
					ecma.AddDirectory (dir);
				break;

			case "xhtml":
			case "hb":
				list.AddRange (formats [format].Select (d => (Provider) new XhtmlProvider (d)));
				break;

			case "man":
				list.Add (new ManProvider (formats [format].ToArray ()));
				break;

			case "error":
				list.AddRange (formats [format].Select (d => (Provider) new ErrorProvider (d)));
				break;

			case "ecmaspec":
				list.AddRange (formats [format].Select (d => (Provider) new EcmaSpecProvider (d)));
				break;

			case "addins":
				list.AddRange (formats [format].Select (d => (Provider) new AddinsProvider (d)));
				break;
			}
		}

		HelpSource hs = new HelpSource (prefix, true);
		hs.TraceLevel = TraceLevel;

		foreach (Provider p in list) {
			p.PopulateTree (hs.Tree);
		}

		if (sort && hs.Tree != null)
			hs.Tree.RootNode.Sort ();
			      
		//
		// Flushes the EcmaProvider
		//
		foreach (Provider p in list)
			p.CloseTree (hs, hs.Tree);

		hs.Save ();
	}
コード例 #3
0
ファイル: assembler.cs プロジェクト: mdae/MonoRT
        public override void Run(IEnumerable <string> args)
        {
            string[] validFormats =
            {
                "ecma",
                "ecmaspec",
                "error",
                "hb",
                "man",
                "simple",
                "xhtml"
            };
            var    formats    = new Dictionary <string, List <string> > ();
            string prefix     = "tree";
            string cur_format = "ecma";
            var    options    = new OptionSet()
            {
                { "f|format=",
                  "The documentation {FORMAT} used in DIRECTORIES.  " +
                  "Valid formats include:\n  " +
                  string.Join("\n  ", validFormats) + "\n" +
                  "If not specified, the default format is `ecma'.",
                  v => {
                      if (Array.IndexOf(validFormats, v) < 0)
                      {
                          Error("Invalid documentation format: {0}.", v);
                      }
                      cur_format = v;
                  } },
                { "o|out=",
                  "Provides the output file prefix; the files {PREFIX}.zip and " +
                  "{PREFIX}.tree will be created.\n" +
                  "If not specified, `tree' is the default PREFIX.",
                  v => prefix = v },
                { "<>", v => AddFormat(formats, cur_format, v) },
            };
            List <string> extra = Parse(options, args, "assemble",
                                        "[OPTIONS]+ DIRECTORIES",
                                        "Assemble documentation within DIRECTORIES for use within the monodoc browser.");

            if (extra == null)
            {
                return;
            }

            List <Provider> list = new List <Provider> ();
            EcmaProvider    ecma = null;
            bool            sort = false;

            foreach (string format in formats.Keys)
            {
                switch (format)
                {
                case "ecma":
                    if (ecma == null)
                    {
                        ecma = new EcmaProvider();
                        list.Add(ecma);
                        sort = true;
                    }
                    foreach (string dir in formats[format])
                    {
                        ecma.AddDirectory(dir);
                    }
                    break;

                case "xhtml":
                case "hb":
                    list.AddRange(formats [format].Select(d => (Provider) new XhtmlProvider(d)));
                    break;

                case "man":
                    list.Add(new ManProvider(formats [format].ToArray()));
                    break;

                case "simple":
                    list.AddRange(formats [format].Select(d => (Provider) new SimpleProvider(d)));
                    break;

                case "error":
                    list.AddRange(formats [format].Select(d => (Provider) new ErrorProvider(d)));
                    break;

                case "ecmaspec":
                    list.AddRange(formats [format].Select(d => (Provider) new EcmaSpecProvider(d)));
                    break;

                case "addins":
                    list.AddRange(formats [format].Select(d => (Provider) new AddinsProvider(d)));
                    break;
                }
            }

            HelpSource hs = new HelpSource(prefix, true);

            hs.TraceLevel = TraceLevel;

            foreach (Provider p in list)
            {
                p.PopulateTree(hs.Tree);
            }

            if (sort && hs.Tree != null)
            {
                hs.Tree.Sort();
            }

            //
            // Flushes the EcmaProvider
            //
            foreach (Provider p in list)
            {
                p.CloseTree(hs, hs.Tree);
            }

            hs.Save();
        }
コード例 #4
0
ファイル: assembler.cs プロジェクト: v-zazhou/api-doc-tools
        public override void Run(IEnumerable <string> args)
        {
            bool   replaceNTypes = false;
            var    formats       = new Dictionary <string, List <string> > ();
            string prefix        = "tree";
            var    formatOptions = CreateFormatOptions(this, formats);
            var    options       = new OptionSet()
            {
                formatOptions [0],
                { "o|out=",
                  "Provides the output file prefix; the files {PREFIX}.zip and " +
                  "{PREFIX}.tree will be created.\n" +
                  "If not specified, `tree' is the default PREFIX.",
                  v => prefix = v },
                formatOptions [1],
                { "dropns=", "The namespace that has been dropped from this version of the assembly.", v => droppedNamespace = v },
                { "ntypes", "Replace references to native types with their original types.", v => replaceNTypes = true },
                { "fx|framework=",
                  "The name of the framework, which should be used to filter out any other API",
                  v => frameworkName = v },
            };
            List <string> extra = Parse(options, args, "assemble",
                                        "[OPTIONS]+ DIRECTORIES",
                                        "Assemble documentation within DIRECTORIES for use within the monodoc browser.");

            if (extra == null)
            {
                return;
            }

            List <Provider> list = new List <Provider> ();
            EcmaProvider    ecma = null;
            bool            sort = false;

            foreach (string format in formats.Keys)
            {
                switch (format)
                {
                case "ecma":
                    if (ecma == null)
                    {
                        ecma = new EcmaProvider();
                        list.Add(ecma);
                        sort = true;
                    }
                    ecma.FileSource = new MDocFileSource(droppedNamespace, string.IsNullOrWhiteSpace(droppedNamespace) ? ApiStyle.Unified : ApiStyle.Classic, frameworkName)
                    {
                        ReplaceNativeTypes = replaceNTypes
                    };
                    foreach (string dir in formats[format])
                    {
                        ecma.AddDirectory(dir);
                    }
                    break;

                case "xhtml":
                case "hb":
                    list.AddRange(formats [format].Select(d => (Provider) new XhtmlProvider(d)));
                    break;

                case "man":
                    list.Add(new ManProvider(formats [format].ToArray()));
                    break;

                case "error":
                    list.AddRange(formats [format].Select(d => (Provider) new ErrorProvider(d)));
                    break;

                case "ecmaspec":
                    list.AddRange(formats [format].Select(d => (Provider) new EcmaSpecProvider(d)));
                    break;

                case "addins":
                    list.AddRange(formats [format].Select(d => (Provider) new AddinsProvider(d)));
                    break;
                }
            }

            HelpSource hs = new HelpSource(prefix, true);

            hs.TraceLevel = TraceLevel;

            foreach (Provider p in list)
            {
                p.PopulateTree(hs.Tree);
            }

            if (sort && hs.Tree != null)
            {
                hs.Tree.RootNode.Sort();
            }

            //
            // Flushes the EcmaProvider
            //
            foreach (Provider p in list)
            {
                p.CloseTree(hs, hs.Tree);
            }

            hs.Save();
        }
コード例 #5
0
ファイル: assembler.cs プロジェクト: retahc/old-code
        public static int Main(string [] args)
        {
            string       output = "tree";
            HelpSource   hs;
            ArrayList    list = new ArrayList();
            EcmaProvider ecma = null;
            bool         sort = false;

            int argc = args.Length;

            for (int i = 0; i < argc; i++)
            {
                string arg = args [i];

                switch (arg)
                {
                case "-o":
                case "--out":
                    if (i < argc)
                    {
                        output = args [++i];
                    }
                    else
                    {
                        Usage();
                        return(1);
                    }
                    break;

                case "--ecma":
                    if (i < argc)
                    {
                        if (ecma == null)
                        {
                            ecma = new EcmaProvider();
                            list.Add(ecma);
                            sort = true;
                        }
                        ecma.AddDirectory(args [++i]);
                    }
                    else
                    {
                        Usage();
                        return(1);
                    }
                    break;

                case "--xhtml":
                case "--hb":
                    if (i < argc)
                    {
                        Provider populator = new XhtmlProvider(args [++i]);

                        list.Add(populator);
                    }
                    else
                    {
                        Usage();
                        return(1);
                    }
                    break;

                case "--man":
                    if (i < argc)
                    {
                        int      countfiles = args.Length - ++i;
                        string[] xmlfiles   = new String[countfiles];
                        for (int a = 0; a < countfiles; a++)
                        {
                            xmlfiles[a] = args [i];
                            i++;
                        }
                        Provider populator = new ManProvider(xmlfiles);

                        list.Add(populator);
                    }
                    else
                    {
                        Usage();
                        return(1);
                    }
                    break;

                case "--simple":
                    if (i < argc)
                    {
                        Provider populator = new SimpleProvider(args [++i]);

                        list.Add(populator);
                    }
                    else
                    {
                        Usage();
                        return(1);
                    }
                    break;

                case "--error":
                    if (i < argc)
                    {
                        Provider populator = new ErrorProvider(args [++i]);

                        list.Add(populator);
                    }
                    else
                    {
                        Usage();
                        return(1);
                    }
                    break;

                case "--ecmaspec":
                    if (i < argc)
                    {
                        Provider populator = new EcmaSpecProvider(args [++i]);

                        list.Add(populator);
                    }
                    else
                    {
                        Usage();
                        return(1);
                    }
                    break;

                case "--addins":
                    if (i < argc)
                    {
                        Provider populator = new AddinsProvider(args [++i]);
                        list.Add(populator);
                    }
                    else
                    {
                        Usage();
                        return(1);
                    }
                    break;

                default:
                    Usage();
                    return(1);
                }
            }

            hs = new HelpSource(output, true);

            foreach (Provider p in list)
            {
                p.PopulateTree(hs.Tree);
            }

            if (sort)
            {
                hs.Tree.Sort();
            }

            //
            // Flushes the EcmaProvider
            //
            foreach (Provider p in list)
            {
                p.CloseTree(hs, hs.Tree);
            }

            hs.Save();
            return(0);
        }
コード例 #6
0
ファイル: assembler.cs プロジェクト: frje/SharpLang
	public override void Run (IEnumerable<string> args)
	{
		var formats = new Dictionary<string, List<string>> ();
		string prefix = "tree";
		var formatOptions = CreateFormatOptions (this, formats);
		var options = new OptionSet () {
			formatOptions [0],
			{ "o|out=",
				"Provides the output file prefix; the files {PREFIX}.zip and " + 
					"{PREFIX}.tree will be created.\n" +
					"If not specified, `tree' is the default PREFIX.",
				v => prefix = v },
			formatOptions [1],
		};
		List<string> extra = Parse (options, args, "assemble", 
				"[OPTIONS]+ DIRECTORIES",
				"Assemble documentation within DIRECTORIES for use within the monodoc browser.");
		if (extra == null)
			return;

		List<Provider> list = new List<Provider> ();
		EcmaProvider ecma = null;
		bool sort = false;
		
		foreach (string format in formats.Keys) {
			switch (format) {
			case "ecma":
				if (ecma == null) {
					ecma = new EcmaProvider ();
					list.Add (ecma);
					sort = true;
				}
				foreach (string dir in formats [format])
					ecma.AddDirectory (dir);
				break;

			case "xhtml":
			case "hb":
				list.AddRange (formats [format].Select (d => (Provider) new XhtmlProvider (d)));
				break;

			case "man":
				list.Add (new ManProvider (formats [format].ToArray ()));
				break;

			case "error":
				list.AddRange (formats [format].Select (d => (Provider) new ErrorProvider (d)));
				break;

			case "ecmaspec":
				list.AddRange (formats [format].Select (d => (Provider) new EcmaSpecProvider (d)));
				break;

			case "addins":
				list.AddRange (formats [format].Select (d => (Provider) new AddinsProvider (d)));
				break;
			}
		}

		HelpSource hs = new HelpSource (prefix, true);
		hs.TraceLevel = TraceLevel;

		foreach (Provider p in list) {
			p.PopulateTree (hs.Tree);
		}

		if (sort && hs.Tree != null)
			hs.Tree.RootNode.Sort ();
			      
		//
		// Flushes the EcmaProvider
		//
		foreach (Provider p in list)
			p.CloseTree (hs, hs.Tree);

		hs.Save ();
	}