Beispiel #1
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("typeName");
     writer.WriteStringValue(ConditionType.ToString());
     if (Optional.IsDefined(Selector))
     {
         writer.WritePropertyName("selector");
         writer.WriteStringValue(Selector);
     }
     writer.WritePropertyName("operator");
     writer.WriteStringValue(CookiesOperator.ToString());
     if (Optional.IsDefined(NegateCondition))
     {
         writer.WritePropertyName("negateCondition");
         writer.WriteBooleanValue(NegateCondition.Value);
     }
     if (Optional.IsCollectionDefined(MatchValues))
     {
         writer.WritePropertyName("matchValues");
         writer.WriteStartArray();
         foreach (var item in MatchValues)
         {
             writer.WriteStringValue(item);
         }
         writer.WriteEndArray();
     }
     if (Optional.IsCollectionDefined(Transforms))
     {
         writer.WritePropertyName("transforms");
         writer.WriteStartArray();
         foreach (var item in Transforms)
         {
             writer.WriteStringValue(item.ToString());
         }
         writer.WriteEndArray();
     }
     writer.WriteEndObject();
 }
 internal CookiesMatchConditionParameters(CookiesMatchConditionParametersOdataType odataType, string selector, CookiesOperator @operator, bool?negateCondition, IList <string> matchValues, IList <TransformCategory> transforms)
 {
     OdataType       = odataType;
     Selector        = selector;
     Operator        = @operator;
     NegateCondition = negateCondition;
     MatchValues     = matchValues;
     Transforms      = transforms;
 }
 public CookiesMatchConditionParameters(CookiesMatchConditionParametersOdataType odataType, CookiesOperator @operator)
 {
     OdataType   = odataType;
     Operator    = @operator;
     MatchValues = new ChangeTrackingList <string>();
     Transforms  = new ChangeTrackingList <TransformCategory>();
 }
Beispiel #4
0
 internal CookiesMatchCondition(CookiesMatchConditionType conditionType, string selector, CookiesOperator cookiesOperator, bool?negateCondition, IList <string> matchValues, IList <PreTransformCategory> transforms)
 {
     ConditionType   = conditionType;
     Selector        = selector;
     CookiesOperator = cookiesOperator;
     NegateCondition = negateCondition;
     MatchValues     = matchValues;
     Transforms      = transforms;
 }
Beispiel #5
0
        internal static CookiesMatchCondition DeserializeCookiesMatchCondition(JsonElement element)
        {
            CookiesMatchConditionType  typeName                 = default;
            Optional <string>          selector                 = default;
            CookiesOperator            @operator                = default;
            Optional <bool>            negateCondition          = default;
            Optional <IList <string> > matchValues              = default;
            Optional <IList <PreTransformCategory> > transforms = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("typeName"))
                {
                    typeName = new CookiesMatchConditionType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("selector"))
                {
                    selector = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("operator"))
                {
                    @operator = new CookiesOperator(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("negateCondition"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    negateCondition = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("matchValues"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    matchValues = array;
                    continue;
                }
                if (property.NameEquals("transforms"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <PreTransformCategory> array = new List <PreTransformCategory>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(new PreTransformCategory(item.GetString()));
                    }
                    transforms = array;
                    continue;
                }
            }
            return(new CookiesMatchCondition(typeName, selector.Value, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)));
        }
Beispiel #6
0
 internal CookiesMatchConditionDefinition(CookiesMatchConditionType typeDefinition, string selector, CookiesOperator @operator, bool?negateCondition, IList <string> matchValues, IList <PreTransformCategory> transforms)
 {
     TypeDefinition  = typeDefinition;
     Selector        = selector;
     Operator        = @operator;
     NegateCondition = negateCondition;
     MatchValues     = matchValues;
     Transforms      = transforms;
 }
Beispiel #7
0
 public CookiesMatchConditionDefinition(CookiesMatchConditionType typeDefinition, CookiesOperator @operator)
 {
     TypeDefinition = typeDefinition;
     Operator       = @operator;
     MatchValues    = new ChangeTrackingList <string>();
     Transforms     = new ChangeTrackingList <PreTransformCategory>();
 }