Exemplo n.º 1
0
        /// <summary>
        /// Pulishes all relevant documents matching the target folder branch
        /// </summary>
        /// <param name="TargetFolderBranch">Filter of the target branch applied to documents that are published.</param>
        public void Publish(string FilterFolderBranch)
        {
            if (FilterFolderBranch == null)
            {
                FilterFolderBranch = "";
            }

            // build the target root folder
            string FilterFolderPath = BuildPath(this.TargetRootFolder, FilterFolderBranch);

            DocumentFile.AssertFolderExists(FilterFolderPath);

            // get file info under the target root
            this.FileInfoStore = GetFileInfoStoreFromPath(FilterFolderPath, true);

            // get target folders to publish
            string[] TargetFolderBranches = AppContext.Documents
                                            .Where(d => d.IgnoreFlag == Document.FALSE_FLAG_VALUE &&
                                                   d.TargetFolderBranch.StartsWith(FilterFolderBranch))
                                            .Select(b => b.TargetFolderBranch)
                                            .Distinct()
                                            .ToArray <string>();

            string TargetFolderPath = null;

            // loop through folders
            foreach (string TargetFolderBranch in TargetFolderBranches)
            {
                TargetFolderPath = BuildPath(this.TargetRootFolder, TargetFolderBranch);
                PublishFolder(TargetFolderPath, TargetFolderBranch);
            }
        }