private async Task <ChauffeurDeliveryTable> Deliver(FileInfoBase file, IDictionary <string, string> @params)
        {
            var instructions = fileSystem.File
                               .ReadAllLines(file.FullName)
                               .Where(x => !string.IsNullOrEmpty(x))
                               .Where(x => !x.StartsWith("##"));

            var tracking = new ChauffeurDeliveryTable
            {
                Name          = file.Name,
                ExecutionDate = DateTime.Now,
                Hash          = HashDelivery(file),
                SignedFor     = true
            };

            if (!await AreAllParametersSpecified(instructions, @params))
            {
                tracking.SignedFor = false;
                return(tracking);
            }

            foreach (var instruction in instructions)
            {
                var result = await host.Run(new[] { replaceTokens(@params, instruction) });

                if (result != DeliverableResponse.Continue)
                {
                    tracking.SignedFor = false;
                    break;
                }
            }
            return(tracking);
        }
示例#2
0
        private async Task <ChauffeurDeliveryTable> Deliver(FileInfoBase file)
        {
            var instructions = fileSystem.File.ReadAllLines(file.FullName).Where(x => !string.IsNullOrEmpty(x));

            var tracking = new ChauffeurDeliveryTable
            {
                Name          = file.Name,
                ExecutionDate = DateTime.Now,
                Hash          = HashDelivery(file),
                SignedFor     = true
            };

            foreach (var instruction in instructions)
            {
                var result = await host.Run(new[] { instruction });

                if (result != DeliverableResponse.Continue)
                {
                    tracking.SignedFor = false;
                    break;
                }
            }
            return(tracking);
        }
        private async Task<ChauffeurDeliveryTable> Deliver(FileInfoBase file)
        {
            var instructions = fileSystem.File.ReadAllLines(file.FullName).Where(x => !string.IsNullOrEmpty(x));

            var tracking = new ChauffeurDeliveryTable
            {
                Name = file.Name,
                ExecutionDate = DateTime.Now,
                Hash = HashDelivery(file),
                SignedFor = true
            };
            foreach (var instruction in instructions)
            {
                var result = await host.Run(new[] { instruction });

                if (result != DeliverableResponse.Continue)
                {
                    tracking.SignedFor = false;
                    break;
                }
            }
            return tracking;
        }