예제 #1
0
        private static string GetValue(
            ValueExpression valueExpression, IReadOnlyDictionary <string, IVariableValueResolver> variables)
        {
            if (valueExpression is ConstantExpression constant)
            {
                return(constant.Value);
            }

            if (valueExpression is VariableExpression variable)
            {
                return(VariableResolver.ResolveValue(variable, variables));
            }

            throw new Exception($"Value type {valueExpression.GetType().Name} not supported");
        }
예제 #2
0
        private static string ResolveStringPart(object obj, EsiExecutionContext executionContext)
        {
            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }
            switch (obj)
            {
            case string s:
                return(s);

            case VariableExpression v:
                return(VariableResolver.ResolveValue(v, executionContext.Variables));

            default:
                throw new Exception($"Unknown part type '{obj.GetType().Name}'.");
            }
        }