public ParsingNonFilterablePropertyWithListException(string propertyName, string knownProperties, string invalidQuery, int position, Exception innerException) : base(DataStrings.ExceptionParseNonFilterablePropertyErrorWithList(propertyName, knownProperties, invalidQuery, position), innerException)
 {
     this.propertyName    = propertyName;
     this.knownProperties = knownProperties;
     this.invalidQuery    = invalidQuery;
     this.position        = position;
 }
Beispiel #2
0
 public ConfigurationSettingsScopePropertyBadValueException(string name, string value, Exception innerException) : base(DataStrings.ConfigurationSettingsScopePropertyBadValue(name, value), innerException)
 {
     this.name  = name;
     this.value = value;
 }
Beispiel #3
0
 protected virtual LocalizedString CustomErrorMessage(string value, PropertyDefinition propertyDefinition)
 {
     return(DataStrings.ConstraintViolationStringDoesNotMatchRegularExpression(this.Pattern, value));
 }
 public CsvDuplicatedColumnException(string duplicatedColumn, Exception innerException) : base(DataStrings.DuplicatedColumn(duplicatedColumn), innerException)
 {
     this.duplicatedColumn = duplicatedColumn;
 }
Beispiel #5
0
 public ParsingVariablesNotSupported(string invalidQuery, int position, Exception innerException) : base(DataStrings.ExceptionVariablesNotSupported(invalidQuery, position), innerException)
 {
     this.invalidQuery = invalidQuery;
     this.position     = position;
 }
Beispiel #6
0
 public ConfigurationSettingsPropertyFailedValidationException(string name, string value, Exception innerException) : base(DataStrings.ConfigurationSettingsPropertyFailedValidation(name, value), innerException)
 {
     this.name  = name;
     this.value = value;
 }
Beispiel #7
0
 public ServicePlanSchemaValidationError(string schemaError) : base(DataStrings.ServicePlanSchemaCheckFailed(schemaError))
 {
 }
Beispiel #8
0
        private static bool InternalTryParseNetmask(string expression, int sep, ref IPRange range)
        {
            range.format = IPRange.Format.Invalid;
            int length = expression.Length;

            if (sep == 0 || expression[sep] != '(' || expression[length - 1] != ')')
            {
                return(false);
            }
            IPAddress ipaddress;

            if (!IPAddress.TryParse(expression.Substring(0, sep), out ipaddress))
            {
                range.exceptionMessage = DataStrings.InvalidIPAddressFormat(expression.Substring(0, sep));
                return(false);
            }
            IPAddress ipaddress2;

            if (!IPAddress.TryParse(expression.Substring(sep + 1, length - sep - 2), out ipaddress2))
            {
                range.exceptionMessage = DataStrings.InvalidIPAddressFormat(expression.Substring(sep + 1, length - sep - 2));
                return(false);
            }
            if (ipaddress.AddressFamily != ipaddress2.AddressFamily)
            {
                range.exceptionMessage = DataStrings.StartingAddressAndMaskAddressFamilyMismatch;
                return(false);
            }
            int         i          = (ipaddress.AddressFamily == AddressFamily.InterNetwork) ? 32 : 128;
            IPvxAddress pvxAddress = new IPvxAddress(ipaddress2);

            while (i > 0 && (byte)pvxAddress == 0)
            {
                i           -= 8;
                pvxAddress >>= 8;
            }
            if (i == 0)
            {
                if (ipaddress.AddressFamily == AddressFamily.InterNetwork)
                {
                    range.SetAddresses(IPvxAddress.IPv4MappedMask, IPvxAddress.IPv4Broadcast);
                }
                else
                {
                    range.SetAddresses(IPvxAddress.Zero, new IPvxAddress(ulong.MaxValue, ulong.MaxValue));
                }
                range.format = IPRange.Format.Netmask;
                return(true);
            }
            short num = 0;
            byte  b   = (byte)pvxAddress;

            if (b <= 224)
            {
                if (b == 128)
                {
                    num += 1;
                    goto IL_1EB;
                }
                if (b == 192)
                {
                    num += 2;
                    goto IL_1EB;
                }
                if (b == 224)
                {
                    num += 3;
                    goto IL_1EB;
                }
            }
            else
            {
                if (b == 240)
                {
                    num += 4;
                    goto IL_1EB;
                }
                if (b == 248)
                {
                    num += 5;
                    goto IL_1EB;
                }
                switch (b)
                {
                case 252:
                    num += 6;
                    goto IL_1EB;

                case 254:
                    num += 7;
                    goto IL_1EB;

                case 255:
                    num += 8;
                    goto IL_1EB;
                }
            }
            range.exceptionMessage = DataStrings.InvalidIPAddressMask(ipaddress2.ToString());
            return(false);

IL_1EB:
            i           -= 8;
            pvxAddress >>= 8;
            while (i > 0)
            {
                if ((byte)pvxAddress != 255)
                {
                    range.exceptionMessage = DataStrings.InvalidIPAddressMask(ipaddress2.ToString());
                    return(false);
                }
                i           -= 8;
                pvxAddress >>= 8;
                num         += 8;
            }
            if (!range.SetAddressesFromCIDR(new IPvxAddress(ipaddress), num))
            {
                return(false);
            }
            range.format = IPRange.Format.Netmask;
            return(true);
        }
