Ejemplo n.º 1
0
        /// <summary>
        /// Generates the package
        /// </summary>
        /// <param name="args">The arguments.</param>
        public void Process(GeneratePackagePipelineArgs args)
        {
            if (!args.PackageItems.Any())
            {
                return;
            }

            args.DownloadPath = this.packageGenerationService.GeneratePackage(args.PackageItems, args.PackageName, args.PackageAuthor);
        }
        /// <summary>
        /// Adds the item with children recursively.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="args">The arguments.</param>
        public void AddItemWithChildren(Item item, GeneratePackagePipelineArgs args)
        {
            if (!args.PackageItems.Contains(item.Uri))
            {
                args.PackageItems.Add(item.Uri);
            }

            foreach (Item child in item.GetChildren())
            {
                this.AddItemWithChildren(child, args);
            }
        }
        /// <summary>
        /// Generates the package
        /// </summary>
        /// <param name="args">The arguments.</param>
        public void Process(GeneratePackagePipelineArgs args)
        {
            var tracking = this.trackingService.GetTrackingData();

            foreach (var trackingItem in tracking.Items)
            {
                var itemUri = new ItemUri(trackingItem.Uri);
                if (!trackingItem.WithSubItems)
                {
                    if (!args.PackageItems.Contains(itemUri))
                    {
                        args.PackageItems.Add(itemUri);
                    }

                    continue;
                }

                // load item and iterate through all children
                var item = Factory.GetDatabase(itemUri.DatabaseName).GetItem(itemUri.ItemID);
                this.AddItemWithChildren(item, args);
            }
        }