public GetDisplayPath ( int maxLength, char seperator ) : string | ||
maxLength | int | |
seperator | char | |
return | string |
public string GetDisplayPath(int maxLength, char seperator)
{
string name = GetNonNullText(this);
if (m_parent == null)
{
return name;
}
StringBuilder buffer = new StringBuilder();
if (maxLength > 2)
{
NodeState parent = m_parent;
List<string> names = new List<string>();
while (parent != null)
{
BaseInstanceState instance = parent as BaseInstanceState;
if (instance == null)
{
break;
}
parent = instance.Parent;
string parentName = GetNonNullText(parent);
names.Add(parentName);
if (names.Count == maxLength-2)
{
break;
}
}
for (int ii = names.Count-1; ii >= 0; ii--)
{
buffer.Append(names[ii]);
buffer.Append(seperator);
}
}
buffer.Append(GetNonNullText(m_parent));
buffer.Append(seperator);
buffer.Append(name);
return buffer.ToString();
}
BaseInstanceState::GetDisplayPath ( ) : string |