Esempio n. 1
0
        public static ComposeInstructions GetInstructions()
        {
            string targetDirectory = QuestionTexts.RequestDirectory();

            string[] fileEntries = Directory.GetFiles(targetDirectory);

            var filesInformation = new List <FileInformation>();

            foreach (string file in fileEntries)
            {
                filesInformation.Add(
                    new FileInformation(
                        file,
                        File.GetCreationTime(file)
                        )
                    );
            }
            ;

            ComposeMode mode = ComposeMode.Unknown;

            while (mode == ComposeMode.Unknown)
            {
                mode = QuestionTexts.RequestMode();
            }

            if (mode == ComposeMode.CustomText || mode == ComposeMode.Truncation || mode == ComposeMode.Extension)
            {
                string customText = QuestionTexts.RequestCustomText(mode);
                return(new ComposeInstructions(mode, customText, filesInformation));
            }

            return(new ComposeInstructions(mode, filesInformation));
        }
Esempio n. 2
0
        public static void Rewrite(Dictionary <string, string> proposal)
        {
            if (proposal.TryGetValue("Error message", out string message))
            {
                StandardTexts.DisplayError(message);
                StandardTexts.Finished();
            }

            StandardTexts.ProposeFilenameChanges(proposal);

            var execute = QuestionTexts.AskPermission();

            if (execute)
            {
                RewriteFilePaths(proposal);
            }

            Console.WriteLine("");
            Console.WriteLine("Program finished.");
            Console.WriteLine("Exiting...");
            Thread.Sleep(2000);
            Environment.Exit(0);
        }