コード例 #1
0
        /// <inheritdoc />
        public bool OnListNode(
            int index,
            object value,
            ListValueReflection reflection,
            NodeReflection nodeReflection,
            out object newValue
            )
        {
            if (index == 0 && IsPatch)
            {
                Node.AddNode(string.IsNullOrEmpty(reflection.Name)
                                 ? $"!{reflection.NodeId},*"
                                 : $"!{reflection.NodeId}[{reflection.Name}],*");
            }

            newValue = default;
            var save = new SaveVisitor
            {
                IsPatch = false,
                Node    = new ConfigNode()
            };

            nodeReflection.Save(save, value);

            if (save.Node.HasData)
            {
                Serialization.AddNode(Node, save.Node, nodeReflection.Id, reflection.Name);
            }

            return(false);
        }
コード例 #2
0
        /// <inheritdoc />
        public bool OnNode(object value, NodeReflection reflection, out object newValue)
        {
            newValue = default;
            var save = new SaveVisitor
            {
                IsPatch = IsPatch,
                Node    = new ConfigNode()
            };

            reflection.Save(save, value);

            if (save.Node.HasData)
            {
                Serialization.AddNode(Node, save.Node, reflection.Id, reflection.Name, IsPatch);
            }

            return(false);
        }