Exemplo n.º 1
0
        static int Main(string[] args)
        {
            ParametersParser.SetArgs(args);

            if (!Initialize(args))
            {
                return(-1);
            }

            try
            {
                ParametersParser.Current.LoadParameters(null);

                Console.WriteLine("Generating Client SDK proxy from...");
                Console.WriteLine("Publisher service: " + Context.Current.PublisherService);
                Console.WriteLine("Api assembly: " + Context.Current.AssemblyFile);
                Console.WriteLine("Api controller: " + Context.Current.ControllerName);
                Console.WriteLine("Temp folder: " + Context.Current.TempPath);

                Context.Current.LoadAssembly();
                Context.Current.PrepareOutputDirectory();


                DtoTypes.FindAll(
                    Context.Current.ActionMethods.SelectMany(x => x.GetArgAndReturnTypes()).ToArray()
                    , Context.Current.AssemblyObj);

                DtoDataProviderClassGenerator.ValidateRemoteDataProviderAttributes();

                new List <ProjectCreatorBase> {
                    new ProxyProjectCreator()
                };

                var proxyCreator = new ProxyProjectCreator();
                proxyCreator.Build();

                new NugetCreator(proxyCreator).Create();

                GenerateMSharps();

                if (Context.Current.Output != null)
                {
                    Context.Current.TempPath.CopyTo(Context.Current.Output.FullName, true);
                }


                Console.WriteLine("Add done");
                return(0);
            }
            catch (Exception ex)
            {
                ShowError(ex);
                return(-1);
            }
        }
Exemplo n.º 2
0
        static int Main(string[] args)
        {
            if (!Initialize(args))
            {
                return(-1);
            }

            try
            {
                ParametersParser.LoadParameters();

                Console.WriteLine("Generating Client SDK proxy from...");
                Console.WriteLine("Publisher service: " + Context.PublisherService);
                Console.WriteLine("Api assembly: " + Context.AssemblyFile);
                Console.WriteLine("Api controller: " + Context.ControllerName);
                Console.WriteLine("Temp folder: " + Context.TempPath);
                Context.LoadAssembly();
                Context.PrepareOutputDirectory();
                DtoTypes.FindAll();
                DtoDataProviderClassGenerator.ValidateRemoteDataProviderAttributes();

                new List <ProjectCreator> {
                    new ProxyProjectCreator()
                };

                var proxyCreator = new ProxyProjectCreator();
                proxyCreator.Build();
                new NugetCreator(proxyCreator).Create();

                if (DtoTypes.All.Any())
                {
                    var projectCreators = new[] { new MSharpProjectCreator(), new MSharp46ProjectCreator() };
                    projectCreators.AsParallel().Do(x => x.Build());
                    new NugetCreator(projectCreators).Create();
                }

                Console.WriteLine("Add done");
                return(0);
            }
            catch (Exception ex)
            {
                ShowError(ex);
                return(-1);
            }
        }