Beispiel #9
0
 private static T DynamicResolveOperation(Unlimited <T> value1, object value2, string operationName)
 {
     Type[] genericTypeArguments = value1.GetType().GetTypeInfo().GenericTypeArguments;
     if (genericTypeArguments[0] == typeof(int))
     {
         int?num  = value1.Value as int?;
         int?num2 = value2 as int?;
         if (num2 == null)
         {
             num2 = new int?((int)Convert.ChangeType(value2, typeof(int)));
         }
         if (num2 == null)
         {
             throw new InvalidOperationException(DataStrings.ExceptionCannotResolveOperation(operationName, typeof(T).Name, value2.GetType().Name));
         }
         if ("op_Subtraction".Equals(operationName))
         {
             return((T)((object)(num.Value - num2.Value)));
         }
         if ("op_Division".Equals(operationName))
         {
             return((T)((object)(num.Value / num2.Value)));
         }
         if ("op_Multiply".Equals(operationName))
         {
             return((T)((object)(num.Value * num2.Value)));
         }
         return((T)((object)(num.Value + num2.Value)));
     }
     else if (genericTypeArguments[0] == typeof(uint))
     {
         uint?num3 = value1.Value as uint?;
         uint?num4 = value2 as uint?;
         if (num4 == null)
         {
             num4 = new uint?((uint)Convert.ChangeType(value2, typeof(uint)));
         }
         if (num4 == null)
         {
             throw new InvalidOperationException(DataStrings.ExceptionCannotResolveOperation(operationName, typeof(T).Name, value2.GetType().Name));
         }
         if ("op_Subtraction".Equals(operationName))
         {
             return((T)((object)(num3.Value - num4.Value)));
         }
         if ("op_Division".Equals(operationName))
         {
             return((T)((object)(num3.Value / num4.Value)));
         }
         if ("op_Multiply".Equals(operationName))
         {
             return((T)((object)(num3.Value * num4.Value)));
         }
         return((T)((object)(num3.Value + num4.Value)));
     }
     else
     {
         MethodInfo methodInfo = null;
         foreach (MethodInfo methodInfo2 in from x in genericTypeArguments[0].GetTypeInfo().DeclaredMethods
                  where x.Name == operationName
                  select x)
         {
             ParameterInfo[] parameters = methodInfo2.GetParameters();
             if (parameters.Length == 2 && parameters[0].ParameterType == genericTypeArguments[0] && parameters[1].ParameterType == value2.GetType())
             {
                 methodInfo = methodInfo2;
                 break;
             }
         }
         if (methodInfo == null)
         {
             throw new InvalidOperationException(DataStrings.ExceptionCannotResolveOperation(operationName, typeof(T).Name, value2.GetType().Name));
         }
         object[] parameters2 = new object[]
         {
             value1.Value,
             value2
         };
         T result;
         try
         {
             result = (T)((object)methodInfo.Invoke(value1.Value, parameters2));
         }
         catch (TargetInvocationException ex)
         {
             throw ex.InnerException;
         }
         return(result);
     }
 }
 public ConfigurationSettingsPropertyBadTypeException(string name, string type, Exception innerException) : base(DataStrings.ConfigurationSettingsPropertyBadType(name, type), innerException)
 {
     this.name = name;
     this.type = type;
 }
 public ServicePlanFeaturesValidationError(string feature, string sku) : base(DataStrings.ServicePlanFeatureCheckFailed(feature, sku))
 {
 }
        public override PropertyConstraintViolationError Validate(object value, PropertyDefinition propertyDefinition, IPropertyBag propertyBag)
        {
            string text = (string)value;

            if (string.IsNullOrEmpty(text))
            {
                return(null);
            }
            if (text.Length > this.maxLength)
            {
                return(new PropertyConstraintViolationError(DataStrings.ConstraintViolationObjectIsBeyondRange(this.maxLength.ToString()), propertyDefinition, value, this));
            }
            int num = 0;

            if (!int.TryParse(text, out num))
            {
                char[] separator = new char[]
                {
                    this.pairDelimiter
                };
                char[] separator2 = new char[]
                {
                    this.extensionValueDelimiter
                };
                string[] array  = text.Split(separator);
                string[] array2 = array;
                int      i      = 0;
                while (i < array2.Length)
                {
                    string   text2  = array2[i];
                    string[] array3 = text2.Split(separator2);
                    PropertyConstraintViolationError result;
                    if (array3.Length != 2)
                    {
                        result = new PropertyConstraintViolationError(DataStrings.ConstraintViolationMalformedExtensionValuePair(text2), propertyDefinition, value, this);
                    }
                    else if (array3[0].Length == 0)
                    {
                        result = new PropertyConstraintViolationError(DataStrings.ConstraintViolationMalformedExtensionValuePair(text2), propertyDefinition, value, this);
                    }
                    else
                    {
                        int num2 = 0;
                        if (!int.TryParse(array3[1], out num2))
                        {
                            result = new PropertyConstraintViolationError(DataStrings.ConstraintViolationMalformedExtensionValuePair(text2), propertyDefinition, value, this);
                        }
                        else
                        {
                            if (num2 >= this.minValue && num2 <= this.maxValue)
                            {
                                i++;
                                continue;
                            }
                            result = new PropertyConstraintViolationError(DataStrings.ConstraintViolationValueOutOfRange(this.minValue.ToString(), this.maxValue.ToString(), num2.ToString()), propertyDefinition, value, this);
                        }
                    }
                    return(result);
                }
                return(null);
            }
            if (num < this.minValue)
            {
                return(new PropertyConstraintViolationError(DataStrings.ConstraintViolationObjectIsBelowRange(this.minValue.ToString()), propertyDefinition, value, this));
            }
            if (num > this.maxValue)
            {
                return(new PropertyConstraintViolationError(DataStrings.ConstraintViolationObjectIsBeyondRange(this.maxValue.ToString()), propertyDefinition, value, this));
            }
            return(null);
        }
 public CsvRequiredColumnMissingException(string missingColumn, Exception innerException) : base(DataStrings.RequiredColumnMissing(missingColumn), innerException)
 {
     this.missingColumn = missingColumn;
 }