예제 #1
0
        //=====================================================================

        /// <summary>
        /// Add a new item to the collection
        /// </summary>
        /// <param name="filename">The filename to add</param>
        /// <param name="config">The configuration to use for projects</param>
        /// <param name="platform">The platform to use for projects</param>
        /// <param name="subFolders">True to include subfolders, false to
        /// only search the top-level folder.</param>
        /// <returns>The <see cref="DocumentationSource" /> added to the
        /// project or the existing item if the filename already exists in the
        /// collection.</returns>
        /// <remarks>The <see cref="DocumentationSource" /> constructor is
        /// internal so that we control creation of the items and can
        /// associate them with the project.</remarks>
        public DocumentationSource Add(string filename, string config,
                                       string platform, bool subFolders)
        {
            DocumentationSource item;

            // Make the path relative to the project if possible
            if (Path.IsPathRooted(filename))
            {
                filename = FilePath.AbsoluteToRelativePath(projectFile.BasePath,
                                                           filename);
            }

            item = new DocumentationSource(filename, config, platform,
                                           subFolders, projectFile);

            if (!base.Contains(item))
            {
                base.Add(item);
            }
            else
            {
                item = base[base.IndexOf(item)];
            }

            return(item);
        }