|
//=============================================================================
// System : Sandcastle Help File Builder Utilities
// File : XmlCommentsFileCollection.cs
// Author : Eric Woodruff
// Updated : 09/29/2006
// Note : Copyright 2006, Eric Woodruff, All rights reserved
// Compiler: Microsoft Visual C#
//
// This file contains a collection class used to hold the XML comments files
//
// This code may be used in compiled form in any way you desire. This file
// may be redistributed unmodified by any means PROVIDING it is not sold for
// profit without the author's written consent, and providing that this notice
// and the author's name and all copyright notices remain intact.
//
// This code is provided "as is" with no warranty either express or implied.
// The author accepts no liability for any damage or loss of business that
// this product may cause.
//
// Version Date Who Comments
// ============================================================================
// 1.3.1.0 09/26/2006 EFW Created the code
//=============================================================================
using System;
using System.Globalization;
using System.ComponentModel;
using System.Xml;
using SandcastleBuilder.Utils.Design;
namespace SandcastleBuilder.Utils
{
/// <summary>
/// This collection class is used to hold the XML comments files
/// during the build process.
/// </summary>
public class XmlCommentsFileCollection : BindingList<XmlCommentsFile>
{
/// <summary>
/// Save the comments files
/// </summary>
public void Save()
{
foreach(XmlCommentsFile file in this)
file.Save();
}
/// <summary>
/// Search all comments files for the specified member. If not found,
/// add the blank member to the first file.
/// </summary>
/// <param name="memberName">The member name for which to search.</param>
/// <returns>The XML node of the found or added member</returns>
public XmlNode FindMember(string memberName)
{
XmlDocument doc;
XmlNode member = null;
XmlAttribute name;
string xPathQuery = String.Format(CultureInfo.InvariantCulture,
"//members/member[@name='{0}']", memberName);
foreach(XmlCommentsFile f in this)
{
member = f.Comments.SelectSingleNode(xPathQuery);
if(member != null)
break;
}
// If not found at all, add an entry for it to the first file
if(member == null)
{
doc = this[0].Comments;
member = doc.CreateNode(XmlNodeType.Element, "member", null);
name = doc.CreateAttribute("name");
name.Value = memberName;
member.Attributes.Append(name);
this[0].Members.AppendChild(member);
}
return member;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Eric Woodruff is an Analyst/Programmer for Spokane County, Washington where he helps develop and support various applications, mainly criminal justice systems, using Windows Forms (C#) and SQL Server as well as some ASP.NET applications.
He is also the author of various open source projects for .NET including:
The Sandcastle Help File Builder - A front end and project management system that lets you build help file projects using Microsoft's Sandcastle documentation tools. It includes a standalone GUI and a package for Visual Studio integration.
Visual Studio Spell Checker - A Visual Studio editor extension that checks the spelling of comments, strings, and plain text as you type or interactively with a tool window. This can be installed via the
Visual Studio Gallery.
Image Map Controls - Windows Forms and web server controls that implement image maps.
PDI Library - A complete set of classes that let you have access to all objects, properties, parameter types, and data types as defined by the vCard (RFC 2426), vCalendar, and iCalendar (RFC 2445) specifications. A recurrence engine is also provided that allows you to easily and reliably calculate occurrence dates and times for even the most complex recurrence patterns.
Windows Forms List Controls - A set of extended .NET Windows Forms list controls. The controls include an auto-complete combo box, a multi-column combo box, a user control dropdown combo box, a radio button list, a check box list, a data navigator control, and a data list control (similar in nature to a continuous details section in Microsoft Access or the DataRepeater from VB6).
For more information see
http://www.EWoodruff.us