/// <summary>
        /// Create a new ScopedCustomVariableSlot with a given variable, scope and slot index.
        /// </summary>
        /// <param name="scope">Scope of this custom variable.</param>
        /// <param name="variable">Custom variable.</param>
        /// <param name="slot">Slot index for this custom variable.</param>
        public ScopedCustomVariableSlot(CustomVariableScope scope, ICustomVariable variable, int slot)
        {
            if (!Enum.IsDefined(typeof(CustomVariableScope), scope))
                throw new ArgumentOutOfRangeException("scope");

            this.scope = scope;
            this.variable = variable;
            this.slot = slot;
        }
예제 #2
0
        /// <summary>
        /// Create a new ScopedCustomVariableSlot with a given variable, scope and slot index.
        /// </summary>
        /// <param name="scope">Scope of this custom variable.</param>
        /// <param name="variable">Custom variable.</param>
        /// <param name="slot">Slot index for this custom variable.</param>
        public ScopedCustomVariableSlot(CustomVariableScope scope, ICustomVariable variable, int slot)
        {
            if (!Enum.IsDefined(typeof(CustomVariableScope), scope))
            {
                throw new ArgumentOutOfRangeException("scope");
            }

            this.scope    = scope;
            this.variable = variable;
            this.slot     = slot;
        }
        string customVariableValue(ICustomVariable customVariable)
        {
            string value = String.Empty;

            if (customVariable.Type == CustomVariableType.String)
            {
                value = String.Format("\"{0}\"", customVariable.Text);
            }
            if (customVariable.Type == CustomVariableType.Numeric)
            {
                if (customVariable.Number.HasValue)
                {
                    value = customVariable.Number.Value.ToString(CultureInfo.InvariantCulture);
                }
                else
                {
                    value = "<empty>";
                }
            }
            return(value);
        }
예제 #4
0
        public static string GetCustomVariableValue(ICustomVariable customVariable)
        {
            string result = string.Empty;

            if (customVariable.Type == CustomVariableType.String)
            {
                result = "\"" + customVariable.Text + "\"";
            }
            if (customVariable.Type == CustomVariableType.Numeric)
            {
                if (customVariable.Number.HasValue)
                {
                    result = customVariable.Number.Value.ToString(CultureInfo.InvariantCulture);
                }
                else
                {
                    result = "Null";
                }
            }
            return(result);
        }
 public ScopedCustomVariable(CustomVariableScope scope, ICustomVariable variable)
 {
     this.scope = scope;
     this.variable = variable;
 }