Beispiel #1
0
        public Color?EvaluateColor(VariableBag variables)
        {
            var partCurrent = variables.PartCurrent;

            // ReSharper disable once ForCanBeConvertedToForeach
            for (var i = 0; i < _gradients.Length; i++)
            {
                var gradient          = _gradients[i];
                var evaluatedGradient = gradient.Evaluate(variables);

                if (evaluatedGradient.Min < evaluatedGradient.Max)
                {
                    if (evaluatedGradient.Min <= partCurrent && partCurrent <= evaluatedGradient.Max)
                    {
                        return(evaluatedGradient.EvaluateColor(partCurrent));
                    }
                }
            }

            return(null);
        }
Beispiel #2
0
 public EvaluatedStopNode Evaluate(VariableBag variables)
 {
     return(new EvaluatedStopNode(this, variables));
 }
 private bool IsValid(VariableBag existingVariable)
 {
     return (DateTime.Now - existingVariable.LastUpdate).TotalMilliseconds < _millisBetweenRefresh;
 }
        private string GetNew(EnvironmentVariableTarget target, string variableName)
        {
            var variableBag = new VariableBag(variableName, null, target);
            UpdateVariable(variableBag);
            _variables[target].Add(variableName, variableBag);

            return variableBag.Content;
        }
 private static void UpdateVariable(VariableBag existingVariable)
 {
     existingVariable.Content = System.Environment.GetEnvironmentVariable(existingVariable.Name, existingVariable.Target);
 }
Beispiel #6
0
 public EvaluatedGradientNode Evaluate(VariableBag variables)
 {
     return(new EvaluatedGradientNode(this, variables));
 }