Exemple #1
0
 // 无需编译
 public CmResult Nodejs(string path)
 {
     if (!FileHelper.IsExists(path))
     {
         return(CmResult.BuildFail("", "文件不存在"));
     }
     if (!path.EndsWith(".js"))
     {
         return(CmResult.BuildFail("", "文件类型不正确"));
     }
     return(BuildHelper.BuildCmm($"node {path}"));
 }
Exemple #2
0
 // 无需编译
 public CmResult Python(string path)
 {
     if (!FileHelper.IsExists(path))
     {
         return(CmResult.BuildFail("", "文件不存在"));
     }
     if (!path.EndsWith(".py"))
     {
         return(CmResult.BuildFail("", "文件类型不正确"));
     }
     return(BuildHelper.BuildCmm($"python {path}"));
 }
Exemple #3
0
        public CmResult CPlusPlus(string path)
        {
            CmResult cr = build.CPlusPlus(path);

            if (!cr.Success)
            {
                return(cr);
            }
            if (!FileHelper.IsExists(cr.Message))
            {
                return(CmResult.BuildFail("", "编译文件不存在"));
            }
            return(BuildHelper.BuildCmm($"{cr.Message}"));
        }
Exemple #4
0
        public CmResult C(string path)
        {
            if (!FileHelper.IsExists(path))
            {
                return(CmResult.BuildFail("", "文件不存在"));
            }
            string   dir   = FileHelper.GetDir(path);
            string   guid  = Guid.NewGuid().ToString("N");
            string   runsh = Path.Combine(dir, guid);
            CmResult cr    = BuildHelper.BuildCmm($"gcc {path} -o {runsh}");

            if (cr.Success)
            {
                return(CmResult.BuildSuccess(Path.Combine(dir, $"./{guid}")));
            }
            return(cr);
        }
Exemple #5
0
        public CmResult Java(string path)
        {
            CmResult cr = build.Java(path);

            if (!cr.Success)
            {
                return(cr);
            }
            if (!FileHelper.IsExists($"{cr.Message}.class"))
            {
                return(CmResult.BuildFail("", "执行文件不存在"));
            }
            string classPath = FileHelper.GetDir(path);

            string className = FileHelper.GetName(path).Replace(".java", "");

            return(BuildHelper.BuildCmm($"java -classpath {classPath} -Dfile.encoding=utf8 {className}"));
        }
Exemple #6
0
        public CmResult Java(string path)
        {
            if (!FileHelper.IsExists(path))
            {
                return(CmResult.BuildFail("", "文件不存在"));
            }
            if (!path.EndsWith(".java"))
            {
                return(CmResult.BuildFail("", "文件类型不正确"));
            }
            CmResult cr = BuildHelper.BuildCmm($"javac -encoding utf8 {path}");

            if (!cr.Success)
            {
                return(cr);
            }
            string runName = path.Substring(0, path.LastIndexOf(".java"));

            return(CmResult.BuildSuccess(runName));
        }