コード例 #1
0
        private Maybe <AgentCompled> OnBuild(Maybe <PreparedBuild> mayBuild)
        {
            var agentName = Context.Self.Path.Name + ": ";

            return(MatchMay(
                       from build in mayBuild
                       select Try(() =>
                                  from step1 in MayTell(Context.Sender, BuildMessage.GatherData(build.Operation, agentName))
                                  from data in GetData(build)

                                  from step2 in MayTell(Context.Sender, BuildMessage.GenerateLangFiles(build.Operation, agentName))
                                  from a in GenerateJson(data, build.TargetPath)

                                  from step3 in MayTell(Context.Sender, BuildMessage.GenerateCsFiles(build.Operation, agentName))
                                  from b in GenerateCode(data, build.TargetPath)

                                  from final in MayTell(Context.Sender, BuildMessage.AgentCompled(build.Operation, agentName))
                                  select new AgentCompled(false, Maybe <Exception> .Nothing, build.Operation)),
                       e => May(new AgentCompled(true, May(e), mayBuild.Value.Operation))));
        }
コード例 #2
0
        private static AgentCompled OnBuild(PreparedBuild build)
        {
            try
            {
                var agentName = Context.Self.Path.Name + ": ";

                Context.Sender.Tell(BuildMessage.GatherData(build.Operation, agentName));
                var data = GetData(build);

                Context.Sender.Tell(BuildMessage.GenerateLangFiles(build.Operation, agentName));
                GenerateJson(data, build.TargetPath);

                Context.Sender.Tell(BuildMessage.GenerateCsFiles(build.Operation, agentName));
                GenerateCode(data, build.TargetPath);

                Context.Sender.Tell(BuildMessage.AgentCompled(build.Operation, agentName));

                return(new AgentCompled(false, null, build.Operation));
            }
            catch (Exception e)
            {
                return(new AgentCompled(true, e, build.Operation));
            }
        }