示例#1
0
        /// <summary>
        /// Implements IComponent.Execute method.
        /// </summary>
        /// <param name="pc">Pipeline context</param>
        /// <param name="inmsg">Input message</param>
        /// <returns>Original input message</returns>
        /// <remarks>
        /// IComponent.Execute method is used to initiate
        /// the processing of the message in this pipeline component.
        /// </remarks>
        public Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(Microsoft.BizTalk.Component.Interop.IPipelineContext pc, Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg)
        {
            string                 ActivityID    = Guid.NewGuid().ToString();
            string                 ShareLocation = "D:\\Share\\TrackingArchive\\"; // Should be an UNC Path with desired access granted to the User Account
            string                 FileExtension = ".txt";
            string                 FullFilePath  = ShareLocation + ActivityID + FileExtension;
            StringBuilder          SBContext     = new StringBuilder();
            ReadOnlySeekableStream stream        = new ReadOnlySeekableStream(inmsg.BodyPart.GetOriginalDataStream());
            Stream                 sourceStream  = inmsg.BodyPart.GetOriginalDataStream();

            if (!sourceStream.CanSeek)
            {
                ReadOnlySeekableStream seekableStream = new ReadOnlySeekableStream(sourceStream);

                inmsg.BodyPart.Data = seekableStream;

                sourceStream = inmsg.BodyPart.Data;
            }

            if (inmsg.BodyPart != null)
            {
                VirtualStream virtualStream = new VirtualStream(sourceStream);

                PipelineHelper.ArchiveToFileLocation(virtualStream, FullFilePath);
                PipelineHelper.ArchivetoStorage(pc, inmsg, FullFilePath, true);

                sourceStream.Position        = 0;
                inmsg.BodyPart.Data          = sourceStream;
                inmsg.BodyPart.Data.Position = 0;
            }

            return(inmsg);

            #endregion
        }
示例#2
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context == null || context.Instance == null || !(context.Instance is ContentFile) || provider == null)
            {
                return(value);
            }

            editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            ListBox lb = new ListBox();

            lb.SelectionMode         = SelectionMode.One;
            lb.SelectedValueChanged += OnListBoxSelectedValueChanged;

            var file = context.Instance as ContentFile;

            string ext = System.IO.Path.GetExtension(file.Name);

            lb.Items.AddRange(PipelineHelper.GetImporters(ext).ToArray());


            editorService.DropDownControl(lb);
            if (lb.SelectedItem == null)
            {
                return(value);
            }

            return(lb.SelectedItem);
        }
        private GetByUriResult GetHtmlRedirect(string url)
        {
            if (url.IsBlank())
            {
                return(null);
            }

            var baseUrl =
                HttpContext
                .Current
                .Request
                .ActualUrl()
                .GetLeftPart(UriPartial.Authority);
            var getByUriResult =
                this
                .htmlRedirectPipeline
                .GetByUri(
                    new GetByUriParameter {
                Uri = new Uri($"{baseUrl}{url}")
            });

            PipelineHelper.VerifyResults(getByUriResult);

            return(getByUriResult);
        }
示例#4
0
        private void BuildThread(ContentItem item)
        {
            FailedBuilds = 0;

            IsBuilding = true;
            string outputDir = GetOutputDir();

            CreateFolderIfNeeded(outputDir);
            PipelineHelper.PreBuilt(Project);
            using (engenious.Content.Pipeline.ContentImporterContext importerContext = new engenious.Content.Pipeline.ContentImporterContext())
                using (engenious.Content.Pipeline.ContentProcessorContext processorContext = new engenious.Content.Pipeline.ContentProcessorContext())
                {
                    importerContext.BuildMessage  += RaiseBuildMessage;
                    processorContext.BuildMessage += RaiseBuildMessage;

                    if (item == null)
                    {
                        BuildDir(Project, importerContext, processorContext);
                    }
                    else if (item is ContentFolder)
                    {
                        BuildDir((ContentFolder)item, importerContext, processorContext);
                    }
                    else if (item is ContentFile)
                    {
                        BuildFile((ContentFile)item, importerContext, processorContext);
                    }
                }
            //System.Threading.Thread.Sleep(8000);
            cache.Save(GetCacheFile());
            IsBuilding = false;

            BuildStatusChanged?.BeginInvoke(this, BuildStep.Build | BuildStep.Finished, null, null);
        }
