public virtual bool IsSubsetOf( SiteString operand, bool ignoreCase )
{
StringComparison strComp = (ignoreCase? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
if (operand == null)
{
return false;
}
else if (this.m_separatedSite.Count == operand.m_separatedSite.Count &&
this.m_separatedSite.Count == 0)
{
return true;
}
else if (this.m_separatedSite.Count < operand.m_separatedSite.Count - 1)
{
return false;
}
else if (this.m_separatedSite.Count > operand.m_separatedSite.Count &&
operand.m_separatedSite.Count > 0 &&
!operand.m_separatedSite[operand.m_separatedSite.Count-1].Equals( "*" ))
{
return false;
}
else if (String.Compare( this.m_site, operand.m_site, strComp) == 0)
{
return true;
}
for (int index = 0; index < operand.m_separatedSite.Count - 1; ++index)
{
if (String.Compare( (String)this.m_separatedSite[index], (String)operand.m_separatedSite[index], strComp) != 0 )
{
return false;
}
}
if (this.m_separatedSite.Count < operand.m_separatedSite.Count)
{
return operand.m_separatedSite[operand.m_separatedSite.Count-1].Equals( "*" );
}
else if (this.m_separatedSite.Count == operand.m_separatedSite.Count)
{
// last item must be the same or operand must have a * in its last item
return (String.Compare( (String)this.m_separatedSite[this.m_separatedSite.Count-1],
(String)operand.m_separatedSite[this.m_separatedSite.Count-1],
strComp ) == 0 ||
operand.m_separatedSite[operand.m_separatedSite.Count-1].Equals( "*" ));
}
else
return true;
}