void Clear(ParameterStyle style) { foreach (var gameParamModel in IntParams) { gameParamModel.Value.Set(style, 0); } }
private QueryParameter(int id, string name, ParameterStyle style, SqlObject value, ParameterDirection direction) { this.id = id; this.name = name; this.style = style; this.value = value; this.direction = direction; }
public RestfulAttribute(string method, string uriTemplate, ParameterStyle parameterStyle = ParameterStyle.Uri) { m_method = method.ToUpper(); m_uriTemplate = uriTemplate; if (m_method == "GET" && parameterStyle == ParameterStyle.Content) { throw new NotSupportedException("Http GET method does not support ParameterStyle.Content!"); } m_parameterStyle = parameterStyle; }
public static IEnumerable<ParameterHeader> Parse(ParameterStyle style) { if ((style & ParameterStyle.DoubleBar) == ParameterStyle.DoubleBar) yield return new ParameterHeader("--"); if ((style & ParameterStyle.Bar) == ParameterStyle.Bar) yield return new ParameterHeader("-"); if ((style & ParameterStyle.Slash) == ParameterStyle.Slash) yield return new ParameterHeader("/"); if ((style & ParameterStyle.Backslash) == ParameterStyle.Backslash) yield return new ParameterHeader("\\"); }
/// <summary> /// Creates a new instance of the <see cref="PropertyEncoding"/> class. /// </summary> /// <param name="contentType">The Content-Type for encoding a specific property.</param> /// <param name="headers">The list of headers.</param> /// <param name="style"></param> /// <param name="options"></param> public PropertyEncoding( ContentType contentType = default, IReadOnlyDictionary <string, Referable <ParameterBody> > headers = default, ParameterStyle style = default, PropertyEncodingOptions options = default) { ContentType = contentType; Headers = headers ?? ReadOnlyDictionary.Empty <string, Referable <ParameterBody> >(); Style = style; Options = options; }
/// <summary> /// Creates a new instance of the <see cref="ParameterBody"/> class. /// </summary> /// <param name="name">The name of the parameter.</param> /// <param name="location">The location of the parameter.</param> /// <param name="description">The brief description of the parameter.</param> /// <param name="options">The parameter options.</param> /// <param name="style">The value which indicates how the parameter value will be serialized depending on the type of the parameter value.</param> /// <param name="schema">The schema defining the type used for the parameter.</param> /// <param name="examples">The list of examples of the parameter.</param> /// <param name="content">The map containing the representations for the parameter.</param> public Parameter( string name = default, ParameterLocation location = default, string description = default, ParameterOptions options = default, ParameterStyle style = default, Referable <Schema> schema = default, IReadOnlyDictionary <ContentType, Referable <Example> > examples = default, IReadOnlyDictionary <ContentType, MediaType> content = default) : base(description, options, style, schema, examples, content) { Name = name; Location = location; }
/// <summary> /// Creates a new instance of the <see cref="ParameterBody"/> class. /// </summary> /// <param name="description">The brief description of the parameter.</param> /// <param name="options">The parameter options.</param> /// <param name="style">The value which indicates how the parameter value will be serialized depending on the type of the parameter value.</param> /// <param name="schema">The schema defining the type used for the parameter.</param> /// <param name="examples">The list of examples of the parameter.</param> /// <param name="content">The map containing the representations for the parameter.</param> public ParameterBody( string description = default, ParameterOptions options = default, ParameterStyle style = default, Referable <Schema> schema = default, IReadOnlyDictionary <ContentType, Referable <Example> > examples = default, IReadOnlyDictionary <ContentType, MediaType> content = default) { Description = description; Options = options; Style = style; Schema = schema; Examples = examples ?? ReadOnlyDictionary.Empty <ContentType, Referable <Example> >(); Content = content ?? ReadOnlyDictionary.Empty <ContentType, MediaType>(); }
public int Operation(ParameterStyle style, string key, GameParameterOperations operation, int num) { AddModel(key); switch (operation) { case GameParameterOperations.Add: IntParams[key].Set(style, IntParams[key].Get(style) + num); break; case GameParameterOperations.Times: IntParams[key].Set(style, IntParams[key].Get(style) * num); break; case GameParameterOperations.Division: IntParams[key].Set(style, IntParams[key].Get(style) / num); break; } return(IntParams[key].GetSum()); }
private static char GetDelimeter(ParameterStyle style) { switch (style) { case ParameterStyle.Form: case ParameterStyle.Simple: return(','); case ParameterStyle.SpaceDelimited: return(' '); case ParameterStyle.PipeDelimited: return('|'); case ParameterStyle.Matrix: case ParameterStyle.Label: case ParameterStyle.DeepObject: throw new NotSupportedException(); default: throw new ArgumentOutOfRangeException(nameof(style), style, null); } }
object[] GetParameters(MethodBase methodBase, ParameterStyle parameterStyle, UriTemplateMatch match) { List <object> paramValues = new List <object>(); NameValueCollection boundVariables = new NameValueCollection(); if (parameterStyle.HasFlag(ParameterStyle.Uri)) { boundVariables = match.BoundVariables; } if (parameterStyle.HasFlag(ParameterStyle.Content)) { string parameterString = HttpCurrentContext.Body; NameValueCollection contentParameters = HttpUtility.ParseQueryString(parameterString); boundVariables.Add(contentParameters); } foreach (ParameterInfo paramInfo in methodBase.GetParameters()) { string paramName = paramInfo.Name; string paramValue = boundVariables[paramName]; paramValues.Add(paramValue); } return(paramValues.ToArray()); }
/// <summary> /// Converts the specified <see cref="ParameterStyle"/> to a <see cref="JsonValue"/>. /// </summary> /// <param name="parameterStyle">The <see cref="ParameterStyle"/> to convert.</param> /// <returns>The <see cref="JsonValue"/>.</returns> protected virtual JsonValue ToJsonValue(ParameterStyle parameterStyle) { switch (parameterStyle) { case ParameterStyle.Default: return(null); case ParameterStyle.Matrix: return(EnumConstants.Matrix); case ParameterStyle.Label: return(EnumConstants.Label); case ParameterStyle.Form: return(EnumConstants.Form); case ParameterStyle.Simple: return(EnumConstants.Simple); case ParameterStyle.SpaceDelimited: return(EnumConstants.SpaceDelimited); case ParameterStyle.PipeDelimited: return(EnumConstants.PipeDelimited); case ParameterStyle.DeepObject: return(EnumConstants.DeepObject); default: throw new ArgumentOutOfRangeException(nameof(parameterStyle)); } }
/// <summary> /// Initializes a new instance of the <see cref="ParameterModel"/> class. /// </summary> /// <param name="prefix">The prefix.</param> /// <param name="style">The style.</param> public ParameterModel(String prefix, ParameterStyle style) { this.m_prefix = prefix; this.m_style = style; }
public Query(string text, ParameterStyle style) { this.text = text; this.style = style; parameters = new QueryParameterList(this); }
protected void SetParameterStyle(ParameterStyle style) { AssertNotDisposed(); parameterStyle = style; }
protected void SetParameterStyle(ParameterStyle style) { AssertNotDisposed(); parameterStyle = style; }
public void Set(ParameterStyle key, int num) { Param[key] = num; }
public int Set(ParameterStyle style, string key, int num) { AddModel(key); IntParams[key].Set(style, num); return(IntParams[key].GetSum()); }
public int Get(ParameterStyle key) { return(Param[key]); }
private FetchParameterExpression(object parameter, ParameterStyle style) : base(ExpressionType.FetchParameter) { SetArgument("param", parameter); SetArgument("param_style", style); }