Ejemplo n.º 1
0
 public void NotifyFound(FileItem[] files)
 {
     foreach (FileItem fileItem in files)
     {
         _files.Add(fileItem);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// This method can be used by plug-ins to merge content from another Sandcastle Help File Builder
        /// project file.
        /// </summary>
        /// <param name="project">The project file from which to merge content</param>
        /// <remarks>Auto-generated content can be added to a temporary SHFB project and then added to the
        /// current project's content at build time using this method.  Such content cannot always be added to
        /// the project being built as it may alter the underlying MSBuild project which is not wanted.</remarks>
        public void MergeContentFrom(SandcastleProject project)
        {
            var otherImageFiles         = new ImageReferenceCollection(project);
            var otherCodeSnippetFiles   = new FileItemCollection(project, BuildAction.CodeSnippets);
            var otherTokenFiles         = new FileItemCollection(project, BuildAction.Tokens);
            var otherContentLayoutFiles = new FileItemCollection(project, BuildAction.ContentLayout);

            foreach (var image in otherImageFiles)
            {
                imageFiles.Add(image);
            }

            foreach (var snippets in otherCodeSnippetFiles)
            {
                codeSnippetFiles.Add(snippets);
            }

            foreach (var tokens in otherTokenFiles)
            {
                tokenFiles.Add(tokens);
            }

            foreach (FileItem file in otherContentLayoutFiles)
            {
                topics.Add(new TopicCollection(file));
            }
        }
Ejemplo n.º 3
0
    public void GenerateUniqueFileList()
    {
      FileItemCollection copy = new FileItemCollection();
      foreach (FileItem item in UniqueFileList.Items)
        copy.Add(item);
      UniqueFileList.Items.Clear();
      foreach (GroupItem groupItem in Groups.Items)
      {
        foreach (FileItem fileItem in groupItem.Files.Items)
        {
          if (!UniqueFileList.ExistLocalFileName(fileItem))
            UniqueFileList.Add(new FileItem(fileItem));
        }
      }

      foreach (SectionItem sectionItem in Sections.Items)
      {
        foreach (SectionParam sectionParam in sectionItem.Params.Items)
        {
          if (sectionParam.ValueType == ValueTypeEnum.File && !string.IsNullOrEmpty(sectionParam.Value))
          {
            if (!UniqueFileList.ExistLocalFileName(sectionParam.Value))
            {
              FileItem existingItem = copy.GetByLocalFileName(sectionParam.Value);
              if (existingItem != null)
                UniqueFileList.Add(existingItem);
              else
                UniqueFileList.Add(new FileItem(sectionParam.Value, true));
            }
            else
              UniqueFileList.GetByLocalFileName(sectionParam.Value).SystemFile = true;
          }
        }
        foreach (ActionItem actionItem in sectionItem.Actions.Items)
        {
          foreach (SectionParam sectionParam in actionItem.Params.Items)
          {
            if (sectionParam.ValueType == ValueTypeEnum.File && !string.IsNullOrEmpty(sectionParam.Value))
            {
              if (!UniqueFileList.ExistLocalFileName(sectionParam.Value))
              {
                FileItem existingItem = copy.GetByLocalFileName(sectionParam.Value);
                if (existingItem != null)
                  UniqueFileList.Add(existingItem);
                else
                  UniqueFileList.Add(new FileItem(sectionParam.Value, true));
              }
              else
                UniqueFileList.GetByLocalFileName(sectionParam.Value).SystemFile = true;
            }
          }
        }
      }

      foreach (SectionParam sectionParam in GeneralInfo.Params.Items)
      {
        if (sectionParam.ValueType == ValueTypeEnum.File && !string.IsNullOrEmpty(sectionParam.Value))
        {
          if (!UniqueFileList.ExistLocalFileName(sectionParam.Value))
          {
            FileItem existingItem = copy.GetByLocalFileName(sectionParam.Value);
            if (existingItem != null)
              UniqueFileList.Add(existingItem);
            else
              UniqueFileList.Add(new FileItem(sectionParam.Value, true));
          }
          else
            UniqueFileList.GetByLocalFileName(sectionParam.Value).SystemFile = true;
        }
      }
    }