示例#5
0
        public override async Task ExecuteAsync()
        {
            _loggerService.WriteHeading("PUBLISHING MCR DOCS");

            // Hookup a TraceListener in order to capture details from Microsoft.DotNet.VersionTools
            Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));

            IEnumerable <GitObject> gitObjects =
                GetUpdatedReadmes()
                .Concat(GetUpdatedTagsMetadata());

            foreach (GitObject gitObject in gitObjects)
            {
                _loggerService.WriteMessage(
                    $"Updated file '{gitObject.Path}' with contents:{Environment.NewLine}{gitObject.Content}{Environment.NewLine}");
            }

            if (!Options.IsDryRun)
            {
                using IGitHubClient gitHubClient = _gitHubClientFactory.GetClient(Options.GitOptions.ToGitHubAuth(), Options.IsDryRun);

                await RetryHelper.GetWaitAndRetryPolicy <HttpRequestException>(_loggerService).ExecuteAsync(async() =>
                {
                    GitReference gitRef = await GitHelper.PushChangesAsync(gitHubClient, Options, $"Mirroring readmes", branch =>
                    {
                        return(FilterUpdatedGitObjectsAsync(gitObjects, gitHubClient, branch));
                    });

                    if (gitRef != null)
                    {
                        _loggerService.WriteMessage(PipelineHelper.FormatOutputVariable("readmeCommitDigest", gitRef.Object.Sha));
                    }
                });
            }
        }
示例#6
0
        public void Build()
        {
            if (Project == null)
            {
                return;
            }
            currentBuild = BuildStep.Build;
            BuildStatusChanged?.BeginInvoke(this, BuildStep.Build, null, null);

            buildingThread = new System.Threading.Thread(new System.Threading.ThreadStart(delegate()
            {
                FailedBuilds = 0;

                IsBuilding       = true;
                string outputDir = getOutputDir();
                CreateFolderIfNeeded(outputDir);
                PipelineHelper.PreBuilt(Project);
                using (engenious.Content.Pipeline.ContentImporterContext importerContext = new engenious.Content.Pipeline.ContentImporterContext())
                    using (engenious.Content.Pipeline.ContentProcessorContext processorContext = new engenious.Content.Pipeline.ContentProcessorContext())
                    {
                        importerContext.BuildMessage  += RaiseBuildMessage;
                        processorContext.BuildMessage += RaiseBuildMessage;

                        buildDir(Project, importerContext, processorContext);
                    }
                //System.Threading.Thread.Sleep(8000);
                cache.Save(getCacheFile());
                IsBuilding = false;

                BuildStatusChanged?.BeginInvoke(this, BuildStep.Build | BuildStep.Finished, null, null);
            }));
            buildingThread.Start();
        }
        // POST umbraco/api/umbcontact/post
        public HttpResponseMessage Post([FromBody] UmbContactMail message)
        {
            // Return errors if the model validation fails
            // The model defines validations for empty or invalid email addresses
            // See the UmbContactMail class below
            if (ModelState.IsValid == false)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState.First().Value.Errors.First().ErrorMessage));
            }

            // Create a new Pipeline Contact and store in cookie
            var        contact = PipelineHelper.CreateContact(message.Name, message.Email, message.Telephone, message.Organisation);
            HttpCookie cookie  = new HttpCookie("PipelineContactId");

            cookie.Value   = contact.Id.ToString();
            cookie.Expires = DateTime.MaxValue;
            HttpContext.Current.Response.SetCookie(cookie);

            // Create new opportunity in Pipeline CRM
            var pipeline = PipelineHelper.CreatePipeline(
                "Website query",
                message.Name,
                message.Email,
                message.Telephone,
                message.Organisation,
                message.Message
                );

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
示例#8
0
 internal ForEachTask(ForEachTask <S, T> parent, Spliterator <S> spliterator) : base(parent)
 {
     this.Spliterator = spliterator;
     this.Sink        = parent.Sink;
     this.TargetSize  = parent.TargetSize;
     this.Helper      = parent.Helper;
 }
