private ChildNode CreateChildNode(ISystemContext context, BaseInstanceState state)
{
ChildNode node = new ChildNode();
node.NodeClass = state.NodeClass;
node.BrowseName = state.BrowseName;
BaseVariableState variable = state as BaseVariableState;
if (variable != null)
{
if (!StatusCode.IsBad(variable.StatusCode))
{
node.Value = Utils.Clone(variable.Value);
}
}
BaseObjectState instance = state as BaseObjectState;
if (instance != null)
{
node.Value = instance.NodeId;
}
node.Children = CreateChildNodes(context, state);
return node;
}