示例#1
0
        public static JObject Initialize(JObject objectTemplate, List <InitRule> rules)
        {
            JToken token       = objectTemplate.DeepClone();
            var    initializer = new RBTokenInitializer(rules);

            initializer.Initialize(token);
            return((JObject)token);
        }
        public static JArray Initialize(JArray arrayTemplate, int length, List <InitRule> rules)
        {
            var arrayRule = new InitRule
            {
                Pattern         = "^$",
                SourceType      = SourceTypeEnum.Value,
                DestinationType = DestinationTypeEnum.Array,
                Parameters      = new List <string>()
                {
                    length.ToString()
                }
            };

            rules.Add(arrayRule);

            JToken token       = arrayTemplate.DeepClone();
            var    initializer = new RBTokenInitializer(rules);

            initializer.Initialize(token);
            return((JArray)token);
        }