Exemplo n.º 1
0
        public async Task Execute()
        {
            ShowOptions();
            Console.WriteLine();
            //if (optionManager.Validate() < 0)
            //{
            ArgOptions.Errors.ForEach(x =>
            {
                _logger.Error(x);
            });
            //return;
            //}

            //show warning
            ArgOptions.Errors.ForEach(x =>
            {
                _logger.Warn(x);
            });
            _logger.Info($"Start processing url: { odataConnectionString.ServiceUrl}");
            //show result
            await GenerateCodeCommandAsync();

            GenerateProjectCommand();
            ServiceInfo();

            SaveMetaDataCommand();
            ShowHeaderCommand();
            ListPocoCommand();
            VerboseCommand();
            ShowErrors();
        }
Exemplo n.º 2
0
        public static async Task Main1(string[] args)
        {
            var argument = string.Join(" ", args);

            try
            {
                _pocoFileSystem = new PocoFileSystem();
                if (!(Console.IsOutputRedirected || Console.IsErrorRedirected))
                {
                    Console.BufferHeight = Int16.MaxValue - 1;
                }

                // Catch all unhandled exceptions in all threads.
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                Sw.Start();
                RetCode = await RunOptionsAsync(args);

                Sw.Stop();
                Console.WriteLine();
                if (!ArgumentParser.ShowVersionOrHelp)
                {
                    Logger.Sucess($"Total processing time: {Sw.ElapsedMilliseconds / 1000.0} sec");
                }
            }
            catch (Exception ex)
            {
                RetCode = (int)ExitCodes.HandledException;
                Logger.Error($"Error in executing the command: o2pgen {argument}");
                Logger.Error($"Error Message:\n {ex.FullExceptionMessage()}");

#if DEBUG
                Logger.Error("--------------------Exception Details---------------------");
                Logger.Error($"Error Message:\n {ex.FullExceptionMessage(true)}");
                Console.ReadKey();
#endif
            }
            finally
            {
                if (!ArgumentParser.ShowVersionOrHelp)
                {
                    Logger.Info($"Application Exit code: {RetCode}");
                }
                Environment.Exit(RetCode);
            }
        }
Exemplo n.º 3
0
        public void SaveToFolder(string folderPath, Dictionary <string, string> codeList)
        {
            if (File.Exists(folderPath))
            {
                var msg = $"Cannot create folder '{folderPath}' because a file with the same name already exists.";
                Logger.Error(msg);
                return;
            }

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }
            foreach (var entry in codeList)
            {
                var fname = Path.Combine(folderPath, $"{entry.Key}.ts");
                var code  = entry.Value;
                SaveToFile(fname, code);
            }
        }