Пример #1
0
        static int Main(string[] args)
        {
            if (args.Contains("/debug"))
            {
                Console.Write("Waiting for debugger to attach...");
                while (!Debugger.IsAttached)
                {
                    Thread.Sleep(100);
                }
                Console.WriteLine("Attached.");
            }

            if (!ParametersParser.Start(args))
            {
                return(Helper.ShowHelp());
            }

            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);
            }
        }
Пример #2
0
        void GenerateDataProviderClasses()
        {
            foreach (var type in DtoTypes.All)
            {
                Console.Write("Adding DTO class " + type.Name + "...");
                var dto = new DtoProgrammer(type);
                Folder.GetFile(type.Name + ".cs").WriteAllText(dto.Generate());

                var dataProvider = new DtoDataProviderClassGenerator(type).Generate();
                if (dataProvider.HasValue())
                {
                    Folder.GetFile(type.Name + "DataProvider.cs").WriteAllText(dataProvider);
                }

                Console.WriteLine("Done");
            }
        }
Пример #3
0
        static int Main(string[] args)
        {
            if (!ParametersParser.Start(args))
            {
                return(Helper.ShowHelp());
            }

            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);
                Console.WriteLine("------------------------");
                Context.LoadAssembly();
                Context.PrepareOutputDirectory();
                DtoTypes.FindAll();
                DtoDataProviderClassGenerator.ValidateRemoteDataProviderAttributes();

                new ProxyProjectCreator().Build();
                if (DtoTypes.All.Any())
                {
                    new MSharpProjectCreator().Build();
                }

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