예제 #1
0
        public static string GetExistingFilePath()
        {
            string path = DragonUtil.RemoveAllQuotes(Console.ReadLine());

            if (File.Exists(path))
            {
                return(path);
            }

            ColoredConsole.WriteLineWithColor("File " + path + " doesn't exist!", ConsoleColor.Red);
            Console.WriteLine("");
            return(null);
        }
예제 #2
0
        public static string GetNewFilePath()
        {
            string path = DragonUtil.RemoveAllQuotes(Console.ReadLine());

            var directoryName = Path.GetDirectoryName(path);

            if (Directory.Exists(directoryName) &&
                DragonUtil.CheckFolderWritePermission(directoryName))
            {
                return(path);
            }

            ColoredConsole.WriteLineWithColor("Invalid folder, can't write to to: " + directoryName, ConsoleColor.Red);

            Console.WriteLine("");
            return(null);
        }