示例#9
0
        private object InvokeNativeNewObject(string typeName)
        {
            Command cmd = new Command(@"Microsoft.PowerShell.Utility\New-Object", false);

            if (base.ParameterSetName == "Net")
            {
                WriteDebug("ParameterSet Net");
                cmd.Parameters.Add("TypeName", typeName);
                cmd.Parameters.Add("ArgumentList", _arguments);
            }
            else
            {
                WriteDebug("ParameterSet COM");
                cmd.Parameters.Add("ComObject", typeName);
                if (this.Strict)
                {
                    cmd.Parameters.Add("Strict");
                }
            }

            PSObject instance = null;

            instance = PipelineHelper.ExecuteScalar <PSObject>(
                pipeline => pipeline.Commands.Add(cmd));

            return(instance);
        }
示例#10
0
 internal ForEachTask(PipelineHelper <T> helper, Spliterator <S> spliterator, Sink <S> sink) : base(null)
 {
     this.Sink        = sink;
     this.Helper      = helper;
     this.Spliterator = spliterator;
     this.TargetSize  = 0L;
 }
示例#11
0
        public override void Execute(CommandContext context)
        {
            var start = DateTime.Today;
            var end   = DateTime.Today + TimeSpan.FromDays(1);

            PipelineHelper.RunPipeline(start, end); // run the pipeline
            EventRaiser.RaiseEvent(start, end);
        }
示例#12
0
        private void ProcessSubscription(IUnitOfWork unitOfWork, CustomerOrder customerOrder, OrderLine orderLine)
        {
            ProductSubscriptionDto productSubscriptionDto = this.GetProductSubscriptionDto(orderLine);
            Subscription           subscription           = this.GetSubscription(customerOrder, orderLine, productSubscriptionDto);

            unitOfWork.GetRepository <Subscription>().Insert(subscription);
            Dictionary <Guid, PricingServiceParameter> dictionary = new Dictionary <Guid, PricingServiceParameter>();

            foreach (SubscriptionProduct subscriptionProduct in (IEnumerable <SubscriptionProduct>)orderLine.Product.SubscriptionProducts)
            {
                PricingServiceParameter serviceParameter = new PricingServiceParameter(subscriptionProduct.Product.Id)
                {
                    Product    = subscriptionProduct.Product,
                    QtyOrdered = subscriptionProduct.QtyOrdered * orderLine.QtyOrdered
                };
                dictionary.Add(subscriptionProduct.Product.Id, serviceParameter);
            }
            GetProductPricingResult productPricing = this.pricingPipeline.GetProductPricing(new GetProductPricingParameter(true)
            {
                PricingServiceParameters = (IDictionary <Guid, PricingServiceParameter>)dictionary
            });

            PipelineHelper.VerifyResults((PipeResultBase)productPricing);
            foreach (SubscriptionProduct subscriptionProduct1 in (IEnumerable <SubscriptionProduct>)orderLine.Product.SubscriptionProducts)
            {
                SubscriptionProduct subscriptionProduct = subscriptionProduct1;
                SubscriptionLine    subscriptionLine    = new SubscriptionLine()
                {
                    Product    = unitOfWork.GetRepository <Product>().Get(subscriptionProduct.Product.Id),
                    QtyOrdered = subscriptionProduct.QtyOrdered * orderLine.QtyOrdered
                };
                ProductPriceDto productPriceDto = productPricing.ProductPriceDtos.First <KeyValuePair <Guid, ProductPriceDto> >((Func <KeyValuePair <Guid, ProductPriceDto>, bool>)(o => o.Key == subscriptionProduct.Product.Id)).Value;
                subscriptionLine.Price = productPriceDto.UnitRegularPrice;
                subscription.SubscriptionLines.Add(subscriptionLine);
                //if (subscription.IncludeInInitialOrder)
                //{
                //    OrderLine orderLine1 = new OrderLine()
                //    {
                //        Description = subscriptionLine.Product.ErpDescription,
                //        UnitListPrice = productPriceDto.UnitListPrice,
                //        UnitRegularPrice = productPriceDto.UnitRegularPrice,
                //        UnitNetPrice = subscription.FixedPrice ? subscriptionLine.Price : productPriceDto.UnitNetPrice
                //    };
                //    this.orderLineUtilities.SetProduct(orderLine1, subscriptionLine.Product);
                //    this.orderLineUtilities.SetQtyOrdered(orderLine1, subscriptionLine.QtyOrdered);
                //    PipelineHelper.VerifyResults((PipeResultBase)this.cartPipeline.AddCartLine(new Insite.Cart.Services.Pipelines.Parameters.AddCartLineParameter()
                //    {
                //        Cart = customerOrder,
                //        CartLine = orderLine1
                //    }));
                //}
            }
            if (!subscription.IncludeInInitialOrder)
            {
                return;
            }
            subscription.CustomerOrders.Add(customerOrder);
        }
