コード例 #1
0
        protected void StartBuild(string buildName, RequestContext context, RequestArgs args)
        {
            if (context != Context)
            {
                return;
            }
            Build build;
            var   builds = Server.FindBuilds();

            if (builds == null)
            {
                Server.RaiseCommonError("StartBuild: Failed to load builds directory!", true);
                return;
            }
            if (!builds.TryGetValue(buildName, out build))
            {
                Server.RaiseCommonError("StartBuild: Wrong build name!", false);
                return;
            }
            if (args.Count < build.Args.Count)
            {
                Server.RaiseCommonError(
                    $"StartBuild: build required {build.Args.Count} args, but {args.Count - 1} args is provided!",
                    true);
                return;
            }
            var buildArgs = args.ToArray();

            if (Server.TryInitBuild(Context, build, buildArgs))
            {
                Server.StartBuild(buildArgs);
            }
        }