public bool Load(ref object fieldValue, ConfigNode node, OperationContext context) { node.ThrowIfNullArgument(nameof(node)); context.ThrowIfNullArgument(nameof(context)); ConfigNode innerNode = node.GetNode(name); if (innerNode.IsNull()) { return(false); } nodeObjectWrapper.Load(ref fieldValue, innerNode, context); return(true); }
public bool Load(ref object fieldValue, ConfigNode node, OperationContext context) { node.ThrowIfNullArgument(nameof(node)); fieldValue.EnsureArgumentType(listType, nameof(fieldValue)); context.ThrowIfNullArgument(nameof(context)); ConfigNode[] nodes = node.GetNodes(name); if (nodes.IsNullOrEmpty()) { return(false); } if (fieldValue.IsNull()) { fieldValue = Activator.CreateInstance(listType); } IList list = (IList)fieldValue; if (context.Operation == Operation.Deserialize || context.Operation == Operation.LoadInstance) { list.Clear(); } foreach (ConfigNode innerNode in nodes) { if (innerNode.IsNull()) { continue; } object obj = null; nodeObjectWrapper.Load(ref obj, innerNode, context); list.Add(obj); } return(true); }