示例#13
0
        private void dockerInstallDatabaseContainerButton_Click(object sender, EventArgs e)
        {
            Program.ShowConsole();
            Console.Clear();

            PrintHeader("Creating database container");

            int localPort = Parameter.DEFAULT_DATABASE_SERVER_STARTING_PORT;

            Console.WriteLine($"Enter the starting number of local ports you wish to use (default is {Parameter.DEFAULT_DATABASE_SERVER_STARTING_PORT}): ");
            int.TryParse(Console.ReadLine(), out localPort);

            Console.WriteLine("Select your database login name: ");
            string dbALogin = Console.ReadLine();

            Console.WriteLine("Select your database password (preferably a hard password with 8 or more characters including special ones): ");
            string dbAPassword = Console.ReadLine();

            Dictionary <string, string> replacingTemplateFields
                = new Dictionary <string, string>()
                {
                { "__versioning_folder__", $"/{NetworkObjectParameters.FetchServerVersioningFolder}/" },
                { "__game_patches_folder__", $"/{NetworkObjectParameters.FetchServerPatchesFolder}" },
                { "__container_name__", Parameter.DEFAULT_DATABASE_SERVER_CONTAINER_NAME },
                { "__volume_name__", Parameter.DEFAULT_DATABASE_SERVER_VOLUME_NAME },
                { "__local_port__", localPort.ToString() },
                { "__container_port__", Parameter.DEFAULT_DATABASE_SERVER_CONTAINER_PORT.ToString() },
                { "__context__", Parameter.DEFAULT_DATABASE_SERVER_CONTEXT },
                { "__dockerfile_path__", Parameter.DEFAULT_DATABASE_SERVER_DOCKERFILE_PATH },
                { "__db_password__", Parameter.DEFAULT_DATABASE_SERVER_PASSWORD },
                { "__db_sql_pid__", Parameter.DEFAULT_DATABASE_SERVER_PID },
                { "__db_sql_admin_login__", dbALogin },
                { "__db_sql_admin_password__", dbAPassword },
                };

            string templatePath = Directory.GetCurrentDirectory() + @"\DockerTemplates\OpenBound Database";

            List <string> files = PipelineHelper.GenerateTemplateFiles(templatePath, templatePath, replacingTemplateFields, "*.Template.Dockerfile").ToList();

            files.AddRange(PipelineHelper.GenerateTemplateFiles(templatePath, templatePath, replacingTemplateFields, "*.Template.yml").ToList());
            files.AddRange(PipelineHelper.GenerateTemplateFiles(templatePath, templatePath, replacingTemplateFields, "*.Template.sql").ToList());

            PipelineHelper.ExecuteShellCommand($"docker-compose -p=openbound -f \".\\DockerTemplates\\OpenBound Database\\OpenBoundDatabase.yml\" up -d {Parameter.DEFAULT_DATABASE_SERVER_CONTAINER_NAME}");

            Console.WriteLine("Waiting 10s for the container to boot up. If your PC is too slow the following scripts might fail.");
            Thread.Sleep(10000);


            PipelineHelper.ExecuteShellCommand($"docker cp \"{files.Find((x) => x.Contains(".sql"))}\" \"{Parameter.DEFAULT_DATABASE_SERVER_CONTAINER_NAME}:/OpenBoundDatabase.sql\"");
            PipelineHelper.ExecuteShellCommand($"docker exec -it {Parameter.DEFAULT_DATABASE_SERVER_CONTAINER_NAME} /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P \"{Parameter.DEFAULT_DATABASE_SERVER_PASSWORD}\" -i \"/OpenBoundDatabase.sql\"");
            PipelineHelper.ExecuteShellCommand($"docker exec -it {Parameter.DEFAULT_DATABASE_SERVER_CONTAINER_NAME} rm /OpenBoundDatabase.sql");

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();

            Program.HideConsole();
        }
