Esempio n. 1
0
File: Datr.cs Progetto: StalaK/Datr
    private void SetRandomPropertyValue <T>(PropertyInfo property, T instance)
    {
        var method        = this.GetType().GetMethod("GetFixedRange", BindingFlags.NonPublic | BindingFlags.Instance);
        var genericMethod = method.MakeGenericMethod(instance.GetType());
        var range         = (FixedRange)genericMethod.Invoke(this, new[] { property });

        dynamic value;

        if (property.PropertyType.IsArray)
        {
            var arrayElements = Randomizer.Byte();
            var elementType   = property.PropertyType.GetElementType();

            value = Array.CreateInstance(elementType, arrayElements);

            for (var i = 0; i < arrayElements; i++)
            {
                var val = GetRandomPropertyValue(property, range);
                value[i] = val;
            }
        }
        else if (property.PropertyType.IsEnum)
        {
            var enumVals = Enum.GetValues(property.PropertyType);

            var fixedRange = new FixedRange
            {
                Range    = Range.Between,
                MinValue = 0,
                MaxValue = enumVals.Length
            };

            var randomValueIndex = Randomizer.Int(fixedRange);

            value = Enum.Parse(property.PropertyType, enumVals.GetValue(randomValueIndex).ToString());
        }
        else if (property.PropertyType.IsGenericType && property.PropertyType.GetGenericTypeDefinition() == typeof(List <>))
        {
            var listElements = Randomizer.Byte();

            value = Activator.CreateInstance(property.PropertyType);
            for (var i = 0; i < listElements; i++)
            {
                var listValue = GetRandomPropertyValue(property, range);
                value.Add(listValue);
            }
        }
        else
        {
            value = GetRandomPropertyValue(property, range);
        }

        property.SetValue(instance, value);
    }
Esempio n. 2
0
File: Datr.cs Progetto: StalaK/Datr
    /// <summary>
    /// Sets a fixed range of values for the given class and DateTime property
    /// </summary>
    /// <typeparam name="T">The class containing the property</typeparam>
    /// <param name="propertyName">The name of the property (case insensitive)</param>
    /// <param name="range">The range for the property to be generated in. Greater than, Less Than, Between or Outside</param>
    /// <param name="minValue">The minimum value of the property</param>
    /// <param name="maxValue">The maximum value of the property</param>
    public void SetDateTimeRange <T>(string propertyName, Range range, DateTime?minValue = null, DateTime?maxValue = null)
    {
        if ((minValue == null || maxValue == null) && (range == Range.Between || range == Range.Outside))
        {
            throw new ArgumentException("SetDateTimeRange: minValue and maxValue parameters must be set when using a range of Between or Outside.");
        }

        if (maxValue <= minValue && (range == Range.Between || range == Range.Outside))
        {
            throw new ArgumentException("SetDateTimeRange: maxValue cannot be less than or equal to minValue when using a range of Between or Outside");
        }

        if (minValue == null && range == Range.GreaterThan)
        {
            throw new ArgumentException("SetDateTimeRange: minValue must not be null when using the GreaterThan range");
        }

        if (maxValue == null && range == Range.LessThan)
        {
            throw new ArgumentException("SetDateTimeRange: minValue must not be null when using the GreaterThan range");
        }

        if (minValue == DateTime.MaxValue)
        {
            throw new ArgumentException("SetDateTimeRange: minValue cannot be equal to DateTime.MaxValue");
        }

        if (maxValue == DateTime.MinValue)
        {
            throw new ArgumentException("SetDateTimeRange: maxValue cannot be equal to DateTime.MinValue");
        }

        if (!HasProperty <T>(propertyName))
        {
            throw new ArgumentException($"SetDateTimeRange: The type {typeof(T).Name} does not contain the property {propertyName}");
        }

        var stringRange = new FixedRange
        {
            DataType     = typeof(DateTime),
            ClassType    = typeof(T),
            PropertyName = propertyName,
            Range        = range,
            MinValue     = minValue,
            MaxValue     = maxValue
        };

        FixedRanges.Add(stringRange);
    }
 private void HighlightProtectedRange(FixedRange fixedRange, Rectangle bounds)
 {
     for (int i = 0; i < richEditControl.Document.Bookmarks.Count; i++)
     {
         Bookmark protectedBookmark = richEditControl.Document.Bookmarks[i];
         if (protectedBookmark.Name.Contains("protectedRange"))
         {
             if (protectedBookmark.Range.Start.ToInt() <= fixedRange.Start && protectedBookmark.Range.End.ToInt() >= (fixedRange.Start + fixedRange.Length))
             {
                 RichEditBrush richEditBrush = new RichEditBrush(Color.LightPink);
                 Canvas.FillRectangle(richEditBrush, bounds);
             }
         }
     }
 }
