ControllerGenerator/Commands/FileControllerGenerator.cs

(完整代码) 841B

using CommonUtils;
using System;

namespace ControllerGenerator.Commands
{
    class FileControllerGenerator
    {
        public static void Handler(object sender, EventArgs e)
        {
            var namespace_ = WindowsUtil.GetInput("请输入命名空间", "DefaultNamespace");
            if (namespace_.IsEmpty())
                namespace_ = "DefaultNamespace";
            var path = WindowsUtil.SelectSavePathWithName("FileController.cs");
            if (path.IsEmpty())
                return;
            var controllerCode = ResourceUtil
                     .GetText(typeof(FileControllerGenerator).Assembly, "FileController.txt")
                     .Replace("@namespace", namespace_);
            FileUtil.SaveTo(path, controllerCode);
            EditorUtil.ShowMessage("代码已生成: " + path);
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。