public HResult GetProperty(int property, out object value)
{
value = null;
try
{
switch ((NiHierarchyProperty)property)
{
case NiHierarchyProperty.FirstChild:
var first = _children.First;
if (first != null)
{
value = first.Value;
return HResult.OK;
}
return HResult.False;
case NiHierarchyProperty.NextSibling:
if (_position != null)
{
var next = _position.Next;
if (next != null)
{
value = next.Value;
return HResult.OK;
}
}
return HResult.False;
case NiHierarchyProperty.Parent:
if (_parent != null)
{
value = _parent;
return HResult.OK;
}
return HResult.False;
case NiHierarchyProperty.SortPriority:
if (_sortPriority.HasValue)
{
value = _sortPriority;
return HResult.OK;
}
return HResult.False;
case NiHierarchyProperty.Name:
if (_name != null)
{
value = _name;
return HResult.OK;
}
return HResult.False;
case NiHierarchyProperty.ContainingProject:
value = GetRoot() as INiProject;
return HResult.OK;
case NiHierarchyProperty.Root:
value = GetRoot();
return HResult.OK;
default:
if (_properties.TryGetValue(property, out value))
return HResult.OK;
return HResult.False;
}
}
catch (Exception ex)
{
return ErrorUtil.GetHResult(ex);
}
}