示例#14
0
 internal ForEachOrderedTask(ForEachOrderedTask <S, T> parent, Spliterator <S> spliterator, ForEachOrderedTask <S, T> leftPredecessor) : base(parent)
 {
     this.Helper          = parent.Helper;
     this.Spliterator     = spliterator;
     this.TargetSize      = parent.TargetSize;
     this.CompletionMap   = parent.CompletionMap;
     this.Action          = parent.Action;
     this.LeftPredecessor = leftPredecessor;
 }
示例#15
0
			public override Boolean evaluateParallel<S>(PipelineHelper<T> helper, Spliterator<S> spliterator)
			{
				// Approach for parallel implementation:
				// - Decompose as per usual
				// - run match on leaf chunks, call result "b"
				// - if b == matchKind.shortCircuitOn, complete early and return b
				// - else if we complete normally, return !shortCircuitOn

				return (new MatchTask<>(this, helper, spliterator)).invoke();
			}
 public TypeResolver(IHostnameMappingService hostnameMappingService,
                     IMessageItemSourceFactory messageItemSourceFactory,
                     IManagerRootService managerRootService,
                     IMultiVariateTestStrategyFactory multiVariateTestStrategyFactory,
                     IAbnTestService abnTestService,
                     PipelineHelper pipelineHelper) : base(hostnameMappingService, messageItemSourceFactory, managerRootService, multiVariateTestStrategyFactory, abnTestService, pipelineHelper)
 {
     _messageItemSourceFactory = messageItemSourceFactory;
     _managerRootService       = managerRootService;
 }
        public void Process(UploadArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            if (args.Destination == UploadDestination.File)
            {
                var helper = new PipelineHelper();
                helper.StartMediaProcessorJob(args.UploadedItems, PipelineHelper.GetContainerNameFromArgs(args));
            }
        }
示例#18
0
 protected internal ForEachOrderedTask(PipelineHelper <T> helper, Spliterator <S> spliterator, Sink <T> action) : base(null)
 {
     this.Helper      = helper;
     this.Spliterator = spliterator;
     this.TargetSize  = AbstractTask.SuggestTargetSize(spliterator.EstimateSize());
     // Size map to avoid concurrent re-sizes
     this.CompletionMap   = new ConcurrentDictionary <>(System.Math.Max(16, AbstractTask.LEAF_TARGET << 1));
     this.Action          = action;
     this.LeftPredecessor = null;
 }
