示例#1
0
        public IActionResult Build(int?depth)
        {
            List <string> files = new List <string>();
            var           books = new List <BookVM>();
            int           count = Disk.DirSearch(Settings.FilesPath, files, "*.zip", true);
            var           comp  = new Compressor();

            foreach (string file in files)
            {
                var info = comp.GetAudioBookInformation(file);
                if (info != null)
                {
                    //todo: add Book to repository
                    //todo: add Author to repository
                    //todo: read book and author from repostitory into books list

                    Here to code next

                    books.Add(new BookVM(new Book(info)));
                }
            }

            var model = new BuildVM {
                Title   = "titillinn",
                Message = "skilaboðin",
                Depth   = depth.HasValue ? depth.Value : 0,
                Books   = books
            };

            return(View(model));
        }
示例#2
0
        public ActionResult Build([FromBody] BuildVM build)
        {
            Console.WriteLine(build != null);

            var username = SuperDataBase.Configs.GetRealUserName(build.resource.lastChangedBy.uniqueName)
                           ?? SuperDataBase.Configs.GetRealUserName(build.resource.requestedFor.uniqueName)
                           ?? SuperDataBase.Configs.GetRealUserName(build.resource.requestedBy.uniqueName);
            var display = SuperDataBase.Configs.GetDisplayName(username);

            if (username == null || display == null)
            {
                return(Ok("no user"));
            }

            var branch = build.resource.sourceBranch.Split('/').Last();

            var part1name = build.resource.result.Equals("succeeded")
                ? "TBuildSuccessFirst"
                : "TBuildFailFirst";
            var part2name = build.resource.result.Equals("succeeded")
                ? "TBuildSuccessLast"
                : "TBuildFailLast";
            var actionPart1 =
                SuperDataBase.Actions.SpeakActions.Where(x => x.Name.StartsWith(part1name))
                .GetRandom()
                .DeepCopy();
            var actionPart2 =
                SuperDataBase.Actions.SpeakActions.Where(x => x.Name.StartsWith(part2name))
                .GetRandom()
                .DeepCopy();
            var actionMove = SuperDataBase.Actions["B" + username];

            actionPart1.Text = actionPart1.Text.Replace("{branch}", branch);
            actionPart2.Text = actionPart2.Text.Replace("{userdisplay}", display);

            var seq = new SequenceAction();

            seq.AddPararellActions(actionPart1);
            seq.AddPararellActions(actionMove);
            seq.AddPararellActions(actionPart2);

            SuperDataBase.Queue.Add(new ActionContainer(seq));

            return(Ok("queued"));
        }
 private void BuildEvents_OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
 {
     BuildVM?.Finish(Scope, Action);
     GenerateData(BuildVM.Group);
 }