private static ArrayList CreateSeparatedSite( String site )
{
ArrayList list = new ArrayList();
if (site == null || site.Length == 0)
{
throw new ArgumentException( Environment.GetResourceString("Argument_InvalidSite" ));
}
int braIndex = -1;
int ketIndex = -1;
braIndex = site.IndexOf('[');
if (braIndex == 0)
ketIndex = site.IndexOf(']', braIndex+1);
if (ketIndex != -1)
{
// Found an IPv6 address. Special case that
String ipv6Addr = site.Substring(braIndex+1, ketIndex-braIndex-1);
list.Add(ipv6Addr);
return list;
}
// Regular hostnames or IPv4 addresses
// We dont need to do this for IPv4 addresses, but it's easier to do it anyway
String[] separatedArray = site.Split( m_separators );
for (int index = separatedArray.Length-1; index > -1; --index)
{
if (separatedArray[index] == null)
{
throw new ArgumentException( Environment.GetResourceString("Argument_InvalidSite" ));
}
else if (separatedArray[index].Equals( "" ))
{
if (index != separatedArray.Length-1)
{
throw new ArgumentException( Environment.GetResourceString("Argument_InvalidSite" ));
}
}
else if (separatedArray[index].Equals( "*" ))
{
if (index != 0)
{
throw new ArgumentException( Environment.GetResourceString("Argument_InvalidSite" ));
}
list.Add( separatedArray[index] );
}
else if (!AllLegalCharacters( separatedArray[index] ))
{
throw new ArgumentException( Environment.GetResourceString("Argument_InvalidSite" ));
}
else
{
list.Add( separatedArray[index] );
}
}
return list;
}