示例#19
0
        public static bool Exists(string path, bool isLiteral)
        {
            // need to check if we should resolve wildcards
            var pathArg = new CommandArgument
            {
                Name  = (isLiteral) ? "LiteralPath" : "Path",
                Value = path
            };

            // best way to check paths in a static context
            return(PipelineHelper.ExecuteScalar <bool>(
                       new Command(@"Microsoft.PowerShell.Management\Test-Path"), pathArg));
        }
        public virtual IDictionary <Guid, ProductPriceDto> GetPricingServiceResult(IEnumerable <OrderLine> orderLines)
        {
            GetProductPricingResult productPricing = this.pricingPipeline.GetProductPricing(new GetProductPricingParameter(true)
            {
                PricingServiceParameters = orderLines.ToDictionary(o => o.Id, o => new PricingServiceParameter(o.ProductId)
                {
                    OrderLine       = o,
                    CustomerOrderId = o.CustomerOrderId
                })
            });

            PipelineHelper.VerifyResults((PipeResultBase)productPricing);
            return(productPricing.ProductPriceDtos);
        }
        /// <summary>
        /// Deletes media from Cloud storage that was previously associated with item
        /// </summary>
        /// <param name="args"></param>
        public void Process(AttachArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            if (!args.MediaItem.FileBased)
            {
                return;
            }

            _logManager.LogAudit("Deleting '{0}' from Cloud storage".FormatWith(args.MediaItem.FilePath), GetType());

            PipelineHelper.AddContainerNameToArgs(args, GetContainerNameFromFilePath(args.MediaItem.FilePath));
            _cloudStorage.Delete(args.MediaItem);
        }
        public void Process(AttachArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            if (!args.MediaItem.FileBased)
            {
                return;
            }

            var helper = new PipelineHelper();

            helper.StartMediaProcessorJob(new List <Item> {
                args.MediaItem
            });
        }
        public override void ClearPromotionResult(CustomerOrder customerOrder)
        {
            //4.2 Code
            //customerOrder.OrderLines.Where<OrderLine>((Func<OrderLine, bool>)(o =>
            //{
            //    PromotionResult promotionResult = o.PromotionResult;
            //    Guid? nullable = promotionResult != null ? new Guid?(promotionResult.Id) : new Guid?();
            //    Guid id = this.PromotionResult.Id;
            //    if (!nullable.HasValue)
            //        return false;
            //    if (!nullable.HasValue)
            //        return true;
            //    return nullable.GetValueOrDefault() == id;
            //})).ToList<OrderLine>().ForEach((Action<OrderLine>)(orderLine =>
            //{
            //    // BUSA-683 : Volume Discount Promotion - Issue when user cart qualifies add free product promotion &volume discount group.
            //    this.UnitOfWork.Save();
            //    var id = this.UnitOfWork.GetRepository<OrderLine>().GetTable().Where(x => x.Id == orderLine.Id).Count();
            //    if (id > 0)
            //    {
            //        this.CustomerOrderUtilities.RemoveOrderLine(customerOrder, orderLine);
            //    }
            //}));

            foreach (OrderLine orderLine in customerOrder.OrderLines.Where <OrderLine>((Func <OrderLine, bool>)(o =>
            {
                PromotionResult promotionResult = o.PromotionResult;
                Guid?nullable = promotionResult != null ? new Guid?(promotionResult.Id) : new Guid?();
                Guid id = this.PromotionResult.Id;
                if (!nullable.HasValue)
                {
                    return(false);
                }
                if (!nullable.HasValue)
                {
                    return(true);
                }
                return(nullable.GetValueOrDefault() == id);
            })).ToList <OrderLine>())
            {
                PipelineHelper.VerifyResults((PipeResultBase)this.CartPipeline.RemoveCartLine(new Insite.Cart.Services.Pipelines.Parameters.RemoveCartLineParameter()
                {
                    Cart     = customerOrder,
                    CartLine = orderLine
                }));
            }
        }
