Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.Title = "项目重命名工具";

            config = Configuration.Build();

            srcProjectPath = CmdReader.ReadLine("请输入原项目路径:", input => Directory.Exists(input));
            srcProjectName = CmdReader.ReadLine("请输入原项目名称:");
            newProjectName = CmdReader.ReadLine("请输入新项目名称:");

            Console.WriteLine("正在处理...");

            replaceRegex = new Regex(
                srcProjectName,
                RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Compiled);

            newProjectPath = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                newProjectName);

            Replace(srcProjectPath);

            Console.WriteLine($"完成!\r\n新的项目保存在:{newProjectPath}");
            Console.Write("请按任意键退出!");
            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);//处理文件编码不支持gb2312
            Console.Title = "项目重命名工具";

            config = Configuration.Build();

            srcProjectPath = CmdReader.ReadLine("请输入原项目路径:", input => Directory.Exists(input));
            srcProjectName = CmdReader.ReadLine("请输入原项目名称:");

            newProjectPath = CmdReader.ReadLine("请输入新项目保存位置:", input => Directory.Exists(input));
            newProjectName = CmdReader.ReadLine("请输入新项目名称:");

            newProjectPath = Path.Combine(newProjectPath, newProjectName);

            Console.WriteLine("正在处理...");

            replaceRegex = new Regex(
                srcProjectName,
                RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Compiled);

            // 保存到桌面
            // Environment.GetFolderPath(Environment.SpecialFolder.Desktop)

            Rename(srcProjectPath);

            Console.WriteLine($"完成!\r\n新的项目保存在:{newProjectPath}");
            Console.Write("请按任意键退出!");
            Console.ReadKey();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.Title = "项目重命名工具";

            config = Configuration.Build();

            srcProjectPath                   = CmdReader.ReadLine("请输入原项目路径:", input => Directory.Exists(input));
            srcProjectName                   = CmdReader.ReadLine("请输入原项目名称:");
            srcProjectNameRemarks            = CmdReader.ReadLine("请输入原项目中文名称:");
            srcProjectNameFirstCharLowercase = srcProjectName.FirstCharToLower();
            srcProjectNameAllCharLowercase   = srcProjectName.ToLower();

            newProjectPath                   = CmdReader.ReadLine("请输入新项目保存位置:", input => Directory.Exists(input));
            newProjectName                   = CmdReader.ReadLine("请输入新项目名称:");
            newProjectNameRemarks            = CmdReader.ReadLine("请输入新项目中文名:");
            newProjectNameFirstCharLowercase = newProjectName.FirstCharToLower();
            newProjectNameAllCharLowercase   = newProjectName.ToLower();

            newProjectPath = Path.Combine(newProjectPath, newProjectName);

            Console.WriteLine("正在处理...");

            replaceRegexOriginalProjectName = new Regex(
                srcProjectName, RegexOptions.Multiline | RegexOptions.Compiled);
            replaceRegexProjectNameRemarks = new Regex(
                srcProjectNameRemarks, RegexOptions.Multiline | RegexOptions.Compiled);
            replaceRegexFirstCharLowercase = new Regex(
                srcProjectName.FirstCharToLower(), RegexOptions.Multiline | RegexOptions.Compiled);
            replaceRegexAllCharLowercase = new Regex(
                srcProjectName.ToLower(), RegexOptions.Multiline | RegexOptions.Compiled);

            // 保存到桌面
            // Environment.GetFolderPath(Environment.SpecialFolder.Desktop)

            Rename(srcProjectPath);

            Console.WriteLine($"完成!\r\n新的项目保存在:{newProjectPath}");
            Console.Write("请按任意键退出!");
            Console.ReadKey();
        }