diff --git a/src/ComputeSharp.D2D1.Uwp/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs b/src/ComputeSharp.D2D1.Uwp/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs index f0d90bd3..f210f0f8 100644 --- a/src/ComputeSharp.D2D1.Uwp/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs +++ b/src/ComputeSharp.D2D1.Uwp/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs @@ -1,4 +1,6 @@ using System; +using System.Collections; +using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; @@ -7,7 +9,7 @@ using ComputeSharp.D2D1.Interop; using ComputeSharp.D2D1.Shaders.Loaders; using ComputeSharp.D2D1.Uwp.Buffers; -#pragma warning disable CS0618 +#pragma warning disable CS0618, CS8767 namespace ComputeSharp.D2D1.Uwp; @@ -17,7 +19,7 @@ partial class PixelShaderEffect /// /// Represents the collection of objects in a instance. /// - public sealed class ResourceTextureManagerCollection + public sealed class ResourceTextureManagerCollection : IList, IReadOnlyList, IList, IFixedCountList { /// /// The bitmask of valid indices for resource texture managers in the current shader type. @@ -38,10 +40,8 @@ partial class PixelShaderEffect Owner = owner; } - /// - /// Gets the collection of valid resource texture indices for the current effect. - /// - internal static ImmutableArray Indices { get; } = GetIndices(); + /// + public int Count => Indices.Length; /// /// Gets or sets the object at a specified index. @@ -72,6 +72,18 @@ partial class PixelShaderEffect } } + /// + object? IList.this[int index] + { + get => this[index]; + set => this[index] = (D2D1ResourceTextureManager?)value!; + } + + /// + /// Gets the collection of valid resource texture indices for the current effect. + /// + internal static ImmutableArray Indices { get; } = GetIndices(); + /// /// The owning instance. /// @@ -82,6 +94,132 @@ partial class PixelShaderEffect /// internal ref ResourceTextureManagerBuffer Storage => ref this.fixedBuffer; + /// + ImmutableArray IFixedCountList.Indices => Indices; + + /// + bool ICollection.IsReadOnly => false; + + /// + bool IList.IsReadOnly => false; + + /// + bool IList.IsFixedSize => true; + + /// + bool ICollection.IsSynchronized => true; + + /// + object ICollection.SyncRoot => throw new NotSupportedException("ICollection.SyncRoot is not supported for ResourceTextureManagerCollection."); + + /// + void ICollection.Add(D2D1ResourceTextureManager? item) + { + throw new NotSupportedException("ICollection.Add is not supported for ResourceTextureManagerCollection."); + } + + /// + int IList.Add(object value) + { + throw new NotSupportedException("IList.Add is not supported for ResourceTextureManagerCollection."); + } + + /// + void ICollection.Clear() + { + throw new NotSupportedException("ICollection.Clear is not supported for ResourceTextureManagerCollection."); + } + + /// + void IList.Clear() + { + throw new NotSupportedException("IList.Clear is not supported for ResourceTextureManagerCollection."); + } + + /// + bool ICollection.Contains(D2D1ResourceTextureManager? item) + { + return FixedCountList.IndexOf(this, item) != -1; + } + + /// + bool IList.Contains(object value) + { + return FixedCountList.IndexOf(this, (D2D1ResourceTextureManager?)value) != -1; + } + + /// + void ICollection.CopyTo(D2D1ResourceTextureManager?[] array, int arrayIndex) + { + FixedCountList.CopyTo(this, array, arrayIndex); + } + + /// + void ICollection.CopyTo(Array array, int index) + { + FixedCountList.CopyTo(this, array, index); + } + + /// + IEnumerator IEnumerable.GetEnumerator() + { + return FixedCountList.GetEnumerator(this); + } + + /// + IEnumerator IEnumerable.GetEnumerator() + { + return FixedCountList.GetEnumerator(this); + } + + /// + int IList.IndexOf(D2D1ResourceTextureManager? item) + { + return FixedCountList.IndexOf(this, item); + } + + /// + int IList.IndexOf(object value) + { + return FixedCountList.IndexOf(this, (D2D1ResourceTextureManager?)value); + } + + /// + void IList.Insert(int index, D2D1ResourceTextureManager? item) + { + throw new NotSupportedException("IList.Insert is not supported for ResourceTextureManagerCollection."); + } + + /// + void IList.Insert(int index, object value) + { + throw new NotSupportedException("IList.Insert is not supported for ResourceTextureManagerCollection."); + } + + /// + bool ICollection.Remove(D2D1ResourceTextureManager? item) + { + throw new NotSupportedException("ICollection.Remove is not supported for ResourceTextureManagerCollection."); + } + + /// + void IList.Remove(object value) + { + throw new NotSupportedException("IList.Remove is not supported for ResourceTextureManagerCollection."); + } + + /// + void IList.RemoveAt(int index) + { + throw new NotSupportedException("IList.RemoveAt is not supported for ResourceTextureManagerCollection."); + } + + /// + void IList.RemoveAt(int index) + { + throw new NotSupportedException("IList.RemoveAt is not supported for ResourceTextureManagerCollection."); + } + /// /// Validates the input index for . ///