Esempio n. 4
0
    internal uint UInt(FixedRange range = null)
    {
        uint value;

        if (range is null)
        {
            var firstBits = (uint)_random.Next(0, 1 << 4) << 28;
            var lastBits  = (uint)_random.Next(0, 1 << 28);
            value = firstBits | lastBits;
        }
        else
        {
            value = FixedRangeUInt(range);
        }

        return(value);
    }
Esempio n. 5
0
    internal ulong ULong(FixedRange range = null)
    {
        ulong value;

        if (range is null)
        {
            var firstBits = (ulong)_random.Next(0, 1 << 30) << 34;
            var midBits   = (ulong)_random.Next(0, 1 << 30) << 4;
            var lastBits  = (ulong)_random.Next(0, 1 << 4);
            value = firstBits | midBits | lastBits;
        }
        else
        {
            value = FixedRangeULong(range);
        }

        return(value);
    }
Esempio n. 6
0
    internal string String(FixedRange range = null)
    {
        string value;

        if (range is null)
        {
            var chars     = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 !\"£$%^&*()-=_+[]{};'#:@~,./<>?\\";
            var charCount = Byte() + 1;

            value = new string(Enumerable.Repeat(chars, charCount).Select(s => s[_random.Next(s.Length)]).ToArray());
        }
        else
        {
            value = FixedRangeString(range);
        }

        return(value);
    }
Esempio n. 7
0
        string GetSerialNumberRange()
        {
            using (FASEntities FAS = new FASEntities())
            {
                for (int i = 0; i < GridRange.RowCount; i++)               //Берем дипозон, который мы выбрали в настройки формы
                {
                    var st  = int.Parse(GridRange[0, i].Value.ToString()); //Берем начало диапазона
                    var end = int.Parse(GridRange[1, i].Value.ToString()); //Берем конец диапазона

                    //Берем первый свободный номер с диапазона
                    var ser = FAS.FAS_SerialNumbers.Where
                                  (c => c.LOTID == (short)LOTID && c.IsUsed == false && c.IsActive == true && c.SerialNumber >= st && c.SerialNumber <= end)
                              .Select(c => c.SerialNumber).Take(1).FirstOrDefault();

                    if (ser != 0) //Если номер в диапазоне найден, сохраняем данные, успешно выходим из метода
                    {
                        SerNumber = ser;
                        DateText  = DateTime.Parse(GridRange[2, i].Value.ToString());
                        return("False");
                    }
                }

                //Если мы дошли да этого кода, то значит в диапазоне закончились номера
                FixedRange FR     = new FixedRange(LOTID, this, "В базе для этого диапазона закончились серийные номера \n выберите следующий или вызовите технолога", LitIndex);
                var        Result = FR.ShowDialog(); //Открываем форму, чтобы выбрать следующий диапазон

                if (Result == DialogResult.Abort)    //Если вернул Abort, номера закончились полностью
                {
                    return("Abort");
                }
                if (Result == DialogResult.OK) //Если вернул OK, то работает по новому диапазону
                {
                    return("New");
                }
                if (Result == DialogResult.Retry) //Если вернул OK, то работаем БЕЗ диапазона
                {
                    return("Retry");
                }

                return("True");
                //BaseC.DateFas_Start = true;
            }
        }
