예제 #1
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("*********************** Object Model Generator ***********************");

            var arg = ArgumentParser.Parse(args);
            List <ICodeGenerator> generators = new List <ICodeGenerator>();

            if (arg.ContainsKey("format"))
            {
                var formats = arg["format"].Split(';', StringSplitOptions.RemoveEmptyEntries);
                foreach (var format in formats)
                {
                    if (format == "md")
                    {
                        generators.Add(new Generators.MarkdownGenerator());
                    }
                    else if (format == "html")
                    {
                        generators.Add(new Generators.HtmlOmdGenerator());
                    }
                    else
                    {
                        Console.WriteLine("Invalid format parameter.");
                        WriteUsage();
                        return;
                    }
                }
            }
            if (!generators.Any())
            {
                generators.Add(new Generators.HtmlOmdGenerator());
            }
            if (!arg.ContainsKey("source") && !arg.ContainsKey("assemblies"))
            {
                WriteUsage();
                return;
            }

            GeneratorSettings.ShowPrivateMembers  = arg.ContainsKey("showPrivate");
            GeneratorSettings.ShowInternalMembers = arg.ContainsKey("showInternal");
            if (arg.ContainsKey("output"))
            {
                GeneratorSettings.OutputLocation = arg["output"];
            }
            List <Regex> filters = arg.ContainsKey("exclude") ? arg["exclude"].Split(';', StringSplitOptions.RemoveEmptyEntries).Select(f => CreateFilter(f)).ToList() : new List <Regex>();

            if (arg.ContainsKey("regexfilter"))
            {
                filters.Add(new Regex(arg["regexfilter"]));
            }
            string[] source            = arg.ContainsKey("source") ? arg["source"].Split(';', StringSplitOptions.RemoveEmptyEntries) : new string[] { };
            string[] oldSource         = arg.ContainsKey("compareSource") ? arg["compareSource"].Split(';', StringSplitOptions.RemoveEmptyEntries) : null;
            string[] preprocessors     = arg.ContainsKey("preprocessors") ? arg["preprocessors"].Split(';', StringSplitOptions.RemoveEmptyEntries) : null;
            string[] assemblies        = arg.ContainsKey("assemblies") ? arg["assemblies"].Split(';', StringSplitOptions.RemoveEmptyEntries) : new string[] { };
            string[] compareAssemblies = arg.ContainsKey("compareAssemblies") ? arg["compareAssemblies"].Split(';', StringSplitOptions.RemoveEmptyEntries) : null;
            var      g = new Generator(generators);

            //Set up output filename
            if (string.IsNullOrEmpty(GeneratorSettings.OutputLocation))
            {
                GeneratorSettings.OutputLocation = "./";
            }
            var fi = new System.IO.FileInfo(GeneratorSettings.OutputLocation);

            if (!fi.Directory.Exists)
            {
                throw new System.IO.DirectoryNotFoundException(fi.Directory.FullName);
            }
            if (fi.Attributes == System.IO.FileAttributes.Directory)
            {
                GeneratorSettings.OutputLocation = System.IO.Path.Combine(GeneratorSettings.OutputLocation, "OMD");
            }

            if (oldSource != null || compareAssemblies != null)
            {
                await g.ProcessDiffs(oldSource, source, compareAssemblies, assemblies, preprocessors, filters.ToArray());
            }
            else
            {
                await g.Process(source, assemblies, preprocessors, filters.ToArray());
            }

            if (System.Diagnostics.Debugger.IsAttached)
            {
                Console.ReadKey();
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("*********************** Object Model Generator ***********************");

            ICodeGenerator generator = null;
            var            arg       = ArgumentParser.Parse(args);

            //if (arg.ContainsKey("format"))
            //{
            //    if (arg["format"] == "image")
            //        generator = new Generators.OMDGenerator();
            //    else if (arg["format"] == "html")
            //        generator = new Generators.HtmlOmdGenerator();
            //    else
            //    {
            //        Console.WriteLine("Invalid format parameter.");
            //        WriteUsage();
            //        return;
            //    }
            //}
            //else
            //{
            generator = new Generators.HtmlOmdGenerator();
            //}
            if (!arg.ContainsKey("source"))
            {
                WriteUsage();
                return;
            }

            GeneratorSettings.ShowPrivateMembers  = arg.ContainsKey("ShowPrivate");
            GeneratorSettings.ShowInternalMembers = arg.ContainsKey("ShowInternal");
            GeneratorSettings.OutputLocation      = arg.ContainsKey("output") ? arg["output"] : "./";
            List <Regex> filters = arg.ContainsKey("exclude") ? arg["exclude"].Split(';', StringSplitOptions.RemoveEmptyEntries).Select(f => CreateFilter(f)).ToList() : new List <Regex>();

            if (arg.ContainsKey("regexfilter"))
            {
                filters.Add(new Regex(arg["regexfilter"]));
            }
            string[] source        = arg["source"].Split(';', StringSplitOptions.RemoveEmptyEntries);
            string[] oldSource     = arg.ContainsKey("compareSource") ? arg["compareSource"].Split(';', StringSplitOptions.RemoveEmptyEntries) : null;
            string[] preprocessors = arg.ContainsKey("preprocessors") ? arg["preprocessors"].Split(';', StringSplitOptions.RemoveEmptyEntries) : null;
            string[] paths         = { @"dotnet-api\src\Esri.ArcGISRuntime\Esri.ArcGISRuntime.Shared",
                                       @"dotnet-api\src\Esri.ArcGISRuntime\Esri.ArcGISRuntime.WindowsDesktop",
                                       @"dotnet-api\src\Esri.ArcGISRuntime.Hydrography\Esri.ArcGISRuntime.Hydrography.Shared",
                                       @"dotnet-api\src\Esri.ArcGISRuntime.Hydrography\Esri.ArcGISRuntime.Hydrography.WindowsDesktop",
                                       @"dotnet-api\src\Esri.ArcGISRuntime.Preview\Esri.ArcGISRuntime.Preview.Shared",
                                       @"dotnet-api\src\Esri.ArcGISRuntime.Preview\Esri.ArcGISRuntime.Preview.WindowsDesktop",
                                       @"dotnet-api\src\Esri.ArcGISRuntime\Esri.ArcGISRuntime.Xamarin.Forms.Shared",
                                       @"api_generated_interop\managed_wrappers" };
            //oldSource = paths.Select(p => @"c:\apps100.2\dotnet\" + p).ToArray();
            //source = paths.Select(p => @"c:\apps\dotnet\" + p).ToArray();
            //oldSource = null;
            //source = new[] { @"c:\GitHub\Microsoft\UWPCommunityToolkit"};
            // oldSource = new[] { @"c:\GitHub\Microsoft\UWPCommunityToolkit2" };
            // source = new[] { @"c:\temp\corefx\src" };
            // oldSource = new[] { @"c:\temp\corefx2.0\src" };
            // source = new[] { "https://github.com/dotMorten/NmeaParser/archive/master.zip" };
            // oldSource = new[] { "https://github.com/dotMorten/NmeaParser/archive/591c532920ef52eaa965ad0d1ee4565cac396914.zip" };
            //oldSource = new[] { "https://devtopia.esri.com/runtime/dotnet-api/archive/release/100.2.1.zip" };
            var g = new Generator(generator);

            if (oldSource != null)
            {
                g.ProcessDiffs(oldSource, source, preprocessors, filters.ToArray()).Wait();
            }
            else
            {
                g.Process(source, preprocessors, filters.ToArray()).Wait();
            }

            if (System.Diagnostics.Debugger.IsAttached)
            {
                Console.ReadKey();
            }
        }