Exemple #1
0
        public async Task <bool> Execute(string tipoProjeto, string nomeProjeto)
        {
            try
            {
                foreach (var item in DirectoryService.GetDirectories(nomeProjeto))
                {
                    var newPath = item.Replace(Constante.GetIdentifier(), Constante.GetPathOutput());
                    DirectoryService.CreateDirectory(newPath);
                }

                foreach (var item in from files in DirectoryService.EnumerateFiles()
                         where files.Split('.').Last() != "suo"
                         select new { File = files }
                         )
                {
                    var newPath = item.File.Replace(
                        Constante.GetIdentifier(),
                        Constante.GetPathOutput()
                        ).Replace(
                        Constante.GetNameTemplate(),
                        nomeProjeto
                        );

                    File.Copy(item.File, newPath, false);
                    await File.WriteAllTextAsync(
                        newPath,
                        File.ReadAllText(newPath)
                        .Replace(
                            Constante.GetNameTemplate(),
                            nomeProjeto
                            )
                        );
                }

                DirectoryService.MoveDirectory(tipoProjeto, nomeProjeto);

                Process.Start(
                    $"_Config/open.bat",
                    $"{Constante.GetFullPath(tipoProjeto, nomeProjeto)}\\{Constante.GetIdentifier()}"
                    );

                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Gerado Error: {ex.Message}", ConsoleColor.Red);
                return(false);
            }
        }
Exemple #2
0
 public IEnumerable <string> EnumerateFiles()
 {
     return(Directory.EnumerateFiles($"{Constante.GetPathTemplate()}{Constante.GetIdentifier()}", "*.*", SearchOption.AllDirectories));
 }