示例#24
0
        public override Task ExecuteAsync()
        {
            IEnumerable <(string Tag, string Platform)> platformTags;

            if (string.IsNullOrEmpty(Options.ImageInfoPath))
            {
                platformTags = Manifest.GetFilteredPlatforms()
                               .Where(platform => platform.Tags.Any())
                               .Select(platform => (platform.Tags.First().FullyQualifiedName, platform.PlatformLabel));
            }
            else
            {
                // We want to apply manifest filtering to the loading of the image info file. This allows, for example,
                // only images of a specific architecture to be pulled.
                ImageArtifactDetails imageArtifactDetails = ImageInfoHelper.LoadFromFile(
                    Options.ImageInfoPath, Manifest, skipManifestValidation: true, useFilteredManifest: true);
                platformTags = imageArtifactDetails.Repos
                               .SelectMany(repo => repo.Images)
                               .SelectMany(image => image.Platforms)
                               // If the platform doesn't have an associated manifest instance, it means the manifest filter
                               // options had filtered out the platform. In that case, it doesn't apply and shouldn't be pulled.
                               .Where(platform => platform.PlatformInfo is not null && platform.SimpleTags.Any())
                               .Select(platform => (
                                           TagInfo.GetFullyQualifiedName(platform.PlatformInfo !.FullRepoModelName, platform.SimpleTags.First()),
                                           platform.PlatformInfo !.PlatformLabel));
            }

            platformTags = platformTags
                           .Distinct()
                           .ToList();

            _loggerService.WriteHeading("PULLING IMAGES");
            foreach ((string tag, string platform) in platformTags)
            {
                _dockerService.PullImage(tag, platform, Options.IsDryRun);
            }

            if (Options.OutputVariableName is not null)
            {
                _loggerService.WriteMessage(
                    PipelineHelper.FormatOutputVariable(
                        Options.OutputVariableName,
                        string.Join(',', platformTags.Select(platformTag => platformTag.Tag))));
            }

            return(Task.CompletedTask);
        }
示例#25
0
        private List <string> GetCreatedContainerNames()
        {
            HashSet <string> containerNames = new HashSet <string>();
            string           containerList  = PipelineHelper.ExecuteShellCommand(@$ "docker container ls");

            Regex rx = new Regex(@$ "\b{Parameter.DEFAULT_FETCH_SERVER_CONTAINER_NAME}\b",
                                 RegexOptions.Compiled | RegexOptions.IgnoreCase);

            MatchCollection matches = rx.Matches(containerList);

            foreach (Match m in matches)
            {
                containerNames.Add(m.Value);
            }

            return(containerNames.ToList());
        }
示例#26
0
        private static string GetProcessor(string name, string importerName)
        {
            var tp = PipelineHelper.GetImporterType(System.IO.Path.GetExtension(name), importerName);

            if (tp != null)
            {
                foreach (var attr in tp.GetCustomAttributes(true).Select(x => x as engenious.Content.Pipeline.ContentImporterAttribute))
                {
                    if (attr == null)
                    {
                        continue;
                    }
                    return(attr.DefaultProcessor);
                }
            }
            return("");
        }
