Example #1
0
        public override async Task <double> Evaluate(ISubstitutionProvider substitutionProvider)
        {
            var result = Variables.Aggregate((x, y) => x - y);

            Parallel.ForEach(Children, async(x) =>
            {
                var evaluation = await x.Evaluate(substitutionProvider);
                result        -= evaluation;
            });
            return(result);
        }
Example #2
0
 internal void OnDeserialize(StreamingContext context)
 {
     if (Variables != null && Bundles != null)
     {
         foreach (var bund in Bundles)
         {
             var pre =
                 bund.Includes.Select(inc => Variables.Aggregate(inc, (current, vr) => current.Replace($"{{{vr.Key}}}", vr.Value)))
                 .ToList();
             bund.Includes = pre;
         }
     }
 }
Example #3
0
        public override string ToString()
        {
            var variables = Variables != null && Variables.Count > 0
                ? Variables.Aggregate(string.Empty,
                                      (current,
                                       variable) => current + (variable + ","))
                : string.Empty;

            if (variables.Length > 0)
            {
                variables = "{" + variables.Remove(variables.Length - 1, 1) + "}";
            }
            return(string.Format("{0}{1}", variables, AudioFile));
        }
Example #4
0
        public string Message()
        {
            var template = (string)Variables["messageTemplate"];

            return(Variables.Aggregate(template, (current, pair) => current.Replace("{" + pair.Key + "}", pair.Value.ToString())));
        }