|
/***************************************************************************
Word2CHM
Copyright (c) 2010 sinosoft , written by yuans.
http://www.sinoreport.net
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
****************************************************************************/
using System;
namespace Word2CHM.CHMDom
{
/// <summary>
/// CHM document node
/// </summary>
[Serializable()]
public class CHMNode
{
/// <summary>
/// Initialize
/// </summary>
public CHMNode()
{
myNodes.OwnerNode = this;
}
private CHMNode myParent = null;
[System.ComponentModel.Browsable( false )]
[System.Xml.Serialization.XmlIgnore()]
public virtual CHMNode Parent
{
get
{
return myParent;
}
set
{
myParent = value;
}
}
[System.ComponentModel.Browsable( false )]
public int Index
{
get
{
if (myParent != null)
return myParent.Nodes.IndexOf(this);
else
return 0;
}
}
/// <summary>
/// Level in document tree,root node's level is 1
/// </summary>
[System.ComponentModel.Browsable(false)]
public int Level
{
get
{
int level = 0;
CHMNode node = this ;
while (node != null)
{
level++;
node = node.Parent;
}
return level;
}
}
private string strName = null;
/// <summary>
/// name
/// </summary>
public string Name
{
get{ return strName ;}
set{ strName = value;}
}
private string strImageNumber = null ;
/// <summary>
/// image number
/// </summary>
public string ImageNumber
{
get
{
return strImageNumber ;
}
set
{
strImageNumber = value;
}
}
private string strLocal = null;
/// <summary>
/// referenced html file
/// </summary>
public string Local
{
get
{
return strLocal ;
}
set
{
strLocal = value;
}
}
private CHMNodeList myNodes = new CHMNodeList();
/// <summary>
/// child nodes
/// </summary>
[System.Xml.Serialization.XmlArray()]
[System.Xml.Serialization.XmlArrayItem( "Node" , typeof( CHMNode ))]
[System.ComponentModel.Browsable( false )]
public CHMNodeList Nodes
{
get
{
return myNodes ;
}
set
{
myNodes = value;
if (myNodes != null)
{
myNodes.OwnerNode = this;
foreach (CHMNode node in myNodes)
{
node.Parent = this;
}
}
}
}
public override string ToString()
{
return strName + ":" + strLocal;
}
}//public class CHMNode
}
|
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.