示例#27
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pscxPath"></param>
        /// <param name="pathType"></param>
        /// <returns></returns>
        public static bool Exists(PscxPathInfo pscxPath, ref PscxPathType pathType)
        {
            string qualifiedPath = pscxPath.ToString();

            pathType = PscxPathType.Unknown;
            string pathArg = (pscxPath.IsUnresolved) ? "LiteralPath" : "Path";

            if (Exists(pscxPath))
            {
                bool isLeaf = PipelineHelper.ExecuteScalar <bool>(
                    new Command("Test-Path"),
                    new CommandArgument()
                {
                    Name = pathArg, Value = qualifiedPath
                },
                    new CommandArgument()
                {
                    Name = "PathType", Value = "Leaf"
                });

                if (isLeaf)
                {
                    pathType = PscxPathType.Leaf;
                }
                else
                {
                    bool isContainer = PipelineHelper.ExecuteScalar <bool>(
                        new Command("Test-Path"),
                        new CommandArgument()
                    {
                        Name = pathArg, Value = qualifiedPath
                    },
                        new CommandArgument()
                    {
                        Name = "PathType", Value = "Container"
                    });

                    if (isContainer)
                    {
                        pathType = PscxPathType.Container;
                    }
                }
                return(true);
            }
            return(false);
        }
 private static void EmitVstsVariables(IEnumerable <BuildMatrixInfo> matrices)
 {
     // Emit the special syntax to set a VSTS build definition matrix variable
     // ##vso[task.setvariable variable=x;isoutput=true]{ \"a\": { \"v1\": \"1\" }, \"b\": { \"v1\": \"2\" } }
     foreach (BuildMatrixInfo matrix in matrices)
     {
         string legs = matrix.OrderedLegs
                       .Select(leg =>
         {
             string variables = leg.Variables
                                .Select(var => $" \"{var.Name}\": \"{var.Value}\"")
                                .Aggregate((working, next) => $"{working},{next}");
             return($" \"{leg.Name}\": {{{variables} }}");
         })
                       .Aggregate((working, next) => $"{working},{next}");
         Logger.WriteMessage(PipelineHelper.FormatOutputVariable(matrix.Name, $"{{{legs}}}"));
     }
 }
        public void Process(UploadArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            if (args.Destination != UploadDestination.Database)
            {
                return;
            }

            var containerName = GetContainerName(args.Folder);

            if (string.IsNullOrEmpty(containerName))
            {
                return;
            }

            args.Destination = UploadDestination.File;
            PipelineHelper.AddContainerNameToArgs(args, containerName);
        }
示例#30
0
        private void DockerInstallFetchServerContainersButton_Click(object sender, EventArgs e)
        {
            Program.ShowConsole();
            Console.Clear();

            PrintHeader("Creating fetch server container");

            int    containerPort = Parameter.DEFAULT_FETCH_SERVER_CONTAINER_PORT;
            int    localPort     = Parameter.DEFAULT_FETCH_SERVER_STARTING_PORT;
            string containerName = Parameter.DEFAULT_FETCH_SERVER_CONTAINER_NAME;
            string volumeName    = Parameter.DEFAULT_FETCH_SERVER_VOLUME_NAME;

            Console.WriteLine($"Enter the starting number of local ports you wish to use (default is {localPort}): ");
            int.TryParse(Console.ReadLine(), out localPort);

            Dictionary <string, string> replacingTemplateFields
                = new Dictionary <string, string>()
                {
                { "__versioning_folder__", $"/{NetworkObjectParameters.FetchServerVersioningFolder}/" },
                { "__game_patches_folder__", $"/{NetworkObjectParameters.FetchServerPatchesFolder}" },
                { "__container_name__", containerName },
                { "__volume_name__", volumeName },
                { "__local_port__", localPort.ToString() },
                { "__container_port__", containerPort.ToString() },
                { "__context__", Parameter.DEFAULT_FETCH_SERVER_CONTEXT },
                { "__dockerfile_path__", Parameter.DEFAULT_FETCH_SERVER_DOCKERFILE_PATH }
                };

            string templatePath = Directory.GetCurrentDirectory() + @"\DockerTemplates\FetchServer";

            List <string> files = PipelineHelper.GenerateTemplateFiles(templatePath, templatePath, replacingTemplateFields, "*.Template.Dockerfile").ToList();

            files.AddRange(PipelineHelper.GenerateTemplateFiles(templatePath, templatePath, replacingTemplateFields, "*.Template.yml").ToList());
            files.AddRange(PipelineHelper.GenerateTemplateFiles(templatePath, templatePath, replacingTemplateFields, "*.Template.conf").ToList());

            PipelineHelper.ExecuteShellCommand(@$ "docker-compose -p=openbound -f .\DockerTemplates\FetchServer\OpenBoundFetchServer.yml build");
            PipelineHelper.ExecuteShellCommand(@$ "docker-compose -p openbound -f .\DockerTemplates\FetchServer\OpenBoundFetchServer.yml up -d {containerName}");

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();

            Program.HideConsole();
        }