Esempio n. 8
0
File: Datr.cs Progetto: StalaK/Datr
    private dynamic GetRandomPropertyValue(PropertyInfo property, FixedRange range)
    {
        Type propertyType;

        if (property.PropertyType.IsArray)
        {
            propertyType = property.PropertyType.GetElementType();
        }
        else if (property.PropertyType.IsGenericType && property.PropertyType.GetGenericTypeDefinition() == typeof(List <>))
        {
            propertyType = property.PropertyType.GetGenericArguments()[0];
        }
        else
        {
            propertyType = property.PropertyType;
        }

        var underlyingNullableType = Nullable.GetUnderlyingType(propertyType);

        if (propertyType.IsPrimitive || underlyingNullableType?.IsPrimitive == true)
        {
            var propertyInstance = underlyingNullableType is null
                ? Activator.CreateInstance(propertyType)
                : Activator.CreateInstance(underlyingNullableType);

            return(propertyInstance switch
            {
                bool => Randomizer.Bool(),
                char => Randomizer.Char(),
                sbyte => Randomizer.SByte(range),
                byte => Randomizer.Byte(range),
                short => Randomizer.Short(range),
                ushort => Randomizer.UShort(range),
                double => Randomizer.Double(range),
                float => Randomizer.Float(range),
                int => Randomizer.Int(range),
                uint => Randomizer.UInt(range),
                long => Randomizer.Long(range),
                ulong => Randomizer.ULong(range),
                _ => null
            });
Esempio n. 9
0
    internal decimal Decimal(FixedRange range = null)
    {
        decimal value;

        if (range is null)
        {
            var lo         = NextInt32();
            var mid        = NextInt32();
            var hi         = NextInt32();
            var isNegative = Bool();
            var scale      = (byte)_random.Next(29);

            value = new decimal(lo, mid, hi, isNegative, scale);
        }
        else
        {
            value = FixedRangeDecimal(range);
        }

        return(value);
    }
Esempio n. 10
0
    internal DateTime DateTime(FixedRange range = null)
    {
        DateTime value;

        if (range is null)
        {
            long ticks;

            do
            {
                ticks = Math.Abs(Long());
            } while (ticks <= 0 || ticks > System.DateTime.MaxValue.Ticks);

            value = new DateTime(ticks);
        }
        else
        {
            value = FixedRangeDateTime(range);
        }

        return(value);
    }
Esempio n. 11
0
 private int FixedRangeInt(FixedRange range) => range.Range switch
 {
Esempio n. 12
0
 internal float Float(FixedRange range = null) => range is null
     ? (float)_random.NextDouble()
     : FixedRangeFloat(range);
Esempio n. 13
0
 internal double Double(FixedRange range = null) => range is null
     ? _random.NextDouble()
     : FixedRangeDouble(range);
Esempio n. 14
0
 internal ushort UShort(FixedRange range = null) => range is null
     ? (ushort)_random.Next(ushort.MinValue, ushort.MaxValue + 1)
     : FixedRangeUShort(range);
Esempio n. 15
0
 internal short Short(FixedRange range = null) => range is null
     ? (short)_random.Next(short.MinValue, short.MaxValue + 1)
     : FixedRangeShort(range);
Esempio n. 16
0
        /// <inheritdoc />
        public bool Equals([AllowNull] AAxis other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Color == other.Color ||
                     Color != null &&
                     Color.Equals(other.Color)
                     ) &&
                 (
                     Smoothing == other.Smoothing ||
                     Smoothing != null &&
                     Smoothing.Equals(other.Smoothing)
                 ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ) &&
                 (
                     AutoTypeNumbers == other.AutoTypeNumbers ||
                     AutoTypeNumbers != null &&
                     AutoTypeNumbers.Equals(other.AutoTypeNumbers)
                 ) &&
                 (
                     AutoRange == other.AutoRange ||
                     AutoRange != null &&
                     AutoRange.Equals(other.AutoRange)
                 ) &&
                 (
                     RangeMode == other.RangeMode ||
                     RangeMode != null &&
                     RangeMode.Equals(other.RangeMode)
                 ) &&
                 (
                     Equals(Range, other.Range) ||
                     Range != null && other.Range != null &&
                     Range.SequenceEqual(other.Range)
                 ) &&
                 (
                     FixedRange == other.FixedRange ||
                     FixedRange != null &&
                     FixedRange.Equals(other.FixedRange)
                 ) &&
                 (
                     CheaterType == other.CheaterType ||
                     CheaterType != null &&
                     CheaterType.Equals(other.CheaterType)
                 ) &&
                 (
                     TickMode == other.TickMode ||
                     TickMode != null &&
                     TickMode.Equals(other.TickMode)
                 ) &&
                 (
                     NTicks == other.NTicks ||
                     NTicks != null &&
                     NTicks.Equals(other.NTicks)
                 ) &&
                 (
                     Equals(TickVals, other.TickVals) ||
                     TickVals != null && other.TickVals != null &&
                     TickVals.SequenceEqual(other.TickVals)
                 ) &&
                 (
                     Equals(TickText, other.TickText) ||
                     TickText != null && other.TickText != null &&
                     TickText.SequenceEqual(other.TickText)
                 ) &&
                 (
                     ShowTickLabels == other.ShowTickLabels ||
                     ShowTickLabels != null &&
                     ShowTickLabels.Equals(other.ShowTickLabels)
                 ) &&
                 (
                     TickFont == other.TickFont ||
                     TickFont != null &&
                     TickFont.Equals(other.TickFont)
                 ) &&
                 (
                     TickAngle == other.TickAngle ||
                     TickAngle != null &&
                     TickAngle.Equals(other.TickAngle)
                 ) &&
                 (
                     TickPrefix == other.TickPrefix ||
                     TickPrefix != null &&
                     TickPrefix.Equals(other.TickPrefix)
                 ) &&
                 (
                     ShowTickPrefix == other.ShowTickPrefix ||
                     ShowTickPrefix != null &&
                     ShowTickPrefix.Equals(other.ShowTickPrefix)
                 ) &&
                 (
                     TickSuffix == other.TickSuffix ||
                     TickSuffix != null &&
                     TickSuffix.Equals(other.TickSuffix)
                 ) &&
                 (
                     ShowTickSuffix == other.ShowTickSuffix ||
                     ShowTickSuffix != null &&
                     ShowTickSuffix.Equals(other.ShowTickSuffix)
                 ) &&
                 (
                     ShowExponent == other.ShowExponent ||
                     ShowExponent != null &&
                     ShowExponent.Equals(other.ShowExponent)
                 ) &&
                 (
                     ExponentFormat == other.ExponentFormat ||
                     ExponentFormat != null &&
                     ExponentFormat.Equals(other.ExponentFormat)
                 ) &&
                 (
                     MinExponent == other.MinExponent ||
                     MinExponent != null &&
                     MinExponent.Equals(other.MinExponent)
                 ) &&
                 (
                     SeparateThousands == other.SeparateThousands ||
                     SeparateThousands != null &&
                     SeparateThousands.Equals(other.SeparateThousands)
                 ) &&
                 (
                     TickFormat == other.TickFormat ||
                     TickFormat != null &&
                     TickFormat.Equals(other.TickFormat)
                 ) &&
                 (
                     Equals(TickFormatStops, other.TickFormatStops) ||
                     TickFormatStops != null && other.TickFormatStops != null &&
                     TickFormatStops.SequenceEqual(other.TickFormatStops)
                 ) &&
                 (
                     CategoryOrder == other.CategoryOrder ||
                     CategoryOrder != null &&
                     CategoryOrder.Equals(other.CategoryOrder)
                 ) &&
                 (
                     Equals(CategoryArray, other.CategoryArray) ||
                     CategoryArray != null && other.CategoryArray != null &&
                     CategoryArray.SequenceEqual(other.CategoryArray)
                 ) &&
                 (
                     LabelPadding == other.LabelPadding ||
                     LabelPadding != null &&
                     LabelPadding.Equals(other.LabelPadding)
                 ) &&
                 (
                     LabelPrefix == other.LabelPrefix ||
                     LabelPrefix != null &&
                     LabelPrefix.Equals(other.LabelPrefix)
                 ) &&
                 (
                     LabelSuffix == other.LabelSuffix ||
                     LabelSuffix != null &&
                     LabelSuffix.Equals(other.LabelSuffix)
                 ) &&
                 (
                     ShowLine == other.ShowLine ||
                     ShowLine != null &&
                     ShowLine.Equals(other.ShowLine)
                 ) &&
                 (
                     LineColor == other.LineColor ||
                     LineColor != null &&
                     LineColor.Equals(other.LineColor)
                 ) &&
                 (
                     LineWidth == other.LineWidth ||
                     LineWidth != null &&
                     LineWidth.Equals(other.LineWidth)
                 ) &&
                 (
                     GridColor == other.GridColor ||
                     GridColor != null &&
                     GridColor.Equals(other.GridColor)
                 ) &&
                 (
                     GridWidth == other.GridWidth ||
                     GridWidth != null &&
                     GridWidth.Equals(other.GridWidth)
                 ) &&
                 (
                     ShowGrid == other.ShowGrid ||
                     ShowGrid != null &&
                     ShowGrid.Equals(other.ShowGrid)
                 ) &&
                 (
                     MinorGridCount == other.MinorGridCount ||
                     MinorGridCount != null &&
                     MinorGridCount.Equals(other.MinorGridCount)
                 ) &&
                 (
                     MinorGridWidth == other.MinorGridWidth ||
                     MinorGridWidth != null &&
                     MinorGridWidth.Equals(other.MinorGridWidth)
                 ) &&
                 (
                     MinorGridColor == other.MinorGridColor ||
                     MinorGridColor != null &&
                     MinorGridColor.Equals(other.MinorGridColor)
                 ) &&
                 (
                     StartLine == other.StartLine ||
                     StartLine != null &&
                     StartLine.Equals(other.StartLine)
                 ) &&
                 (
                     StartLineColor == other.StartLineColor ||
                     StartLineColor != null &&
                     StartLineColor.Equals(other.StartLineColor)
                 ) &&
                 (
                     StartLineWidth == other.StartLineWidth ||
                     StartLineWidth != null &&
                     StartLineWidth.Equals(other.StartLineWidth)
                 ) &&
                 (
                     EndLine == other.EndLine ||
                     EndLine != null &&
                     EndLine.Equals(other.EndLine)
                 ) &&
                 (
                     EndlineWidth == other.EndlineWidth ||
                     EndlineWidth != null &&
                     EndlineWidth.Equals(other.EndlineWidth)
                 ) &&
                 (
                     EndlineColor == other.EndlineColor ||
                     EndlineColor != null &&
                     EndlineColor.Equals(other.EndlineColor)
                 ) &&
                 (
                     Tick0 == other.Tick0 ||
                     Tick0 != null &&
                     Tick0.Equals(other.Tick0)
                 ) &&
                 (
                     DTick == other.DTick ||
                     DTick != null &&
                     DTick.Equals(other.DTick)
                 ) &&
                 (
                     ArrayTick0 == other.ArrayTick0 ||
                     ArrayTick0 != null &&
                     ArrayTick0.Equals(other.ArrayTick0)
                 ) &&
                 (
                     ArrayDTick == other.ArrayDTick ||
                     ArrayDTick != null &&
                     ArrayDTick.Equals(other.ArrayDTick)
                 ) &&
                 (
                     TickValsSrc == other.TickValsSrc ||
                     TickValsSrc != null &&
                     TickValsSrc.Equals(other.TickValsSrc)
                 ) &&
                 (
                     TickTextSrc == other.TickTextSrc ||
                     TickTextSrc != null &&
                     TickTextSrc.Equals(other.TickTextSrc)
                 ) &&
                 (
                     CategoryArraySrc == other.CategoryArraySrc ||
                     CategoryArraySrc != null &&
                     CategoryArraySrc.Equals(other.CategoryArraySrc)
                 ));
        }
Esempio n. 17
0
        string GetSerialNumberRange()
        {
            bool result   = false;
            var  GridInfo = (DataGridView)control.Controls.Find("GridInfo", true).FirstOrDefault();

            for (int i = StartRangeLot; i <= EndRangeLot; i++) //Проверка общего диапазона
            {
                if (i == ShortSN)
                {
                    result = true; break;
                }
            }

            if (!result) //Не попал в общий диапазон
            {
                return("NotRangeLot");
            }

            using (FASEntities FAS = new FASEntities())
            {
                if (LOTID != 106)
                {
                    var R = FAS.FAS_SerialNumbers       //Проверяем сколько осталось неупакованных номеров в диапазоне Лота, которые готовы к упаковке
                            .Where(c => c.IsUsed == true && c.IsActive == true && c.IsUploaded == true && c.IsWeighted == true && c.IsPacked == false &&
                                   c.SerialNumber >= StartRangeLot && c.SerialNumber <= EndRangeLot).Count();

                    if (R == 0) //Закончились номера в диапазоне лота для упаковки
                    {
                        return("Abort");
                    }
                }
                else
                {
                    var R = FAS.FAS_SerialNumbers  //Проверяем сколько осталось неупакованных номеров в диапазоне Лота, которые готовы к упаковке
                            .Where(c => c.IsUsed == true && c.IsActive == true && c.IsPacked == false &&
                                   c.SerialNumber >= StartRangeLot && c.SerialNumber <= EndRangeLot).Count();

                    if (R == 0) //Закончились номера в диапазоне лота для упаковки
                    {
                        return("Abort");
                    }
                }
            };

            result = false;
            for (int i = StartRange; i <= EndRange; i++) //Проверка диапазона Литера
            {
                if (i == ShortSN)
                {
                    result = true; break;
                }
            }

            using (FASEntities FAS = new FASEntities())
            {
                var R = FAS.FAS_SerialNumbers  //Проверяем сколько осталось неупакованных номеров в диапазоне литера, которые готовы к упаковке
                        .Where(c => c.IsUsed == true && c.IsActive == true && c.IsUploaded == true && c.IsWeighted == true && c.IsPacked == false &&
                               c.SerialNumber >= StartRange && c.SerialNumber <= EndRange).Count();

                if (R == 0) //Закончились номера в диапазоне Литера
                {
                    FixedRange FR     = new FixedRange(LOTID, this, "В базе для этого диапазона закончились серийные номера \n выберите следующий или вызовите технолога", LitIndex);
                    var        Result = FR.ShowDialog();

                    if (Result == DialogResult.OK)
                    {
                        ArrayList[6]         = GridInfo[1, 6].Value.ToString().First() + " " + LitIndex;
                        GridInfo[1, 6].Value = ArrayList[6];
                        return("New");
                    }
                }
            };

            if (!result) //Не попал в Литер диапазон
            {
                return("NotRange");
            }

            return("False");


            #region
            //using (FASEntities FAS = new FASEntities())
            //{
            //    for (int i = 0; i < GridRange.RowCount; i++)
            //    {
            //        var st = int.Parse(GridRange[0, i].Value.ToString()); //Берем начало диапазона
            //        var end = int.Parse(GridRange[1, i].Value.ToString()); //Берем конец диапазона

            //        //Запрос по дипозону, лоту used 0, active 1
            //        var ser = FAS.FAS_SerialNumbers.Where
            //        (c => c.LOTID == (short)LOTID && c.IsUsed == true && c.IsActive == true && c.IsUploaded == true && c.IsWeighted == true
            //        && c.SerialNumber >= st && c.SerialNumber <= end && c.SerialNumber == ShortSN)
            //        .Select(c => c.SerialNumber).FirstOrDefault();

            //        if (ser == ShortSN) //Если номер в диапазоне найден, сохраняем данные, успешно выходим из метода
            //            return "False";
            //    }
            //}

            //FixedRange FR = new FixedRange(LOTID, this, "В базе для этого диапазона закончились серийные номера \n выберите следующий или вызовите технолога", LitIndex);
            //var Result = FR.ShowDialog();

            //if (Result == DialogResult.Abort)
            //    return "Abort";

            //if (Result == DialogResult.OK)
            //{
            //    GridInfo[0,6].Value = GridInfo[0,6].Value.ToString().First() + " " + LitIndex; return "New";
            //}

            //return "True";
            ////BaseC.DateFas_Start = true;
            #endregion
        }
Esempio n. 18
0
 internal int Int(FixedRange range = null) => range is null
     ? _random.Next(int.MinValue, int.MaxValue)
     : FixedRangeInt(range);
 private bool IsIntersect(SelectionRange selectionRange)
 {
     var range = MyDocument.CreateRange(selectionRange.Start, selectionRange.Length);
     var fixedRange = new FixedRange(range.Start.ToInt(), range.Length);
     var intersect = (MyDocument.Bookmarks.Select(bookmark =>
         new FixedRange(bookmark.Range.Start.ToInt(), bookmark.Range.Length))
         .Any(fixedRange.Intersect));
     return intersect;
 }
Esempio n. 20
0
 internal sbyte SByte(FixedRange range = null) => range is null
     ? (sbyte)_random.Next(sbyte.MinValue, sbyte.MaxValue + 1)
     : FixedRangeSByte(range);
Esempio n. 21
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         if (Smoothing != null)
         {
             hashCode = hashCode * 59 + Smoothing.GetHashCode();
         }
         if (Title != null)
         {
             hashCode = hashCode * 59 + Title.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (AutoTypeNumbers != null)
         {
             hashCode = hashCode * 59 + AutoTypeNumbers.GetHashCode();
         }
         if (AutoRange != null)
         {
             hashCode = hashCode * 59 + AutoRange.GetHashCode();
         }
         if (RangeMode != null)
         {
             hashCode = hashCode * 59 + RangeMode.GetHashCode();
         }
         if (Range != null)
         {
             hashCode = hashCode * 59 + Range.GetHashCode();
         }
         if (FixedRange != null)
         {
             hashCode = hashCode * 59 + FixedRange.GetHashCode();
         }
         if (CheaterType != null)
         {
             hashCode = hashCode * 59 + CheaterType.GetHashCode();
         }
         if (TickMode != null)
         {
             hashCode = hashCode * 59 + TickMode.GetHashCode();
         }
         if (NTicks != null)
         {
             hashCode = hashCode * 59 + NTicks.GetHashCode();
         }
         if (TickVals != null)
         {
             hashCode = hashCode * 59 + TickVals.GetHashCode();
         }
         if (TickText != null)
         {
             hashCode = hashCode * 59 + TickText.GetHashCode();
         }
         if (ShowTickLabels != null)
         {
             hashCode = hashCode * 59 + ShowTickLabels.GetHashCode();
         }
         if (TickFont != null)
         {
             hashCode = hashCode * 59 + TickFont.GetHashCode();
         }
         if (TickAngle != null)
         {
             hashCode = hashCode * 59 + TickAngle.GetHashCode();
         }
         if (TickPrefix != null)
         {
             hashCode = hashCode * 59 + TickPrefix.GetHashCode();
         }
         if (ShowTickPrefix != null)
         {
             hashCode = hashCode * 59 + ShowTickPrefix.GetHashCode();
         }
         if (TickSuffix != null)
         {
             hashCode = hashCode * 59 + TickSuffix.GetHashCode();
         }
         if (ShowTickSuffix != null)
         {
             hashCode = hashCode * 59 + ShowTickSuffix.GetHashCode();
         }
         if (ShowExponent != null)
         {
             hashCode = hashCode * 59 + ShowExponent.GetHashCode();
         }
         if (ExponentFormat != null)
         {
             hashCode = hashCode * 59 + ExponentFormat.GetHashCode();
         }
         if (MinExponent != null)
         {
             hashCode = hashCode * 59 + MinExponent.GetHashCode();
         }
         if (SeparateThousands != null)
         {
             hashCode = hashCode * 59 + SeparateThousands.GetHashCode();
         }
         if (TickFormat != null)
         {
             hashCode = hashCode * 59 + TickFormat.GetHashCode();
         }
         if (TickFormatStops != null)
         {
             hashCode = hashCode * 59 + TickFormatStops.GetHashCode();
         }
         if (CategoryOrder != null)
         {
             hashCode = hashCode * 59 + CategoryOrder.GetHashCode();
         }
         if (CategoryArray != null)
         {
             hashCode = hashCode * 59 + CategoryArray.GetHashCode();
         }
         if (LabelPadding != null)
         {
             hashCode = hashCode * 59 + LabelPadding.GetHashCode();
         }
         if (LabelPrefix != null)
         {
             hashCode = hashCode * 59 + LabelPrefix.GetHashCode();
         }
         if (LabelSuffix != null)
         {
             hashCode = hashCode * 59 + LabelSuffix.GetHashCode();
         }
         if (ShowLine != null)
         {
             hashCode = hashCode * 59 + ShowLine.GetHashCode();
         }
         if (LineColor != null)
         {
             hashCode = hashCode * 59 + LineColor.GetHashCode();
         }
         if (LineWidth != null)
         {
             hashCode = hashCode * 59 + LineWidth.GetHashCode();
         }
         if (GridColor != null)
         {
             hashCode = hashCode * 59 + GridColor.GetHashCode();
         }
         if (GridWidth != null)
         {
             hashCode = hashCode * 59 + GridWidth.GetHashCode();
         }
         if (ShowGrid != null)
         {
             hashCode = hashCode * 59 + ShowGrid.GetHashCode();
         }
         if (MinorGridCount != null)
         {
             hashCode = hashCode * 59 + MinorGridCount.GetHashCode();
         }
         if (MinorGridWidth != null)
         {
             hashCode = hashCode * 59 + MinorGridWidth.GetHashCode();
         }
         if (MinorGridColor != null)
         {
             hashCode = hashCode * 59 + MinorGridColor.GetHashCode();
         }
         if (StartLine != null)
         {
             hashCode = hashCode * 59 + StartLine.GetHashCode();
         }
         if (StartLineColor != null)
         {
             hashCode = hashCode * 59 + StartLineColor.GetHashCode();
         }
         if (StartLineWidth != null)
         {
             hashCode = hashCode * 59 + StartLineWidth.GetHashCode();
         }
         if (EndLine != null)
         {
             hashCode = hashCode * 59 + EndLine.GetHashCode();
         }
         if (EndlineWidth != null)
         {
             hashCode = hashCode * 59 + EndlineWidth.GetHashCode();
         }
         if (EndlineColor != null)
         {
             hashCode = hashCode * 59 + EndlineColor.GetHashCode();
         }
         if (Tick0 != null)
         {
             hashCode = hashCode * 59 + Tick0.GetHashCode();
         }
         if (DTick != null)
         {
             hashCode = hashCode * 59 + DTick.GetHashCode();
         }
         if (ArrayTick0 != null)
         {
             hashCode = hashCode * 59 + ArrayTick0.GetHashCode();
         }
         if (ArrayDTick != null)
         {
             hashCode = hashCode * 59 + ArrayDTick.GetHashCode();
         }
         if (TickValsSrc != null)
         {
             hashCode = hashCode * 59 + TickValsSrc.GetHashCode();
         }
         if (TickTextSrc != null)
         {
             hashCode = hashCode * 59 + TickTextSrc.GetHashCode();
         }
         if (CategoryArraySrc != null)
         {
             hashCode = hashCode * 59 + CategoryArraySrc.GetHashCode();
         }
         return(hashCode);
     }
 }
Esempio n. 22
0
 internal byte Byte(FixedRange range = null) => range is null
     ? (byte)_random.Next(byte.MinValue, byte.MaxValue + 1)
     : FixedRangeByte(range);