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);
        }
Exemplo n.º 2
0
 public RuleWithParameters(InitRule initRule)
 {
     Pattern          = initRule.Pattern;
     AssignmentAction = AssignmentFactory.Create(initRule.SourceType);
     Parameters       = initRule.Parameters;
 }