/// <summary>
/// The DisplayName of the extension node will be the computer name
/// published by the primary. Note: this defaults to an empty string for localhost.
/// </summary>
void SetDisplayName(ScopeNode scopeNode, SharedDataItem sharedDataItem)
{
// get buffer containing the machine name
string machineName = Encoding.Unicode.GetString(sharedDataItem.GetData());
// find first null terminated string in buffer.
if (machineName.IndexOf('\0') <= 0)
{
// either not found in buffer or first entry in buffer
machineName = String.Empty;
}
else
{
machineName = machineName.Substring(0, machineName.IndexOf('\0'));
}
// if empty then localhost
if (machineName == string.Empty)
{
scopeNode.DisplayName = "Sample Extension to (localhost)";
}
else
{
scopeNode.DisplayName = "Sample Extension to (" + machineName + ")";
}
}