private static bool FlowOptionsClassic(string[] args, HelperSysObjectsBase sysObject, string flow) { var result = false; if (flow == ((int)Eflows.GerarCodigo).ToString()) { PrinstScn.WriteLine("Gerar direto na pasta dos projetos? [S=Sim, N=Não]"); var usePathProjects = Console.ReadLine(); MainWithOutConfirmation(args, usePathProjects.ToLower() == "s", sysObject); result = true; } if (flow == ((int)Eflows.GerarCodigoEspecifico).ToString()) { PrinstScn.WriteLine("Gerar direto na pasta dos projetos? [S=Sim, N=Não]"); var usePathProjects = Console.ReadLine(); MainWithConfirmation(args, usePathProjects.ToLower() == "s", sysObject); result = true; } if (flow == ((int)Eflows.Sair).ToString()) { Environment.Exit(0); result = true; } return(result); }
private static void MainEspecificClass(string[] args, bool UsePathProjects, HelperSysObjectsBase sysObject) { PrinstScn.WriteLine($"Atualizando / Criando Contextos ou classes especificas! [{args.LastOrDefault()}]"); foreach (var item in sysObject.Contexts) { sysObject.MakeClass(item, args[1], UsePathProjects); } }
public static void Flow(string[] args, HelperSysObjectsBase sysObject) { var executeFlow = FlowOptionsClassic(args, sysObject); if (!executeFlow) { PrinstScn.WriteLine("Fluxo Não implementado"); } Flow(args, sysObject); }
public static void Fix(HelperSysObjectsBase sysObject) { foreach (var item in sysObject.Contexts) { FixFileInFolder(item.OutputClassDomain); FixFileInFolder(item.OutputClassApp); FixFileInFolder(item.OutputClassApi); FixFileInFolder(item.OutputClassDto); FixFileInFolder(item.OutputClassFilter); } }
private static bool FlowOptionsClassic(string[] args, HelperSysObjectsBase sysObject) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Escolha as opções;"); Console.WriteLine("[{0} = >> Gerar Código ]", (int)Eflows.GerarCodigo); Console.WriteLine("[{0} = >> Gerar Código de um Contexto ou Classe Especifica]", (int)Eflows.GerarCodigoEspecifico); Console.WriteLine("[{0} = >> Sair", (int)Eflows.Sair); var flow = Console.ReadLine(); return(FlowOptionsClassic(args, sysObject, flow)); }
public static void Flow(string[] args, HelperSysObjectsBase sysObject) { var executeFlow = FlowOptionsClassic(args, sysObject); if (args.FirstOrDefault() != "?") { if (!executeFlow) { PrinstScn.WriteLine("Fluxo Não implementado #"); } Flow(new string[] { "?" }, sysObject); } }
private static bool FlowOptionsClassic(string[] args, HelperSysObjectsBase sysObject, string flow) { var result = false; if (flow == ((int)Eflows.GerarCodigo).ToString()) { PrinstScn.WriteLine("Gerar direto na pasta dos projetos? [S=Sim, N=Não]"); var usePathProjects = Console.ReadLine(); MainWithOutConfirmation(args, usePathProjects.ToLower() == "s", sysObject); result = true; } if (flow == ((int)Eflows.GerarCodigoEspecifico).ToString()) { if (args.Count() == 3) { MainEspecificClass(args, args.LastOrDefault().ToLower() == "s", sysObject); } else { PrinstScn.WriteLine("Gerar direto na pasta dos projetos? [S=Sim, N=Não]"); var usePathProjects = Console.ReadLine(); MainWithConfirmation(args, usePathProjects.ToLower() == "s", sysObject); } result = true; } if (flow == ((int)Eflows.AbrirLocalDoProjeto).ToString()) { HelperCmd.ExecuteCommand(string.Format("explorer {0}", "."), 10000); result = true; } if (flow == ((int)Eflows.Sair).ToString()) { Environment.Exit(0); result = true; } return(result); }
public static void Fix(HelperSysObjectsBase sysObject) { foreach (var ctx in sysObject.Contexts) { var tableInfos = ctx.TableInfo.Where(_ => _.MakeFrontCrudBasic == true); if (tableInfos.Any()) { foreach (var tbi in tableInfos) { var folderTarget = $"{ctx.OutputAngular}\\src\\app\\main\\{tbi.TableName.ToLower()}"; if (Directory.Exists(folderTarget)) { DeleteFolders(tbi.TableName.ToLower(), folderTarget); DeleteFiles(tbi.TableName.ToLower(), folderTarget); } } } } }
public static void Fix(HelperSysObjectsBase sysObject) { foreach (var item in sysObject.Contexts) { FixFileInFolder(item.OutputClassDomain); FixFileInFolder(item.OutputClassApp); FixFileInFolder(item.OutputClassApi); FixFileInFolder(item.OutputClassDto); FixFileInFolder(item.OutputClassSummary); FixFileInFolder(item.OutputClassFilter); FixFileInFolder(item.OutputClassInfra); FixFileInFolder(item.OutputClassSso); FixFileInFolder(item.OutputAngular); FixFileInFolder(item.OutputClassCrossCustingAuth); } }
private static bool FlowOptionsClassic(string[] args, HelperSysObjectsBase sysObject, string flow) { var result = false; if (flow == ((int)Eflows.GerarCodigo).ToString()) { PrinstScn.WriteLine("Gerar direto na pasta dos projetos? [S=Sim, N=Não]"); var usePathProjects = Console.ReadLine(); MainWithOutConfirmation(args, usePathProjects.ToLower() == "s", sysObject); result = true; } if (flow == ((int)Eflows.GerarCodigoEspecifico).ToString()) { PrinstScn.WriteLine("Gerar direto na pasta dos projetos? [S=Sim, N=Não]"); var usePathProjects = Console.ReadLine(); MainWithConfirmation(args, usePathProjects.ToLower() == "s", sysObject); result = true; } if (flow == ((int)Eflows.AbrirLocalDoProjeto).ToString()) { HelperCmd.ExecuteCommand(string.Format("explorer '{0}'", AppDomain.CurrentDomain.BaseDirectory.Replace("\\Gerador.Gen\\", "").Replace("bin\\Debug\\", "").Replace("bin\\Release\\", "")), 10000); result = true; } if (flow == ((int)Eflows.Sair).ToString()) { Environment.Exit(0); result = true; } return(result); }
private static bool FlowOptionsClassic(string[] args, HelperSysObjectsBase sysObject) { Console.ForegroundColor = ConsoleColor.Yellow; var flow = string.Empty; if (args.Length == 0) { OptionsClassic(); flow = Console.ReadLine(); } else if (args.FirstOrDefault() == "?") { OptionsClassic(); } else { flow = args.FirstOrDefault(); } Console.ForegroundColor = ConsoleColor.White; return(FlowOptionsClassic(args, sysObject, flow)); }
public static void DoMigation(HelperSysObjectsBase sysObject, string originPathRoot, string originNamespace) { var filesToMigrationsOrigin = new List <FileInfo>(); var filesToMigrationsDestination = new List <string>(); foreach (var ctx in sysObject.Contexts) { foreach (var item in ctx.TableInfo) { var pathBase = PathOutputBase.PathBase(originPathRoot, ctx.UsePathProjects); GetDirectorys(pathBase, filesToMigrationsOrigin, item); } } foreach (var ctx in sysObject.Contexts) { foreach (var file in filesToMigrationsOrigin) { var newFilePath = file.FullName.Replace(originPathRoot, ctx.OutputClassRoot).Replace(originNamespace, ctx.Namespace); filesToMigrationsDestination.Add(newFilePath); PrinstScn.WriteLine("rename file {0} to list destination", file); var pathBase = new FileInfo(newFilePath).DirectoryName; if (!Directory.Exists(pathBase)) { Directory.CreateDirectory(pathBase); } File.Copy(file.FullName, newFilePath, true); } } foreach (var item in filesToMigrationsDestination) { PrinstScn.WriteLine("Final Path : {0}", item); } }
private static bool FlowOptions(string[] args, Func <IEnumerable <ExternalResource> > GetConfigExternarReources, HelperSysObjectsBase sysObject) { Console.ForegroundColor = ConsoleColor.Yellow; var flow = string.Empty; if (args.Length == 0) { Options(); flow = Console.ReadLine(); } else if (args.FirstOrDefault() == "?") { Options(); } else { flow = args.FirstOrDefault(); } var result = FlowOptionsClassic(args, sysObject, flow); if (flow == ((int)Eflows.AtualizarAplicacao).ToString()) { PrinstScn.WriteLine("Clonar e Copiar para aplicação"); HelperExternalResources.CloneAndCopy(GetConfigExternarReources()); result = true; } if (flow == ((int)Eflows.ReduzirArquivosParaCrudBasic).ToString()) { PrinstScn.WriteLine("Essa opção deleta diversos arquivos do Front SPA, tem certeza que deseja fazer isso? [S=Sim, N=Não]"); var confirmDelete = Console.ReadLine(); if (confirmDelete.ToLower() == "s") { HelperCrudBasicDelete.Fix(sysObject); var usePathProjects = confirmDelete; MainWithOutConfirmation(args, usePathProjects.ToLower() == "s", sysObject); } result = true; } if (flow == ((int)Eflows.AtualizarAplicaoParcialmente).ToString()) { Console.WriteLine("Qual dos seguintes Projetos você deseja Atualizar:"); Console.WriteLine("[1 = >> template-gerador-back-core2.0-DDD]"); Console.WriteLine("[2 = >> framework-core2.0-common]"); Console.WriteLine("[3 = >> template-gerador-front-coreui-angular6.0]"); Console.WriteLine("[4 = >> framework-angular6.0-CRUD]"); Console.WriteLine("[5 = >> Seed-layout-front-coreui-angular6.0]"); Console.WriteLine("[6 = >> Gerador]"); var resouceRepositoryNumberRead = Console.ReadLine(); HelperExternalResources.CloneAndCopy(FilterRepository(GetConfigExternarReources, resouceRepositoryNumberRead)); result = true; } if (flow == ((int)Eflows.GerarEstruturaParaNovoContexto).ToString()) { PrinstScn.WriteWarningLine("ATENÇÃO ESSE PROCEDIMENTO VAI BAIXAR DO GIT PROJETOS INICIAIS NAS PASTAS DE OUTPUT DO SEU PROJETO ATUAL. CASO SEU PROJETO AINDA ESTEJA COM O NOME DEFAULT SEED, ELE SERA SOBRESCRITO. AS CONFIGURAÇÕES DE OUTPUT ESTÃO NO APP.CONFIG DO GERADOR. TEM CERTEZA QUE DESEJA FAZER ISSO? (S=SIM/N=NÃO)"); var continueClony = Console.ReadLine(); if (continueClony.ToLower() == "s") { var projectFiles = HelperExternalResources.CloneAndCopyStructureForNewContext(GetConfigExternarReources()); Console.WriteLine("Digite o nome do novo Contexto"); var contextName = Console.ReadLine(); FixRenameSeed.Fix(sysObject.GetOutputClassRoot(), contextName, false); var seedFile = HelperExternalResources.CopySolutionFile(GetConfigExternarReources(), contextName); var projectFilesFix = FixRenameSeed.FixCollectionFile(projectFiles, contextName); var filesFixContent = new List <string>(); filesFixContent.AddRange(projectFilesFix); filesFixContent.Add(seedFile); foreach (var file in filesFixContent) { FixRenameSeed.FixContentFile(contextName, file); } } result = true; } if (flow == ((int)Eflows.AtualizarAplicacaoSemcopiar).ToString()) { PrinstScn.WriteLine("Clonar apenas"); HelperExternalResources.CloneOnly(GetConfigExternarReources()); result = true; } if (flow == ((int)Eflows.AtualizarRepository).ToString()) { PrinstScn.WriteLine("Atualizar repositorio local com arquivos da aplicação"); HelperExternalResources.UpdateLocalRepository(GetConfigExternarReources()); result = true; } if (flow == ((int)Eflows.FixFileNameToExtInApp).ToString()) { PrinstScn.WriteLine("Atualizar nomes dos Arquivos da aplicação para .Ext"); FixRenameExt.Fix(sysObject); result = true; } if (flow == ((int)Eflows.RenomearProjeto).ToString()) { Console.WriteLine("[1 = >> Apenas Sistema de Arquivos]"); Console.WriteLine("[2 = >> Sistema de Arquivos e Conteúdo]"); var Renameprocess = Console.ReadLine(); if (Renameprocess != "1" && Renameprocess != "2") { Console.WriteLine("fluxo Não disponível"); return(true); } var replaceinContentFile = Renameprocess == "1" ? false : true; PrinstScn.WriteLine("Definir nome do Projeto"); var projectName = Console.ReadLine(); FixRenameSeed.Fix(sysObject.GetOutputClassRoot(), projectName, replaceinContentFile); result = true; } if (flow == ((int)Eflows.RenomearUmaEntidadeDoSistema).ToString()) { Console.WriteLine("[1 = >> Apenas Sistema de Arquivos (Ignorar Case)]"); Console.WriteLine("[2 = >> Sistema de Arquivos e Conteúdo (Considerar Case)]"); var Renameprocess = Console.ReadLine(); if (Renameprocess != "1" && Renameprocess != "2") { Console.WriteLine("fluxo Não disponível"); return(true); } var replaceinContentFile = Renameprocess == "1" ? false : true; Console.WriteLine("Digite o nome da Entidade que Dejeja Renomear"); var termOrigin = Console.ReadLine(); Console.WriteLine("Digite o novo Nome"); var termDestination = Console.ReadLine(); var _fromTo = new Dictionary <string, string> { { termOrigin, termDestination } }; FixRenameFiles.Fix(sysObject.GetOutputClassRoot(), _fromTo, replaceinContentFile); result = true; } if (flow == ((int)Eflows.RenomearEntidadesDoSistema).ToString()) { Console.WriteLine("[1 = >> Apenas Sistema de Arquivos]"); Console.WriteLine("[2 = >> Sistema de Arquivos e Conteúdo]"); Console.WriteLine("<<<< Atenção esse processo é Case Sensitive >>>>>"); var Renameprocess = Console.ReadLine(); if (Renameprocess != "1" && Renameprocess != "2") { Console.WriteLine("fluxo Não disponível"); return(true); } var replaceinContentFile = Renameprocess == "1" ? false : true; Console.WriteLine("Digite o Caminho do Arquivo , com a relação de Para separado por ;"); var filePath = Console.ReadLine(); var content = File.ReadAllLines(filePath); var _fromTo = new Dictionary <string, string>(); foreach (var item in content) { _fromTo.Add(item.Split(';').FirstOrDefault(), item.Split(';').LastOrDefault()); } var fronToFixed = PrepareFromTo(_fromTo); Console.ForegroundColor = ConsoleColor.Green; foreach (var item in fronToFixed) { Console.WriteLine($"{item.Key} >> {item.Value}"); } Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Confira as trocas e a ordenação e escolha sim ou não (s=Sim/n=Não)"); var done = Console.ReadLine(); if (done == "s") { FixRenameFiles.Fix(sysObject.GetOutputClassRoot(), fronToFixed, replaceinContentFile); } result = true; } if (flow == ((int)Eflows.ImportarArquivosDeOutroProjeto).ToString()) { Console.WriteLine("Digite a Namespace do projeto de Origem"); var originNamespace = Console.ReadLine(); Console.WriteLine("Digite o Caminho do projeto de Origem"); var originPathRoot = Console.ReadLine(); HelperMigationToAnotherProject.DoMigation(sysObject, originPathRoot, originNamespace); result = true; } if (flow == ((int)Eflows.LimparDadosSeed).ToString()) { PrinstScn.WriteLine("Limpar Diretorios do Seed"); FixRenameSeed.ClearEnd(sysObject.GetOutputClassRoot()); result = true; } Console.ForegroundColor = ConsoleColor.White; return(result); }
public static void Flow(string[] args, Func <IEnumerable <ExternalResource> > GetConfigExternarReources, HelperSysObjectsBase sysObject) { if (sysObject.DisableCompleteFlow) { PrinstScn.WriteWarningLine("Fluxo completo foi desabilitado para essa aplicação"); Flow(args, sysObject); } else { var executeFlow = FlowOptions(args, GetConfigExternarReources, sysObject); if (args.FirstOrDefault() != "?") { if (!executeFlow) { PrinstScn.WriteLine("Fluxo Não implementado #"); } Flow(new string[] { "?" }, GetConfigExternarReources, sysObject); } } }
private static bool FlowOptions(string[] args, Func <IEnumerable <ExternalResource> > GetConfigExternarReources, HelperSysObjectsBase sysObject) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Escolha as opções;"); Console.WriteLine("[{0} = >> Clonar e Copiar para aplicação]", (int)Eflows.AtualizarAplicacao); Console.WriteLine("[{0} = >> Atualizar repositorio local com arquivos da aplicação]", (int)Eflows.AtualizarRepository); Console.WriteLine("[{0} = >> Gerar Código ]", (int)Eflows.GerarCodigo); Console.WriteLine("[{0} = >> Gerar Código de um Contexto ou Classe Especifica]", (int)Eflows.GerarCodigoEspecifico); Console.WriteLine("[{0} = >> Clonar apenas]", (int)Eflows.AtualizarAplicacaoSemcopiar); Console.WriteLine("[{0} = >> Sair", (int)Eflows.Sair); var flow = Console.ReadLine(); var result = FlowOptionsClassic(args, sysObject, flow); if (flow == ((int)Eflows.AtualizarAplicacao).ToString()) { PrinstScn.WriteLine("Clonar e Copiar para aplicação"); HelperExternalResources.CloneAndCopy(GetConfigExternarReources()); result = true; } if (flow == ((int)Eflows.AtualizarAplicacaoSemcopiar).ToString()) { PrinstScn.WriteLine("Clonar apenas"); HelperExternalResources.CloneOnly(GetConfigExternarReources()); result = true; } if (flow == ((int)Eflows.AtualizarRepository).ToString()) { PrinstScn.WriteLine("Atualizar repositorio local com arquivos da aplicação"); HelperExternalResources.UpdateLocalRepository(GetConfigExternarReources()); result = true; } return(result); }
public static void Flow(string[] args, Func <IEnumerable <ExternalResource> > GetConfigExternarReources, HelperSysObjectsBase sysObject) { var executeFlow = FlowOptions(args, GetConfigExternarReources, sysObject); if (!executeFlow) { PrinstScn.WriteLine("Fluxo Não implementado"); } Flow(args, GetConfigExternarReources, sysObject); }
public static void Flow(string[] args, Func <IEnumerable <ExternalResource> > GetConfigExternarReources, HelperSysObjectsBase sysObject) { MainFlow.Flow(args, GetConfigExternarReources, sysObject); }
private static void MainWithOutConfirmation(string[] args, bool UsePathProjects, HelperSysObjectsBase sysObject) { PrinstScn.WriteLine("Atualizando / Criando todos os Contextos"); foreach (var item in sysObject.Contexts) { PrinstScn.WriteLine(item.Namespace); sysObject.MakeClass(item, UsePathProjects); } }
private static void MainWithConfirmation(string[] args, bool UsePathProjects, HelperSysObjectsBase sysObject) { PrinstScn.WriteLine("Atualizando / Criando Contextos ou classes especificas!"); foreach (var item in sysObject.Contexts) { PrinstScn.WriteLine("Deseja Atualizar/Criar o Contexto? {0} [S=Sim, N=Não]", item.Namespace); var accept = Console.ReadLine(); if (accept == "s") { PrinstScn.WriteLine("Deseja Escolher uma classe, Digite o nome dela?"); var className = Console.ReadLine(); if (!string.IsNullOrEmpty(className)) { sysObject.MakeClass(item, className, UsePathProjects); } else { sysObject.MakeClass(item); } } } }