private static Maybe <Dictionary <string, GroupDictionary <string, (string Id, string Content)> > > GetData(PreparedBuild build) { var files = new Dictionary <string, GroupDictionary <string, (string Id, string Content)> >(); var(buildInfo, targetProject, projectFile, _, _) = build; var imports = new List <(string FileName, Project Project)> { (string.Empty, targetProject) }; imports.AddRange(targetProject.Imports .Select(pn => projectFile.Projects.Find(p => p.ProjectName == pn)) .Where(p => p != null) .Select(p => buildInfo.IntigrateProjects ? (string.Empty, p) : (p.ProjectName, p)) !); foreach (var(fileName, project) in imports) { if (!files.TryGetValue(fileName, out var entrys)) { entrys = new GroupDictionary <string, (string Id, string Content)>(); files[fileName] = entrys; } foreach (var(_, id, values) in project.Entries) { foreach (var((shortcut, _), value) in values) { entrys.Add(shortcut, (id, value)); } } } return(May(files)); }
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)); } }