diff --git a/src/OpenSearch.Client/CommonAbstractions/Extensions/TypeExtensions.cs b/src/OpenSearch.Client/CommonAbstractions/Extensions/TypeExtensions.cs index e3c659a663..798e703f75 100644 --- a/src/OpenSearch.Client/CommonAbstractions/Extensions/TypeExtensions.cs +++ b/src/OpenSearch.Client/CommonAbstractions/Extensions/TypeExtensions.cs @@ -85,18 +85,6 @@ internal static object CreateInstance(this Type t, params object[] args) where p.Length == args.Length select c; - -/* Unmerged change from project 'OpenSearch.Client(netstandard2.1)' -Before: - var ctor = constructors.FirstOrDefault(); - if (ctor == null) - throw new Exception($"Cannot create an instance of {t.FullName} because it has no constructor taking {args.Length} arguments"); - - activator = (ObjectActivator)generic.Invoke(null, new object[] { ctor }); -After: - var ctor = constructors.FirstOrDefault() ?? throw new Exception($"Cannot create an instance of {t.FullName} because it has no constructor taking {args.Length} arguments"); - activator = (ObjectActivator)generic.Invoke(null, new object[] { ctor }); -*/ var ctor = constructors.FirstOrDefault() ?? throw new Exception($"Cannot create an instance of {t.FullName} because it has no constructor taking {args.Length} arguments"); activator = (ObjectActivator)generic.Invoke(null, new object[] { ctor }); CachedActivators.TryAdd(key, activator); diff --git a/src/OpenSearch.Client/CommonAbstractions/Infer/Field/FieldResolver.cs b/src/OpenSearch.Client/CommonAbstractions/Infer/Field/FieldResolver.cs index 55dbd6cf63..482e5213df 100644 --- a/src/OpenSearch.Client/CommonAbstractions/Infer/Field/FieldResolver.cs +++ b/src/OpenSearch.Client/CommonAbstractions/Infer/Field/FieldResolver.cs @@ -86,27 +86,13 @@ public string Resolve(PropertyName property) private string Resolve(Expression expression, MemberInfo member, bool toLastToken = false) { var visitor = new FieldExpressionVisitor(_settings); - -/* Unmerged change from project 'OpenSearch.Client(netstandard2.1)' -Before: - var name = expression != null - ? visitor.Resolve(expression, toLastToken) - : member != null - ? visitor.Resolve(member) - : null; -After: - var name = (expression != null - ? visitor.Resolve(expression, toLastToken) - : member != null - ? visitor.Resolve(member) - : null) ?? throw new ArgumentException("Name resolved to null for the given Expression or MemberInfo."); -*/ - var name = (expression != null + var name = expression != null ? visitor.Resolve(expression, toLastToken) : member != null ? visitor.Resolve(member) - : null) ?? throw new ArgumentException("Name resolved to null for the given Expression or MemberInfo."); - return name; + : null; + + return name ?? throw new ArgumentException("Name resolved to null for the given Expression or MemberInfo."); } } } diff --git a/src/OpenSearch.Client/CommonAbstractions/SerializationBehavior/JsonFormatters/InterfaceGenericDictionaryResolver.cs b/src/OpenSearch.Client/CommonAbstractions/SerializationBehavior/JsonFormatters/InterfaceGenericDictionaryResolver.cs index 3d124d719d..801904062e 100644 --- a/src/OpenSearch.Client/CommonAbstractions/SerializationBehavior/JsonFormatters/InterfaceGenericDictionaryResolver.cs +++ b/src/OpenSearch.Client/CommonAbstractions/SerializationBehavior/JsonFormatters/InterfaceGenericDictionaryResolver.cs @@ -70,18 +70,6 @@ internal static object GetFormatter(Type t) Type implementationType; if (t.IsInterface) - -/* Unmerged change from project 'OpenSearch.Client(netstandard2.1)' -Before: - var readAsAttribute = t.GetCustomAttribute(); - if (readAsAttribute == null) - throw new Exception($"Unable to deserialize interface {t.FullName}"); - - implementationType = readAsAttribute.Type.IsGenericType -After: - var readAsAttribute = t.GetCustomAttribute() ?? throw new Exception($"Unable to deserialize interface {t.FullName}"); - implementationType = readAsAttribute.Type.IsGenericType -*/ { // need an implementation to deserialize interface to var readAsAttribute = t.GetCustomAttribute() ?? throw new Exception($"Unable to deserialize interface {t.FullName}"); @@ -99,31 +87,6 @@ internal static object GetFormatter(Type t) orderby p.Length descending select c; - -/* Unmerged change from project 'OpenSearch.Client(netstandard2.1)' -Before: - var ctor = constructors.FirstOrDefault(); - if (ctor == null) - throw new Exception($"Cannot create an instance of {t.FullName} because it does not " - + $"have a public constructor accepting " - + $"IDictionary<{typeArguments[0].FullName},{typeArguments[1].FullName}> argument " - + $"or a public parameterless constructor"); - - // construct a delegate for the ctor - var activatorMethod = TypeExtensions.GetActivatorMethodInfo.MakeGenericMethod(t); - var activator = activatorMethod.Invoke(null, new object[] { ctor }); - return CreateInstance(genericTypeArgs, activator, ctor.GetParameters().Length == 0); -After: - var ctor = constructors.FirstOrDefault() ?? throw new Exception($"Cannot create an instance of {t.FullName} because it does not " - + $"have a public constructor accepting " - + $"IDictionary<{typeArguments[0].FullName},{typeArguments[1].FullName}> argument " - + $"or a public parameterless constructor"); - - // construct a delegate for the ctor - var activatorMethod = activatorMethod.Invoke(null, new object[] { ctor }); - var activator = activatorMethod.Invoke(null, new object[] { ctor }); - return CreateInstance(genericTypeArgs, activator, ctor.GetParameters().Length == 0); -*/ var ctor = constructors.FirstOrDefault() ?? throw new Exception($"Cannot create an instance of {t.FullName} because it does not " + $"have a public constructor accepting " + $"IDictionary<{typeArguments[0].FullName},{typeArguments[1].FullName}> argument " @@ -173,18 +136,6 @@ internal static object GetFormatter(Type t) Type implementationType; if (t.IsInterface) - -/* Unmerged change from project 'OpenSearch.Client(netstandard2.1)' -Before: - var readAsAttribute = t.GetCustomAttribute(); - if (readAsAttribute == null) - throw new Exception($"Unable to deserialize interface {t.FullName}"); - - implementationType = readAsAttribute.Type.IsGenericType -After: - var readAsAttribute = t.GetCustomAttribute() ?? throw new Exception($"Unable to deserialize interface {t.FullName}"); - implementationType = readAsAttribute.Type.IsGenericType -*/ { // need an implementation to deserialize interface to var readAsAttribute = t.GetCustomAttribute() ?? throw new Exception($"Unable to deserialize interface {t.FullName}"); @@ -204,27 +155,6 @@ internal static object GetFormatter(Type t) orderby p.Length descending select c; - -/* Unmerged change from project 'OpenSearch.Client(netstandard2.1)' -Before: - var ctor = constructors.FirstOrDefault(); - if (ctor == null) - throw new Exception($"Cannot create an instance of {t.FullName} because it does not " - + $"have a public constructor accepting IDictionary<{typeArguments[0].FullName},{typeArguments[1].FullName}> argument"); - - // construct a delegate for the ctor - var activatorMethod = TypeExtensions.GetActivatorMethodInfo.MakeGenericMethod(t); - var activator = activatorMethod.Invoke(null, new object[] { ctor }); - return CreateInstance(genericTypeArgs, activator, ctor.GetParameters().Length == 0); -After: - var ctor = constructors.FirstOrDefault() ?? throw new Exception($"Cannot create an instance of {t.FullName} because it does not " - + $"have a public constructor accepting IDictionary<{typeArguments[0].FullName},{typeArguments[1].FullName}> argument"); - - // construct a delegate for the ctor - var activatorMethod = activatorMethod.Invoke(null, new object[] { ctor }); - var activator = activatorMethod.Invoke(null, new object[] { ctor }); - return CreateInstance(genericTypeArgs, activator, ctor.GetParameters().Length == 0); -*/ var ctor = constructors.FirstOrDefault() ?? throw new Exception($"Cannot create an instance of {t.FullName} because it does not " + $"have a public constructor accepting IDictionary<{typeArguments[0].FullName},{typeArguments[1].FullName}> argument"); @@ -297,16 +227,6 @@ public void Serialize(ref JsonWriter writer, TDictionary value, IJsonFormatterRe // TODO mutator is not used, should it? var mutator = formatterResolver.GetConnectionSettings().DefaultFieldNameInferrer; var valueFormatter = formatterResolver.GetFormatterWithVerify(); - -/* Unmerged change from project 'OpenSearch.Client(netstandard2.1)' -Before: - var valueFormatter = formatterResolver.GetFormatterWithVerify(); - - writer.WriteBeginObject(); -After: - writer.WriteBeginObject(); -*/ - writer.WriteBeginObject(); var e = GetSourceEnumerator(value); diff --git a/src/OpenSearch.Client/CommonAbstractions/SerializationBehavior/JsonFormatters/IsADictionaryFormatterResolver.cs b/src/OpenSearch.Client/CommonAbstractions/SerializationBehavior/JsonFormatters/IsADictionaryFormatterResolver.cs index 8839c7f142..9303ebd3ba 100644 --- a/src/OpenSearch.Client/CommonAbstractions/SerializationBehavior/JsonFormatters/IsADictionaryFormatterResolver.cs +++ b/src/OpenSearch.Client/CommonAbstractions/SerializationBehavior/JsonFormatters/IsADictionaryFormatterResolver.cs @@ -66,18 +66,6 @@ internal static object GetFormatter(Type t) Type implementationType; if (t.IsInterface) - -/* Unmerged change from project 'OpenSearch.Client(netstandard2.1)' -Before: - var readAsAttribute = t.GetCustomAttribute(); - if (readAsAttribute == null) - throw new Exception($"Unable to deserialize interface {t.FullName}"); - - implementationType = readAsAttribute.Type.IsGenericType -After: - var readAsAttribute = t.GetCustomAttribute() ?? throw new Exception($"Unable to deserialize interface {t.FullName}"); - implementationType = readAsAttribute.Type.IsGenericType -*/ { // need an implementation to deserialize interface to var readAsAttribute = t.GetCustomAttribute() ?? throw new Exception($"Unable to deserialize interface {t.FullName}"); @@ -95,31 +83,6 @@ internal static object GetFormatter(Type t) orderby p.Length descending select c; - -/* Unmerged change from project 'OpenSearch.Client(netstandard2.1)' -Before: - var ctor = constructors.FirstOrDefault(); - if (ctor == null) - throw new Exception($"Cannot create an instance of {t.FullName} because it does not " - + $"have a constructor accepting " - + $"{genericDictionaryInterface.FullName} argument " - + $"or a parameterless constructor"); - - // construct a delegate for the ctor - var activatorMethod = TypeExtensions.GetActivatorMethodInfo.MakeGenericMethod(t); - var activator = activatorMethod.Invoke(null, new object[] { ctor }); - return CreateInstance(genericTypeArgs.ToArray(), activator, ctor.GetParameters().Length == 0); -After: - var ctor = constructors.FirstOrDefault() ?? throw new Exception($"Cannot create an instance of {t.FullName} because it does not " - + $"have a constructor accepting " - + $"{genericDictionaryInterface.FullName} argument " - + $"or a parameterless constructor"); - - // construct a delegate for the ctor - var activatorMethod = activatorMethod.Invoke(null, new object[] { ctor }); - var activator = activatorMethod.Invoke(null, new object[] { ctor }); - return CreateInstance(genericTypeArgs.ToArray(), activator, ctor.GetParameters().Length == 0); -*/ var ctor = constructors.FirstOrDefault() ?? throw new Exception($"Cannot create an instance of {t.FullName} because it does not " + $"have a constructor accepting " + $"{genericDictionaryInterface.FullName} argument " @@ -144,25 +107,6 @@ internal class IsADictionaryBaseFormatter private readonly bool _parameterlessCtor; public IsADictionaryBaseFormatter(TypeExtensions.ObjectActivator activator, bool parameterlessCtor) - -/* Unmerged change from project 'OpenSearch.Client(netstandard2.1)' -Before: - var keyFormatter = formatterResolver.GetFormatterWithVerify() as IObjectPropertyNameFormatter; - var valueFormatter = formatterResolver.GetFormatterWithVerify(); - - writer.WriteBeginObject(); -After: - var valueFormatter = formatterResolver.GetFormatterWithVerify(); - - writer.WriteBeginObject(); -*/ - -/* Unmerged change from project 'OpenSearch.Client(netstandard2.1)' -Before: - if (keyFormatter != null) -After: - if (formatterResolver.GetFormatterWithVerify() is IObjectPropertyNameFormatter keyFormatter) -*/ { _activator = activator; _parameterlessCtor = parameterlessCtor; diff --git a/src/OpenSearch.Client/CommonOptions/Geo/Distance.cs b/src/OpenSearch.Client/CommonOptions/Geo/Distance.cs index 790fb33eeb..326f93a682 100644 --- a/src/OpenSearch.Client/CommonOptions/Geo/Distance.cs +++ b/src/OpenSearch.Client/CommonOptions/Geo/Distance.cs @@ -67,7 +67,14 @@ public Distance(string distanceUnit) return; } - var unitMeasure = unit.ToEnum() ?? throw new InvalidCastException($"cannot parse {typeof(DistanceUnit).Name} from string '{unit}'"); + var unitMeasure = unit.ToEnum(); +#pragma warning disable IDE0270 // Use coalesce expression + if (unitMeasure == null) + { + throw new InvalidCastException($"cannot parse {typeof(DistanceUnit).Name} from string '{unit}'"); + } +#pragma warning restore IDE0270 // Use coalesce expression + Unit = unitMeasure.Value; } diff --git a/src/OpenSearch.Client/Document/Multiple/Reindex/ReindexObservable.cs b/src/OpenSearch.Client/Document/Multiple/Reindex/ReindexObservable.cs index 020650e445..3bb28d2f2e 100644 --- a/src/OpenSearch.Client/Document/Multiple/Reindex/ReindexObservable.cs +++ b/src/OpenSearch.Client/Document/Multiple/Reindex/ReindexObservable.cs @@ -131,15 +131,6 @@ private BulkAllObservable> BulkAll(IEnumerable { diff --git a/src/OpenSearch.Client/Snapshot/Snapshot/SnapshotObservable/SnapshotObservable.cs b/src/OpenSearch.Client/Snapshot/Snapshot/SnapshotObservable/SnapshotObservable.cs index 1677aab0df..f0114cf438 100644 --- a/src/OpenSearch.Client/Snapshot/Snapshot/SnapshotObservable/SnapshotObservable.cs +++ b/src/OpenSearch.Client/Snapshot/Snapshot/SnapshotObservable/SnapshotObservable.cs @@ -105,20 +105,6 @@ public IDisposable Subscribe(IObserver observer) } private void Snapshot(object state) - -/* Unmerged change from project 'OpenSearch.Client(netstandard2.1)' -Before: - var observer = state as IObserver; - - if (observer == null) throw new ArgumentException("state"); - - try - { -After: - var observer = state as IObserver ?? throw new ArgumentException("state"); - try - { -*/ { var observer = state as IObserver ?? throw new ArgumentException("state"); try diff --git a/src/OpenSearch.Net/Extensions/TypeExtensions.cs b/src/OpenSearch.Net/Extensions/TypeExtensions.cs index b205c9b993..af21c85004 100644 --- a/src/OpenSearch.Net/Extensions/TypeExtensions.cs +++ b/src/OpenSearch.Net/Extensions/TypeExtensions.cs @@ -57,42 +57,6 @@ internal static object CreateInstance(this Type t, params object[] args) where p.Length == args.Length select c; - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - var ctor = constructors.FirstOrDefault(); - if (ctor == null) - throw new Exception($"Cannot create an instance of {t.FullName} because it has no constructor taking {args.Length} arguments"); - - activator = (ObjectActivator)generic.Invoke(null, new object[] { ctor }); -After: - var ctor = constructors.FirstOrDefault() ?? throw new Exception($"Cannot create an instance of {t.FullName} because it has no constructor taking {args.Length} arguments"); - activator = (ObjectActivator)generic.Invoke(null, new object[] { ctor }); -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - var ctor = constructors.FirstOrDefault(); - if (ctor == null) - throw new Exception($"Cannot create an instance of {t.FullName} because it has no constructor taking {args.Length} arguments"); - - activator = (ObjectActivator)generic.Invoke(null, new object[] { ctor }); -After: - var ctor = constructors.FirstOrDefault() ?? throw new Exception($"Cannot create an instance of {t.FullName} because it has no constructor taking {args.Length} arguments"); - activator = (ObjectActivator)generic.Invoke(null, new object[] { ctor }); -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - var ctor = constructors.FirstOrDefault(); - if (ctor == null) - throw new Exception($"Cannot create an instance of {t.FullName} because it has no constructor taking {args.Length} arguments"); - - activator = (ObjectActivator)generic.Invoke(null, new object[] { ctor }); -After: - var ctor = constructors.FirstOrDefault() ?? throw new Exception($"Cannot create an instance of {t.FullName} because it has no constructor taking {args.Length} arguments"); - activator = (ObjectActivator)generic.Invoke(null, new object[] { ctor }); -*/ var ctor = constructors.FirstOrDefault() ?? throw new Exception($"Cannot create an instance of {t.FullName} because it has no constructor taking {args.Length} arguments"); activator = (ObjectActivator)generic.Invoke(null, new object[] { ctor }); CachedActivators.TryAdd(key, activator); diff --git a/src/OpenSearch.Net/Providers/RecyclableMemoryStream.cs b/src/OpenSearch.Net/Providers/RecyclableMemoryStream.cs index 380b216e86..a9cf16f281 100644 --- a/src/OpenSearch.Net/Providers/RecyclableMemoryStream.cs +++ b/src/OpenSearch.Net/Providers/RecyclableMemoryStream.cs @@ -333,177 +333,6 @@ protected override void Dispose(bool disposing) _blocks.Clear(); base.Dispose(disposing); - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - /// - /// Equivalent to Dispose - /// -#if NETSTANDARD1_4 - public void Close() -#else - public override void Close() -#endif - { - Dispose(true); - } - - #endregion - - #region MemoryStream overrides - - /// - /// Gets or sets the capacity - /// - /// - /// Capacity is always in multiples of the memory manager's block size, unless - /// the large buffer is in use. Capacity never decreases during a stream's lifetime. - /// Explicitly setting the capacity to a lower value than the current value will have no effect. - /// This is because the buffers are all pooled by chunks and there's little reason to - /// allow stream truncation. - /// - /// Object has been disposed - public override int Capacity -After: - /// - /// Equivalent to Dispose - /// -#if NETSTANDARD1_4 - public void Close() -#else - public override void Close() => Dispose(true); - - #endregion - - #region MemoryStream overrides - - /// - /// Gets or sets the capacity - /// - /// - /// Capacity is always in multiples of the memory manager's block size, unless - /// the large buffer is in use. Capacity never decreases during a stream's lifetime. - /// Explicitly setting the capacity to a lower value than the current value will have no effect. - /// This is because the buffers are all pooled by chunks and there's little reason to - /// allow stream truncation. - /// - /// Object has been disposed - public override int Capacity -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - /// - /// Equivalent to Dispose - /// -#if NETSTANDARD1_4 - public void Close() -#else - public override void Close() -#endif - { - Dispose(true); - } - - #endregion - - #region MemoryStream overrides - - /// - /// Gets or sets the capacity - /// - /// - /// Capacity is always in multiples of the memory manager's block size, unless - /// the large buffer is in use. Capacity never decreases during a stream's lifetime. - /// Explicitly setting the capacity to a lower value than the current value will have no effect. - /// This is because the buffers are all pooled by chunks and there's little reason to - /// allow stream truncation. - /// - /// Object has been disposed - public override int Capacity -After: - /// - /// Equivalent to Dispose - /// -#if NETSTANDARD1_4 - public void Close() -#else - public override void Close() => Dispose(true); - - #endregion - - #region MemoryStream overrides - - /// - /// Gets or sets the capacity - /// - /// - /// Capacity is always in multiples of the memory manager's block size, unless - /// the large buffer is in use. Capacity never decreases during a stream's lifetime. - /// Explicitly setting the capacity to a lower value than the current value will have no effect. - /// This is because the buffers are all pooled by chunks and there's little reason to - /// allow stream truncation. - /// - /// Object has been disposed - public override int Capacity -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - /// - /// Equivalent to Dispose - /// -#if NETSTANDARD1_4 - public void Close() -#else - public override void Close() -#endif - { - Dispose(true); - } - - #endregion - - #region MemoryStream overrides - - /// - /// Gets or sets the capacity - /// - /// - /// Capacity is always in multiples of the memory manager's block size, unless - /// the large buffer is in use. Capacity never decreases during a stream's lifetime. - /// Explicitly setting the capacity to a lower value than the current value will have no effect. - /// This is because the buffers are all pooled by chunks and there's little reason to - /// allow stream truncation. - /// - /// Object has been disposed - public override int Capacity -After: - /// - /// Equivalent to Dispose - /// -#if NETSTANDARD1_4 - public void Close() -#else - public override void Close() => Dispose(true); - - #endregion - - #region MemoryStream overrides - - /// - /// Gets or sets the capacity - /// - /// - /// Capacity is always in multiples of the memory manager's block size, unless - /// the large buffer is in use. Capacity never decreases during a stream's lifetime. - /// Explicitly setting the capacity to a lower value than the current value will have no effect. - /// This is because the buffers are all pooled by chunks and there's little reason to - /// allow stream truncation. - /// - /// Object has been disposed - public override int Capacity -*/ } /// @@ -511,8 +340,12 @@ public override int Capacity /// #if NETSTANDARD1_4 public void Close() + { + Dispose(true); + } #else public override void Close() => Dispose(true); +#endif #endregion @@ -741,7 +574,7 @@ public int SafeRead(byte[] buffer, int offset, int count, ref int streamPosition /// Object has been disposed public override int Read(Span buffer) => SafeRead(buffer, ref _position); - /// + /// /// Reads from the specified position into the provided buffer /// /// Destination buffer @@ -814,39 +647,6 @@ public override void Write(byte[] buffer, int offset, int count) Buffer.BlockCopy(buffer, offset, _largeBuffer, _position, count); _position = (int)end; _length = Math.Max(_position, _length); - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - _position = (int)end; - _length = Math.Max(_position, _length); - } -After: - _position = (int)end; - _length = Math.Max(_position, _length); - } -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - _position = (int)end; - _length = Math.Max(_position, _length); - } -After: - _position = (int)end; - _length = Math.Max(_position, _length); - } -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - _position = (int)end; - _length = Math.Max(_position, _length); - } -After: - _position = (int)end; - _length = Math.Max(_position, _length); - } -*/ } #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1 @@ -865,7 +665,7 @@ public override void Write(ReadOnlySpan source) // Check for overflow if (end > MaxStreamLength) throw new IOException("Maximum capacity exceeded"); - EnsureCapacity((int)end); + EnsureCapacity((int)end); if (_largeBuffer == null) { @@ -887,8 +687,8 @@ public override void Write(ReadOnlySpan source) } } else - source.CopyTo(_largeBuffer.AsSpan(_position)); - _position = (int)end; + source.CopyTo(_largeBuffer.AsSpan(_position)); + _position = (int)end; _length = Math.Max(_position, _length); } #endif @@ -1071,7 +871,7 @@ private int InternalRead(Span buffer, int fromPosition) { if (_length - fromPosition <= 0) return 0; - int amountToCopy; + int amountToCopy; if (_largeBuffer == null) { @@ -1154,9 +954,8 @@ private void ReleaseLargeBuffer() _memoryManager.ReturnLargeBuffer(_largeBuffer, _tag); else { - if (_dirtyBuffers == null) - // We most likely will only ever need space for one - _dirtyBuffers = new List(1); + // We most likely will only ever need space for one + _dirtyBuffers ??= new List(1); _dirtyBuffers.Add(_largeBuffer); } diff --git a/src/OpenSearch.Net/Responses/Dynamic/DynamicDictionary.cs b/src/OpenSearch.Net/Responses/Dynamic/DynamicDictionary.cs index a12acb4e42..32bcfce9b4 100644 --- a/src/OpenSearch.Net/Responses/Dynamic/DynamicDictionary.cs +++ b/src/OpenSearch.Net/Responses/Dynamic/DynamicDictionary.cs @@ -74,48 +74,6 @@ public class DynamicDictionary /// A instance. public static DynamicDictionary Empty => new DynamicDictionary(); - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - public bool IsReadOnly - { - get { return false; } - } - - private static Regex SplitRegex = new Regex(@"(? false; - - private static Regex SplitRegex = new Regex(@"(? false; - - private static Regex SplitRegex = new Regex(@"(? false; - - private static Regex SplitRegex = new Regex(@"(? /// Gets a value indicating whether the is read-only. /// @@ -285,51 +243,6 @@ public bool TryGetValue(string key, out DynamicValue value) if (_backingDictionary.TryGetValue(key, out value)) return true; return false; - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - /// - /// Returns the enumeration of all dynamic member names. - /// - /// A that contains dynamic member names. - IEnumerator IEnumerable.GetEnumerator() -After: - /// - /// Returns the enumeration of all dynamic member names. - /// - /// A that contains dynamic member names. - IEnumerator IEnumerable.GetEnumerator() -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - /// - /// Returns the enumeration of all dynamic member names. - /// - /// A that contains dynamic member names. - IEnumerator IEnumerable.GetEnumerator() -After: - /// - /// Returns the enumeration of all dynamic member names. - /// - /// A that contains dynamic member names. - IEnumerator IEnumerable.GetEnumerator() -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - /// - /// Returns the enumeration of all dynamic member names. - /// - /// A that contains dynamic member names. - IEnumerator IEnumerable.GetEnumerator() -After: - /// - /// Returns the enumeration of all dynamic member names. - /// - /// A that contains dynamic member names. - IEnumerator IEnumerable.GetEnumerator() -*/ } /// @@ -347,217 +260,13 @@ IEnumerator IEnumerable.GetEnumerator() /// /// Backwards compatible access to all the KeyValue pairs, in the next release you will be able to foreach directly /// - public IEnumerable> GetKeyValues() -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - public IEnumerator GetEnumerator() - { - return _backingDictionary.Keys.GetEnumerator(); - } - - /// - /// Indicates whether the current is equal to another object of the same type. - /// - /// - /// if the current instance is equal to the parameter; otherwise, - /// . - /// - /// An instance to compare with this instance. - public bool Equals(DynamicDictionary other) -After: - public IEnumerator GetEnumerator() => _backingDictionary.Keys.GetEnumerator(); - - /// - /// Indicates whether the current is equal to another object of the same type. - /// - /// - /// if the current instance is equal to the parameter; otherwise, - /// . - /// - /// An instance to compare with this instance. - public bool Equals(DynamicDictionary other) -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - public IEnumerator GetEnumerator() - { - return _backingDictionary.Keys.GetEnumerator(); - } - - /// - /// Indicates whether the current is equal to another object of the same type. - /// - /// - /// if the current instance is equal to the parameter; otherwise, - /// . - /// - /// An instance to compare with this instance. - public bool Equals(DynamicDictionary other) -After: - public IEnumerator GetEnumerator() => _backingDictionary.Keys.GetEnumerator(); - - /// - /// Indicates whether the current is equal to another object of the same type. - /// - /// - /// if the current instance is equal to the parameter; otherwise, - /// . - /// - /// An instance to compare with this instance. - public bool Equals(DynamicDictionary other) -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - public IEnumerator GetEnumerator() - { - return _backingDictionary.Keys.GetEnumerator(); - } - - /// - /// Indicates whether the current is equal to another object of the same type. - /// - /// - /// if the current instance is equal to the parameter; otherwise, - /// . - /// - /// An instance to compare with this instance. - public bool Equals(DynamicDictionary other) -After: - public IEnumerator GetEnumerator() => _backingDictionary.Keys.GetEnumerator(); - - /// - /// Indicates whether the current is equal to another object of the same type. - /// - /// - /// if the current instance is equal to the parameter; otherwise, - /// . - /// - /// An instance to compare with this instance. - public bool Equals(DynamicDictionary other) -*/ - => _backingDictionary; - - /// - /// Returns the enumeration of all dynamic member names. - /// - /// A that contains dynamic member names. - public IEnumerator GetEnumerator() -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - /// - /// Returns the enumeration of all dynamic member names. - /// - /// A that contains dynamic member names. - public override IEnumerable GetDynamicMemberNames() - { - return _backingDictionary.Keys; - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// if the specified is equal to this instance; otherwise, - /// . - /// - public override bool Equals(object obj) -After: - /// - /// Returns the enumeration of all dynamic member names. - /// - /// A that contains dynamic member names. - public override IEnumerable GetDynamicMemberNames() => _backingDictionary.Keys; - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// if the specified is equal to this instance; otherwise, - /// . - /// - public override bool Equals(object obj) -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - /// - /// Returns the enumeration of all dynamic member names. - /// - /// A that contains dynamic member names. - public override IEnumerable GetDynamicMemberNames() - { - return _backingDictionary.Keys; - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// if the specified is equal to this instance; otherwise, - /// . - /// - public override bool Equals(object obj) -After: - /// - /// Returns the enumeration of all dynamic member names. - /// - /// A that contains dynamic member names. - public override IEnumerable GetDynamicMemberNames() => _backingDictionary.Keys; - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// if the specified is equal to this instance; otherwise, - /// . - /// - public override bool Equals(object obj) -*/ + public IEnumerable> GetKeyValues() => _backingDictionary; -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - /// - /// Returns the enumeration of all dynamic member names. - /// - /// A that contains dynamic member names. - public override IEnumerable GetDynamicMemberNames() - { - return _backingDictionary.Keys; - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// if the specified is equal to this instance; otherwise, - /// . - /// - public override bool Equals(object obj) -After: /// /// Returns the enumeration of all dynamic member names. /// /// A that contains dynamic member names. - public override IEnumerable GetDynamicMemberNames() => _backingDictionary.Keys; - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// if the specified is equal to this instance; otherwise, - /// . - /// - public override bool Equals(object obj) -*/ - => _backingDictionary.Keys.GetEnumerator(); + public IEnumerator GetEnumerator() => _backingDictionary.Keys.GetEnumerator(); /// /// Indicates whether the current is equal to another object of the same type. @@ -688,27 +397,6 @@ private static KeyValuePair GetDynamicKeyValuePair(KeyValuePair var dynamicValueKeyValuePair = new KeyValuePair(item.Key, item.Value); return dynamicValueKeyValuePair; - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - private static string GetNeutralKey(string key) -After: - private static string GetNeutralKey(string key) -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - private static string GetNeutralKey(string key) -After: - private static string GetNeutralKey(string key) -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - private static string GetNeutralKey(string key) -After: - private static string GetNeutralKey(string key) -*/ } private static string GetNeutralKey(string key) => key; diff --git a/src/OpenSearch.Net/Responses/Dynamic/DynamicValue.cs b/src/OpenSearch.Net/Responses/Dynamic/DynamicValue.cs index 6e79fdb68a..63776016ba 100644 --- a/src/OpenSearch.Net/Responses/Dynamic/DynamicValue.cs +++ b/src/OpenSearch.Net/Responses/Dynamic/DynamicValue.cs @@ -54,48 +54,6 @@ public class DynamicValue : DynamicObject, IEquatable, IConvertibl /// The value to store in the instance public DynamicValue(object value) => _value = value is DynamicValue av ? av.Value : value; - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - public bool HasValue - { - get { return _value != null; } - } - - public DynamicValue this[string name] -After: - public bool HasValue => _value != null; - - public DynamicValue this[string name] -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - public bool HasValue - { - get { return _value != null; } - } - - public DynamicValue this[string name] -After: - public bool HasValue => _value != null; - - public DynamicValue this[string name] -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - public bool HasValue - { - get { return _value != null; } - } - - public DynamicValue this[string name] -After: - public bool HasValue => _value != null; - - public DynamicValue this[string name] -*/ /// /// Gets a value indicating whether this instance has value. /// @@ -159,45 +117,6 @@ public DynamicValue this[int i] return at; } return NullValue; - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - /// - /// Gets the inner value - /// - public object Value -After: - /// - /// Gets the inner value - /// - public object Value -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - /// - /// Gets the inner value - /// - public object Value -After: - /// - /// Gets the inner value - /// - public object Value -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - /// - /// Gets the inner value - /// - public object Value -After: - /// - /// Gets the inner value - /// - public object Value -*/ } } @@ -218,93 +137,6 @@ public TypeCode GetTypeCode() if (_value == null) return TypeCode.Empty; return Type.GetTypeCode(_value.GetType()); - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - /// - /// Converts the value of this instance to an equivalent Boolean value using the specified culture-specific formatting information. - /// - /// - /// A Boolean value equivalent to the value of this instance. - /// - /// - /// An interface implementation that supplies culture-specific formatting - /// information. - /// - /// 2 - public bool ToBoolean(IFormatProvider provider) -After: - /// - /// Converts the value of this instance to an equivalent Boolean value using the specified culture-specific formatting information. - /// - /// - /// A Boolean value equivalent to the value of this instance. - /// - /// - /// An interface implementation that supplies culture-specific formatting - /// information. - /// - /// 2 - public bool ToBoolean(IFormatProvider provider) -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - /// - /// Converts the value of this instance to an equivalent Boolean value using the specified culture-specific formatting information. - /// - /// - /// A Boolean value equivalent to the value of this instance. - /// - /// - /// An interface implementation that supplies culture-specific formatting - /// information. - /// - /// 2 - public bool ToBoolean(IFormatProvider provider) -After: - /// - /// Converts the value of this instance to an equivalent Boolean value using the specified culture-specific formatting information. - /// - /// - /// A Boolean value equivalent to the value of this instance. - /// - /// - /// An interface implementation that supplies culture-specific formatting - /// information. - /// - /// 2 - public bool ToBoolean(IFormatProvider provider) -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - /// - /// Converts the value of this instance to an equivalent Boolean value using the specified culture-specific formatting information. - /// - /// - /// A Boolean value equivalent to the value of this instance. - /// - /// - /// An interface implementation that supplies culture-specific formatting - /// information. - /// - /// 2 - public bool ToBoolean(IFormatProvider provider) -After: - /// - /// Converts the value of this instance to an equivalent Boolean value using the specified culture-specific formatting information. - /// - /// - /// A Boolean value equivalent to the value of this instance. - /// - /// - /// An interface implementation that supplies culture-specific formatting - /// information. - /// - /// 2 - public bool ToBoolean(IFormatProvider provider) -*/ } /// @@ -770,27 +602,6 @@ internal bool TryParse(object defaultValue, Type targetReturnType, object value, } return dynamicValue._value != null && dynamicValue._value.Equals(compareValue); - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - public static bool operator !=(DynamicValue dynamicValue, object compareValue) -After: - public static bool operator !=(DynamicValue dynamicValue, object compareValue) -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - public static bool operator !=(DynamicValue dynamicValue, object compareValue) -After: - public static bool operator !=(DynamicValue dynamicValue, object compareValue) -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - public static bool operator !=(DynamicValue dynamicValue, object compareValue) -After: - public static bool operator !=(DynamicValue dynamicValue, object compareValue) -*/ } public static bool operator !=(DynamicValue dynamicValue, object compareValue) => !(dynamicValue == compareValue); @@ -819,51 +630,6 @@ public override bool Equals(object compareValue) } return compareValue.GetType() == typeof(DynamicValue) && Equals((DynamicValue)compareValue); - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - /// - /// Serves as a hash function for a particular type. - /// - /// A hash code for the current instance. - public override int GetHashCode() -After: - /// - /// Serves as a hash function for a particular type. - /// - /// A hash code for the current instance. - public override int GetHashCode() -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - /// - /// Serves as a hash function for a particular type. - /// - /// A hash code for the current instance. - public override int GetHashCode() -After: - /// - /// Serves as a hash function for a particular type. - /// - /// A hash code for the current instance. - public override int GetHashCode() -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - /// - /// Serves as a hash function for a particular type. - /// - /// A hash code for the current instance. - public override int GetHashCode() -After: - /// - /// Serves as a hash function for a particular type. - /// - /// A hash code for the current instance. - public override int GetHashCode() -*/ } /// @@ -985,501 +751,9 @@ public override bool TryConvert(ConvertBinder binder, out object result) return true; } return base.TryConvert(binder, out result); - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - public override string ToString() - { - return _value == null ? base.ToString() : Convert.ToString(_value); - } - - public static implicit operator bool(DynamicValue dynamicValue) - { - if (!dynamicValue.HasValue) return false; - - if (dynamicValue._value.GetType().IsValueType) return Convert.ToBoolean(dynamicValue._value); - - if (bool.TryParse(dynamicValue.ToString(CultureInfo.InvariantCulture), out var result)) return result; - - return true; - } - - public static implicit operator string(DynamicValue dynamicValue) - { - return dynamicValue.HasValue - ? Convert.ToString(dynamicValue._value) - : null; - } - - public static implicit operator int(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToInt32(dynamicValue._value); - - return int.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator Guid(DynamicValue dynamicValue) - { - if (dynamicValue._value is Guid) - { - return (Guid)dynamicValue._value; - } - - return Guid.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator DateTime(DynamicValue dynamicValue) - { - if (dynamicValue._value is DateTime) - { - return (DateTime)dynamicValue._value; - } - - return DateTime.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator TimeSpan(DynamicValue dynamicValue) - { - if (dynamicValue._value is TimeSpan) - { - return (TimeSpan)dynamicValue._value; - } - - return TimeSpan.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator long(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToInt64(dynamicValue._value); - - return long.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator float(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToSingle(dynamicValue._value); - - return float.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator decimal(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToDecimal(dynamicValue._value); - - return decimal.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); -After: - public override string ToString() => _value == null ? base.ToString() : Convert.ToString(_value); - - public static implicit operator bool(DynamicValue dynamicValue) - { - if (!dynamicValue.HasValue) return false; - - if (dynamicValue._value.GetType().IsValueType) return Convert.ToBoolean(dynamicValue._value); - - if (bool.TryParse(dynamicValue.ToString(CultureInfo.InvariantCulture), out var result)) return result; - - return true; - } - - public static implicit operator string(DynamicValue dynamicValue) => dynamicValue.HasValue - ? Convert.ToString(dynamicValue._value) - : null; - - public static implicit operator int(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToInt32(dynamicValue._value); - - return int.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - public override string ToString() - { - return _value == null ? base.ToString() : Convert.ToString(_value); - } - - public static implicit operator bool(DynamicValue dynamicValue) - { - if (!dynamicValue.HasValue) return false; - - if (dynamicValue._value.GetType().IsValueType) return Convert.ToBoolean(dynamicValue._value); - - if (bool.TryParse(dynamicValue.ToString(CultureInfo.InvariantCulture), out var result)) return result; - - return true; - } - - public static implicit operator string(DynamicValue dynamicValue) - { - return dynamicValue.HasValue - ? Convert.ToString(dynamicValue._value) - : null; - } - - public static implicit operator int(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToInt32(dynamicValue._value); - - return int.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator Guid(DynamicValue dynamicValue) - { - if (dynamicValue._value is Guid) - { - return (Guid)dynamicValue._value; - } - - return Guid.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator DateTime(DynamicValue dynamicValue) - { - if (dynamicValue._value is DateTime) - { - return (DateTime)dynamicValue._value; - } - - return DateTime.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator TimeSpan(DynamicValue dynamicValue) - { - if (dynamicValue._value is TimeSpan) - { - return (TimeSpan)dynamicValue._value; - } - - return TimeSpan.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator long(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToInt64(dynamicValue._value); - - return long.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator float(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToSingle(dynamicValue._value); - - return float.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator decimal(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToDecimal(dynamicValue._value); - - return decimal.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); -After: - public override string ToString() => _value == null ? base.ToString() : Convert.ToString(_value); - - public static implicit operator bool(DynamicValue dynamicValue) - { - if (!dynamicValue.HasValue) return false; - - if (dynamicValue._value.GetType().IsValueType) return Convert.ToBoolean(dynamicValue._value); - - if (bool.TryParse(dynamicValue.ToString(CultureInfo.InvariantCulture), out var result)) return result; - - return true; - } - - public static implicit operator string(DynamicValue dynamicValue) => dynamicValue.HasValue - ? Convert.ToString(dynamicValue._value) - : null; - - public static implicit operator int(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToInt32(dynamicValue._value); - - return int.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - public override string ToString() - { - return _value == null ? base.ToString() : Convert.ToString(_value); - } - - public static implicit operator bool(DynamicValue dynamicValue) - { - if (!dynamicValue.HasValue) return false; - - if (dynamicValue._value.GetType().IsValueType) return Convert.ToBoolean(dynamicValue._value); - - if (bool.TryParse(dynamicValue.ToString(CultureInfo.InvariantCulture), out var result)) return result; - - return true; - } - - public static implicit operator string(DynamicValue dynamicValue) - { - return dynamicValue.HasValue - ? Convert.ToString(dynamicValue._value) - : null; - } - - public static implicit operator int(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToInt32(dynamicValue._value); - - return int.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator Guid(DynamicValue dynamicValue) - { - if (dynamicValue._value is Guid) - { - return (Guid)dynamicValue._value; - } - - return Guid.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator DateTime(DynamicValue dynamicValue) - { - if (dynamicValue._value is DateTime) - { - return (DateTime)dynamicValue._value; - } - - return DateTime.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator TimeSpan(DynamicValue dynamicValue) - { - if (dynamicValue._value is TimeSpan) - { - return (TimeSpan)dynamicValue._value; - } - - return TimeSpan.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator long(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToInt64(dynamicValue._value); - - return long.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator float(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToSingle(dynamicValue._value); - - return float.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator decimal(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToDecimal(dynamicValue._value); - - return decimal.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); -After: - public override string ToString() => _value == null ? base.ToString() : Convert.ToString(_value); - - public static implicit operator bool(DynamicValue dynamicValue) - { - if (!dynamicValue.HasValue) return false; - - if (dynamicValue._value.GetType().IsValueType) return Convert.ToBoolean(dynamicValue._value); - - if (bool.TryParse(dynamicValue.ToString(CultureInfo.InvariantCulture), out var result)) return result; - - return true; - } - - public static implicit operator string(DynamicValue dynamicValue) => dynamicValue.HasValue - ? Convert.ToString(dynamicValue._value) - : null; - - public static implicit operator int(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToInt32(dynamicValue._value); - - return int.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); -*/ } - public override string ToString() -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - public static implicit operator double(DynamicValue dynamicValue) -After: - public static implicit operator Guid(DynamicValue dynamicValue) - { - if (dynamicValue._value is Guid) - { - return (Guid)dynamicValue._value; - } - - return Guid.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator DateTime(DynamicValue dynamicValue) - { - if (dynamicValue._value is DateTime) - { - return (DateTime)dynamicValue._value; - } - - return DateTime.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator TimeSpan(DynamicValue dynamicValue) - { - if (dynamicValue._value is TimeSpan) - { - return (TimeSpan)dynamicValue._value; - } - - return TimeSpan.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator long(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToInt64(dynamicValue._value); - - return long.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator float(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToSingle(dynamicValue._value); - - return float.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator decimal(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToDecimal(dynamicValue._value); - - return decimal.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator double(DynamicValue dynamicValue) -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - public static implicit operator double(DynamicValue dynamicValue) -After: - public static implicit operator Guid(DynamicValue dynamicValue) - { - if (dynamicValue._value is Guid) - { - return (Guid)dynamicValue._value; - } - - return Guid.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator DateTime(DynamicValue dynamicValue) - { - if (dynamicValue._value is DateTime) - { - return (DateTime)dynamicValue._value; - } - - return DateTime.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator TimeSpan(DynamicValue dynamicValue) - { - if (dynamicValue._value is TimeSpan) - { - return (TimeSpan)dynamicValue._value; - } - - return TimeSpan.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator long(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToInt64(dynamicValue._value); - - return long.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator float(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToSingle(dynamicValue._value); - - return float.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator decimal(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToDecimal(dynamicValue._value); - - return decimal.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator double(DynamicValue dynamicValue) -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - public static implicit operator double(DynamicValue dynamicValue) -After: - public static implicit operator Guid(DynamicValue dynamicValue) - { - if (dynamicValue._value is Guid) - { - return (Guid)dynamicValue._value; - } - - return Guid.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator DateTime(DynamicValue dynamicValue) - { - if (dynamicValue._value is DateTime) - { - return (DateTime)dynamicValue._value; - } - - return DateTime.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator TimeSpan(DynamicValue dynamicValue) - { - if (dynamicValue._value is TimeSpan) - { - return (TimeSpan)dynamicValue._value; - } - - return TimeSpan.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator long(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToInt64(dynamicValue._value); - - return long.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator float(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToSingle(dynamicValue._value); - - return float.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator decimal(DynamicValue dynamicValue) - { - if (dynamicValue._value.GetType().IsValueType) return Convert.ToDecimal(dynamicValue._value); - - return decimal.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator double(DynamicValue dynamicValue) -*/ - => _value == null ? base.ToString() : Convert.ToString(_value); + public override string ToString() => _value == null ? base.ToString() : Convert.ToString(_value); public static implicit operator bool(DynamicValue dynamicValue) { @@ -1505,9 +779,9 @@ public static implicit operator int(DynamicValue dynamicValue) public static implicit operator Guid(DynamicValue dynamicValue) { - if (dynamicValue._value is Guid) + if (dynamicValue._value is Guid guid) { - return (Guid)dynamicValue._value; + return guid; } return Guid.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); @@ -1515,9 +789,9 @@ public static implicit operator Guid(DynamicValue dynamicValue) public static implicit operator DateTime(DynamicValue dynamicValue) { - if (dynamicValue._value is DateTime) + if (dynamicValue._value is DateTime time) { - return (DateTime)dynamicValue._value; + return time; } return DateTime.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); @@ -1525,9 +799,9 @@ public static implicit operator DateTime(DynamicValue dynamicValue) public static implicit operator TimeSpan(DynamicValue dynamicValue) { - if (dynamicValue._value is TimeSpan) + if (dynamicValue._value is TimeSpan span) { - return (TimeSpan)dynamicValue._value; + return span; } return TimeSpan.Parse(dynamicValue.ToString(CultureInfo.InvariantCulture)); diff --git a/src/OpenSearch.Net/Transport/Pipeline/ResponseBuilder.cs b/src/OpenSearch.Net/Transport/Pipeline/ResponseBuilder.cs index 9bb5fbf67a..041ac11eca 100644 --- a/src/OpenSearch.Net/Transport/Pipeline/ResponseBuilder.cs +++ b/src/OpenSearch.Net/Transport/Pipeline/ResponseBuilder.cs @@ -201,29 +201,6 @@ private static bool SetSpecialTypes(string mimeType, byte[] bytes, IM ["body"] = new DynamicValue(bytes.Utf8String()) }; -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - dictionary["body"] = new DynamicValue(bytes.Utf8String()); - cs = new DynamicResponse(dictionary) as TResponse; -After: - cs = new DynamicValue(dictionary) as TResponse; -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - dictionary["body"] = new DynamicValue(bytes.Utf8String()); - cs = new DynamicResponse(dictionary) as TResponse; -After: - cs = new DynamicValue(dictionary) as TResponse; -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - dictionary["body"] = new DynamicValue(bytes.Utf8String()); - cs = new DynamicResponse(dictionary) as TResponse; -After: - cs = new DynamicValue(dictionary) as TResponse; -*/ cs = new DynamicResponse(dictionary) as TResponse; } else diff --git a/src/OpenSearch.Net/Utf8Json/Formatters/DictionaryFormatter.cs b/src/OpenSearch.Net/Utf8Json/Formatters/DictionaryFormatter.cs index a55b176539..091e49afc1 100644 --- a/src/OpenSearch.Net/Utf8Json/Formatters/DictionaryFormatter.cs +++ b/src/OpenSearch.Net/Utf8Json/Formatters/DictionaryFormatter.cs @@ -68,43 +68,9 @@ internal abstract class DictionaryFormatterBase() as IObjectPropertyNameFormatter; - var valueFormatter = formatterResolver.GetFormatterWithVerify(); - - writer.WriteBeginObject(); -After: - var valueFormatter = formatterResolver.GetFormatterWithVerify() as IObjectPropertyNameFormatter; - - writer.WriteBeginObject(); -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - var keyFormatter = formatterResolver.GetFormatterWithVerify() as IObjectPropertyNameFormatter; - var valueFormatter = formatterResolver.GetFormatterWithVerify(); - - writer.WriteBeginObject(); -After: - var valueFormatter = formatterResolver.GetFormatterWithVerify() as IObjectPropertyNameFormatter; - - writer.WriteBeginObject(); -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - var keyFormatter = formatterResolver.GetFormatterWithVerify() as IObjectPropertyNameFormatter; - var valueFormatter = formatterResolver.GetFormatterWithVerify(); - - writer.WriteBeginObject(); -After: - var valueFormatter = formatterResolver.GetFormatterWithVerify() as IObjectPropertyNameFormatter; - - writer.WriteBeginObject(); -*/ + } else { var valueFormatter = formatterResolver.GetFormatterWithVerify(); @@ -194,36 +160,6 @@ public TDictionary Deserialize(ref JsonReader reader, IJsonFormatterResolver for if (reader.ReadIsNull()) return null; - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - var keyFormatter = formatterResolver.GetFormatterWithVerify() as IObjectPropertyNameFormatter; - if (keyFormatter == null) throw new InvalidOperationException(typeof(TKey) + " does not support dictionary key deserialize."); - var valueFormatter = formatterResolver.GetFormatterWithVerify(); -After: - var keyFormatter = formatterResolver.GetFormatterWithVerify() as IObjectPropertyNameFormatter ?? throw new InvalidOperationException(typeof(TKey) + " does not support dictionary key deserialize."); - var valueFormatter = formatterResolver.GetFormatterWithVerify(); -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - var keyFormatter = formatterResolver.GetFormatterWithVerify() as IObjectPropertyNameFormatter; - if (keyFormatter == null) throw new InvalidOperationException(typeof(TKey) + " does not support dictionary key deserialize."); - var valueFormatter = formatterResolver.GetFormatterWithVerify(); -After: - var keyFormatter = formatterResolver.GetFormatterWithVerify() as IObjectPropertyNameFormatter ?? throw new InvalidOperationException(typeof(TKey) + " does not support dictionary key deserialize."); - var valueFormatter = formatterResolver.GetFormatterWithVerify(); -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - var keyFormatter = formatterResolver.GetFormatterWithVerify() as IObjectPropertyNameFormatter; - if (keyFormatter == null) throw new InvalidOperationException(typeof(TKey) + " does not support dictionary key deserialize."); - var valueFormatter = formatterResolver.GetFormatterWithVerify(); -After: - var keyFormatter = formatterResolver.GetFormatterWithVerify() as IObjectPropertyNameFormatter ?? throw new InvalidOperationException(typeof(TKey) + " does not support dictionary key deserialize."); - var valueFormatter = formatterResolver.GetFormatterWithVerify(); -*/ var keyFormatter = formatterResolver.GetFormatterWithVerify() as IObjectPropertyNameFormatter ?? throw new InvalidOperationException(typeof(TKey) + " does not support dictionary key deserialize."); var valueFormatter = formatterResolver.GetFormatterWithVerify(); diff --git a/src/OpenSearch.Net/Utf8Json/Internal/DoubleConversion/StringToDoubleConverter.cs b/src/OpenSearch.Net/Utf8Json/Internal/DoubleConversion/StringToDoubleConverter.cs index ddeb316c62..c516850b85 100644 --- a/src/OpenSearch.Net/Utf8Json/Internal/DoubleConversion/StringToDoubleConverter.cs +++ b/src/OpenSearch.Net/Utf8Json/Internal/DoubleConversion/StringToDoubleConverter.cs @@ -144,75 +144,6 @@ private enum Flags private const double empty_string_value_ = 0.0; private const double junk_string_value_ = double.NaN; private const int kMaxSignificantDigits = 772; - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - static readonly byte[] kWhitespaceTable7 = { 32, 13, 10, 9, 11, 12 }; - static readonly int kWhitespaceTable7Length = kWhitespaceTable7.Length; - - static readonly ushort[] kWhitespaceTable16 = { - 160, 8232, 8233, 5760, 6158, 8192, 8193, 8194, 8195, - 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279 - }; - static readonly int kWhitespaceTable16Length = kWhitespaceTable16.Length; -After: - private const int kBufferSize = kMaxSignificantDigits + 10; - private static readonly byte[] infinity_symbol_ = StringEncoding.UTF8.GetBytes(double.PositiveInfinity.ToString()); - private static readonly byte[] nan_symbol_ = StringEncoding.UTF8.GetBytes(double.NaN.ToString()); - private static readonly byte[] kWhitespaceTable7 = { 32, 13, 10, 9, 11, 12 }; - private static readonly int kWhitespaceTable7Length = kWhitespaceTable7.Length; - private static readonly ushort[] kWhitespaceTable16 = { - 160, 8232, 8233, 5760, 6158, 8192, 8193, 8194, 8195, - 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279 - }; - private static readonly int kWhitespaceTable16Length = kWhitespaceTable16.Length; -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - static readonly byte[] kWhitespaceTable7 = { 32, 13, 10, 9, 11, 12 }; - static readonly int kWhitespaceTable7Length = kWhitespaceTable7.Length; - - static readonly ushort[] kWhitespaceTable16 = { - 160, 8232, 8233, 5760, 6158, 8192, 8193, 8194, 8195, - 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279 - }; - static readonly int kWhitespaceTable16Length = kWhitespaceTable16.Length; -After: - private const int kBufferSize = kMaxSignificantDigits + 10; - private static readonly byte[] infinity_symbol_ = StringEncoding.UTF8.GetBytes(double.PositiveInfinity.ToString()); - private static readonly byte[] nan_symbol_ = StringEncoding.UTF8.GetBytes(double.NaN.ToString()); - private static readonly byte[] kWhitespaceTable7 = { 32, 13, 10, 9, 11, 12 }; - private static readonly int kWhitespaceTable7Length = kWhitespaceTable7.Length; - private static readonly ushort[] kWhitespaceTable16 = { - 160, 8232, 8233, 5760, 6158, 8192, 8193, 8194, 8195, - 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279 - }; - private static readonly int kWhitespaceTable16Length = kWhitespaceTable16.Length; -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - static readonly byte[] kWhitespaceTable7 = { 32, 13, 10, 9, 11, 12 }; - static readonly int kWhitespaceTable7Length = kWhitespaceTable7.Length; - - static readonly ushort[] kWhitespaceTable16 = { - 160, 8232, 8233, 5760, 6158, 8192, 8193, 8194, 8195, - 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279 - }; - static readonly int kWhitespaceTable16Length = kWhitespaceTable16.Length; -After: - private const int kBufferSize = kMaxSignificantDigits + 10; - private static readonly byte[] infinity_symbol_ = StringEncoding.UTF8.GetBytes(double.PositiveInfinity.ToString()); - private static readonly byte[] nan_symbol_ = StringEncoding.UTF8.GetBytes(double.NaN.ToString()); - private static readonly byte[] kWhitespaceTable7 = { 32, 13, 10, 9, 11, 12 }; - private static readonly int kWhitespaceTable7Length = kWhitespaceTable7.Length; - private static readonly ushort[] kWhitespaceTable16 = { - 160, 8232, 8233, 5760, 6158, 8192, 8193, 8194, 8195, - 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279 - }; - private static readonly int kWhitespaceTable16Length = kWhitespaceTable16.Length; -*/ private const int kBufferSize = kMaxSignificantDigits + 10; private static readonly byte[] infinity_symbol_ = StringEncoding.UTF8.GetBytes(double.PositiveInfinity.ToString()); private static readonly byte[] nan_symbol_ = StringEncoding.UTF8.GetBytes(double.NaN.ToString()); diff --git a/src/OpenSearch.Net/Utf8Json/Internal/Emit/MetaType.cs b/src/OpenSearch.Net/Utf8Json/Internal/Emit/MetaType.cs index 8bc2ffdd9f..f3d5fc4663 100644 --- a/src/OpenSearch.Net/Utf8Json/Internal/Emit/MetaType.cs +++ b/src/OpenSearch.Net/Utf8Json/Internal/Emit/MetaType.cs @@ -95,26 +95,6 @@ private static TAttribute GetCustomAttribute(PropertyInfo propertyIn var interfaceProperty = interfaceProperties.FirstOrDefault(); -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - return interfaceProperty != null ? interfaceProperty.GetCustomAttribute(inherit) : null; -After: - return interfaceProperty?.GetCustomAttribute(inherit) : null; -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - return interfaceProperty != null ? interfaceProperty.GetCustomAttribute(inherit) : null; -After: - return interfaceProperty?.GetCustomAttribute(inherit) : null; -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - return interfaceProperty != null ? interfaceProperty.GetCustomAttribute(inherit) : null; -After: - return interfaceProperty?.GetCustomAttribute(inherit) : null; -*/ return interfaceProperty?.GetCustomAttribute(inherit); } diff --git a/src/OpenSearch.Net/Utf8Json/Internal/GuidBits.cs b/src/OpenSearch.Net/Utf8Json/Internal/GuidBits.cs index 5dfeff66bd..8f6e79f2e3 100644 --- a/src/OpenSearch.Net/Utf8Json/Internal/GuidBits.cs +++ b/src/OpenSearch.Net/Utf8Json/Internal/GuidBits.cs @@ -95,56 +95,11 @@ internal struct GuidBits [FieldOffset(15)] public readonly byte Byte15; - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[0])) - static byte[] byteToHexStringHigh = new byte[256] { 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102 }; - - // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[1])) - static byte[] byteToHexStringLow = new byte[256] { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102 }; -After: // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[0])) - private static byte[] byteToHexStringHigh = new byte[256] { 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102 }; + private static byte[] byteToHexStringHigh = [48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102]; // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[1])) - private static byte[] byteToHexStringLow = new byte[256] { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102 }; -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[0])) - static byte[] byteToHexStringHigh = new byte[256] { 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102 }; - - // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[1])) - static byte[] byteToHexStringLow = new byte[256] { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102 }; -After: - // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[0])) - private static byte[] byteToHexStringHigh = new byte[256] { 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102 }; - - // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[1])) - private static byte[] byteToHexStringLow = new byte[256] { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102 }; -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[0])) - static byte[] byteToHexStringHigh = new byte[256] { 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102 }; - - // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[1])) - static byte[] byteToHexStringLow = new byte[256] { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102 }; -After: - // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[0])) - private static byte[] byteToHexStringHigh = new byte[256] { 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102 }; - - // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[1])) - private static byte[] byteToHexStringLow = new byte[256] { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102 }; -*/ - // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[0])) - private static byte[] byteToHexStringHigh = new byte[256] { 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102 }; - - // string.Join(", ", Enumerable.Range(0, 256).Select(x => (int)BitConverter.ToString(new byte[] { (byte)x }).ToLower()[1])) - private static byte[] byteToHexStringLow = new byte[256] { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102 }; + private static byte[] byteToHexStringLow = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102]; public GuidBits(ref Guid value) { @@ -348,31 +303,6 @@ private static byte SwitchParse(byte b) case 61: case 62: case 63: - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - case 64: - case 71: -After: - case 71: -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - case 64: - case 71: -After: - case 71: -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - case 64: - case 71: -After: - case 71: -*/ - case 64: case 64: case 71: case 72: @@ -399,7 +329,7 @@ private static byte SwitchParse(byte b) case 93: case 94: case 95: - case 96: + case 96: default: throw new ArgumentException("Invalid Guid Pattern."); } diff --git a/src/OpenSearch.Net/Utf8Json/Internal/ThreadsafeTypeKeyHashTable.cs b/src/OpenSearch.Net/Utf8Json/Internal/ThreadsafeTypeKeyHashTable.cs index 16a786805e..0083fa04f0 100644 --- a/src/OpenSearch.Net/Utf8Json/Internal/ThreadsafeTypeKeyHashTable.cs +++ b/src/OpenSearch.Net/Utf8Json/Internal/ThreadsafeTypeKeyHashTable.cs @@ -114,27 +114,6 @@ private bool TryAddInternal(Type key, Func valueFactory, out TValu var successAdd = AddToBuckets(_buckets, key, null, valueFactory, out resultingValue); if (successAdd) _size++; return successAdd; - -/* Unmerged change from project 'OpenSearch.Net(netstandard2.1)' -Before: - bool AddToBuckets(Entry[] buckets, Type newKey, Entry newEntryOrNull, Func valueFactory, out TValue resultingValue) -After: - private bool AddToBuckets(Entry[] buckets, Type newKey, Entry newEntryOrNull, Func valueFactory, out TValue resultingValue) -*/ - -/* Unmerged change from project 'OpenSearch.Net(net6.0)' -Before: - bool AddToBuckets(Entry[] buckets, Type newKey, Entry newEntryOrNull, Func valueFactory, out TValue resultingValue) -After: - private bool AddToBuckets(Entry[] buckets, Type newKey, Entry newEntryOrNull, Func valueFactory, out TValue resultingValue) -*/ - -/* Unmerged change from project 'OpenSearch.Net(net8.0)' -Before: - bool AddToBuckets(Entry[] buckets, Type newKey, Entry newEntryOrNull, Func valueFactory, out TValue resultingValue) -After: - private bool AddToBuckets(Entry[] buckets, Type newKey, Entry newEntryOrNull, Func valueFactory, out TValue resultingValue) -*/ } } }