From 2f717d9c67a7ffc47929699c9549388c775cc098 Mon Sep 17 00:00:00 2001 From: Martin Zikmund Date: Sat, 13 Feb 2021 12:38:25 +0100 Subject: [PATCH] feat: Support for Storage.Pickers collections --- .../FileExtensionVector.cs | 30 +++---- .../FilePickerFileTypesOrderedMap.cs | 36 ++++---- .../FilePickerSelectedFilesArray.cs | 12 +-- .../Storage/Pickers/FileExtensionVector.cs | 60 ++++++++++++++ .../Pickers/FilePickerFileTypesOrderedMap.cs | 82 +++++++++++++++++++ .../Pickers/FilePickerSelectedFilesArray.cs | 39 +++++++++ 6 files changed, 220 insertions(+), 39 deletions(-) create mode 100644 src/Uno.UWP/Storage/Pickers/FileExtensionVector.cs create mode 100644 src/Uno.UWP/Storage/Pickers/FilePickerFileTypesOrderedMap.cs create mode 100644 src/Uno.UWP/Storage/Pickers/FilePickerSelectedFilesArray.cs diff --git a/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FileExtensionVector.cs b/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FileExtensionVector.cs index 40c2b54a3c8d..18bee546b6c9 100644 --- a/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FileExtensionVector.cs +++ b/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FileExtensionVector.cs @@ -2,12 +2,12 @@ #pragma warning disable 114 // new keyword hiding namespace Windows.Storage.Pickers { - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false [global::Uno.NotImplemented] #endif public partial class FileExtensionVector : global::System.Collections.Generic.IList,global::System.Collections.Generic.IEnumerable { - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public uint Size { @@ -31,7 +31,7 @@ public uint Size // Forced skipping of method Windows.Storage.Pickers.FileExtensionVector.ReplaceAll(string[]) // Forced skipping of method Windows.Storage.Pickers.FileExtensionVector.First() // Processing: System.Collections.Generic.IList - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.IList [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public int IndexOf( string item) @@ -39,7 +39,7 @@ public int IndexOf( string item) throw new global::System.NotSupportedException(); } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.IList [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public void Insert( int index, string item) @@ -47,7 +47,7 @@ public void Insert( int index, string item) throw new global::System.NotSupportedException(); } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.IList [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public void RemoveAt( int index) @@ -55,7 +55,7 @@ public void RemoveAt( int index) throw new global::System.NotSupportedException(); } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public string this[int index] { @@ -70,7 +70,7 @@ public string this[int index] } #endif // Processing: System.Collections.Generic.ICollection - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.ICollection [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public void Add( string item) @@ -78,7 +78,7 @@ public void Add( string item) throw new global::System.NotSupportedException(); } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.ICollection [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public void Clear() @@ -86,7 +86,7 @@ public void Clear() throw new global::System.NotSupportedException(); } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.ICollection [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public bool Contains( string item) @@ -94,7 +94,7 @@ public bool Contains( string item) throw new global::System.NotSupportedException(); } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.ICollection [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public void CopyTo( string[] array, int arrayIndex) @@ -102,7 +102,7 @@ public void CopyTo( string[] array, int arrayIndex) throw new global::System.NotSupportedException(); } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.ICollection [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public bool Remove( string item) @@ -110,7 +110,7 @@ public bool Remove( string item) throw new global::System.NotSupportedException(); } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public int Count { @@ -124,7 +124,7 @@ public int Count } } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public bool IsReadOnly { @@ -139,7 +139,7 @@ public bool IsReadOnly } #endif // Processing: System.Collections.Generic.IEnumerable - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.IEnumerable [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::System.Collections.Generic.IEnumerator GetEnumerator() @@ -148,7 +148,7 @@ public bool IsReadOnly } #endif // Processing: System.Collections.IEnumerable - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.IEnumerable [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() diff --git a/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FilePickerFileTypesOrderedMap.cs b/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FilePickerFileTypesOrderedMap.cs index 155714edf5a2..f9004a6caa8b 100644 --- a/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FilePickerFileTypesOrderedMap.cs +++ b/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FilePickerFileTypesOrderedMap.cs @@ -2,12 +2,12 @@ #pragma warning disable 114 // new keyword hiding namespace Windows.Storage.Pickers { - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false [global::Uno.NotImplemented] #endif public partial class FilePickerFileTypesOrderedMap : global::System.Collections.Generic.IDictionary>,global::System.Collections.Generic.IEnumerable>> { - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public uint Size { @@ -26,7 +26,7 @@ public uint Size // Forced skipping of method Windows.Storage.Pickers.FilePickerFileTypesOrderedMap.Clear() // Forced skipping of method Windows.Storage.Pickers.FilePickerFileTypesOrderedMap.First() // Processing: System.Collections.Generic.IDictionary> - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.IDictionary> [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public void Add( string key, global::System.Collections.Generic.IList value) @@ -34,7 +34,7 @@ public void Add( string key, global::System.Collections.Generic.IList v throw new global::System.NotSupportedException(); } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.IDictionary> [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public bool ContainsKey( string key) @@ -42,7 +42,7 @@ public bool ContainsKey( string key) throw new global::System.NotSupportedException(); } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.IDictionary> [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public bool Remove( string key) @@ -50,7 +50,7 @@ public bool Remove( string key) throw new global::System.NotSupportedException(); } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.IDictionary> [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public bool TryGetValue( string key, out global::System.Collections.Generic.IList value) @@ -58,7 +58,7 @@ public bool TryGetValue( string key, out global::System.Collections.Generic.ILis throw new global::System.NotSupportedException(); } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::System.Collections.Generic.IList this[string key] { @@ -72,7 +72,7 @@ public bool TryGetValue( string key, out global::System.Collections.Generic.ILis } } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::System.Collections.Generic.ICollection Keys { @@ -86,7 +86,7 @@ public bool TryGetValue( string key, out global::System.Collections.Generic.ILis } } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::System.Collections.Generic.ICollection> Values { @@ -101,7 +101,7 @@ public bool TryGetValue( string key, out global::System.Collections.Generic.ILis } #endif // Processing: System.Collections.Generic.ICollection>> - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.ICollection>> [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public void Add( global::System.Collections.Generic.KeyValuePair> item) @@ -109,7 +109,7 @@ public void Add( global::System.Collections.Generic.KeyValuePair>> [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public void Clear() @@ -117,7 +117,7 @@ public void Clear() throw new global::System.NotSupportedException(); } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.ICollection>> [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public bool Contains( global::System.Collections.Generic.KeyValuePair> item) @@ -125,7 +125,7 @@ public bool Contains( global::System.Collections.Generic.KeyValuePair>> [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public void CopyTo( global::System.Collections.Generic.KeyValuePair>[] array, int arrayIndex) @@ -133,7 +133,7 @@ public void CopyTo( global::System.Collections.Generic.KeyValuePair>> [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public bool Remove( global::System.Collections.Generic.KeyValuePair> item) @@ -141,7 +141,7 @@ public bool Remove( global::System.Collections.Generic.KeyValuePair>> - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.IEnumerable>> [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::System.Collections.Generic.IEnumerator>> GetEnumerator() @@ -179,7 +179,7 @@ public bool IsReadOnly } #endif // Processing: System.Collections.IEnumerable - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.IEnumerable [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() diff --git a/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FilePickerSelectedFilesArray.cs b/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FilePickerSelectedFilesArray.cs index aadf086fd739..e14fa51d87bf 100644 --- a/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FilePickerSelectedFilesArray.cs +++ b/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FilePickerSelectedFilesArray.cs @@ -2,12 +2,12 @@ #pragma warning disable 114 // new keyword hiding namespace Windows.Storage.Pickers { - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false [global::Uno.NotImplemented] #endif public partial class FilePickerSelectedFilesArray : global::System.Collections.Generic.IReadOnlyList,global::System.Collections.Generic.IEnumerable { - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public uint Size { @@ -23,7 +23,7 @@ public uint Size // Forced skipping of method Windows.Storage.Pickers.FilePickerSelectedFilesArray.GetMany(uint, Windows.Storage.StorageFile[]) // Forced skipping of method Windows.Storage.Pickers.FilePickerSelectedFilesArray.First() // Processing: System.Collections.Generic.IReadOnlyList - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::Windows.Storage.StorageFile this[int index] { @@ -38,7 +38,7 @@ public uint Size } #endif // Processing: System.Collections.Generic.IEnumerable - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.Generic.IEnumerable [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::System.Collections.Generic.IEnumerator GetEnumerator() @@ -47,7 +47,7 @@ public uint Size } #endif // Processing: System.Collections.IEnumerable - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false // DeclaringType: System.Collections.IEnumerable [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() @@ -56,7 +56,7 @@ public uint Size } #endif // Processing: System.Collections.Generic.IReadOnlyCollection - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ + #if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public int Count { diff --git a/src/Uno.UWP/Storage/Pickers/FileExtensionVector.cs b/src/Uno.UWP/Storage/Pickers/FileExtensionVector.cs new file mode 100644 index 000000000000..805867673310 --- /dev/null +++ b/src/Uno.UWP/Storage/Pickers/FileExtensionVector.cs @@ -0,0 +1,60 @@ +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Windows.Storage.Pickers +{ + /// + /// Represents a random-access collection of file name extensions. + /// + public partial class FileExtensionVector : IList, IEnumerable + { + private readonly List _items = new List(); + + internal FileExtensionVector() + { + } + + public uint Size => (uint)_items.Count; + + public int IndexOf(string item) => _items.IndexOf(item); + + public void Insert(int index, string item) => _items.Insert(index, item); + + public void RemoveAt(int index) => _items.RemoveAt(index); + + public string this[int index] + { + get => _items[index]; + set => _items[index] = value; + } + + public void Add(string item) => _items.Add(item); + + public void Clear() => _items.Clear(); + + public bool Contains(string item) => _items.Contains(item); + + public void CopyTo(string[] array, int arrayIndex) => _items.CopyTo(array, arrayIndex); + + public bool Remove(string item) => _items.Remove(item); + + public int Count + { + get => _items.Count; + set => throw new InvalidOperationException(); + } + + public bool IsReadOnly + { + get => false; + set => throw new InvalidOperationException(); + } + + public IEnumerator GetEnumerator() => _items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + } +} diff --git a/src/Uno.UWP/Storage/Pickers/FilePickerFileTypesOrderedMap.cs b/src/Uno.UWP/Storage/Pickers/FilePickerFileTypesOrderedMap.cs new file mode 100644 index 000000000000..c04e535c95a9 --- /dev/null +++ b/src/Uno.UWP/Storage/Pickers/FilePickerFileTypesOrderedMap.cs @@ -0,0 +1,82 @@ +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Windows.Storage.Pickers +{ + /// + /// Represents a collection of display names mapped to the associated file types (extensions). + /// Each element in this collection maps a display name to a corresponding collection of file name extensions. + /// The key is a single string, the value is a list/vector of strings representing one or more extension choices. + /// + public partial class FilePickerFileTypesOrderedMap : IDictionary>, IEnumerable>> + { + private readonly Dictionary> _items = new Dictionary>(); + + internal FilePickerFileTypesOrderedMap() + { + } + + public uint Size => (uint)_items.Count; + + public void Add(string key, IList value) => _items.Add(key, value); + + public bool ContainsKey(string key) => _items.ContainsKey(key); + + public bool Remove(string key) => _items.Remove(key); + + public bool TryGetValue(string key, out IList value) => _items.TryGetValue(key, out value); + + public IList this[string key] + { + get => _items[key]; + set => _items[key] = value; + } + + public ICollection Keys + { + get => _items.Keys; + set => throw new InvalidOperationException(); + } + public ICollection> Values + { + get => _items.Values; + set => throw new InvalidOperationException(); + } + + public void Add(KeyValuePair> item) => _items.Add(item.Key, item.Value); + + public void Clear() => _items.Clear(); + + public bool Contains(KeyValuePair> item) => _items.TryGetValue(item.Key, out var value) && value == item.Value; + + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + foreach (var item in _items) + { + array[arrayIndex] = item; + arrayIndex++; + } + } + + public bool Remove(KeyValuePair> item) => _items.Remove(item.Key); + + public int Count + { + get => _items.Count; + set => throw new InvalidOperationException(); + } + + public bool IsReadOnly + { + get => false; + set => throw new InvalidOperationException(); + } + + public IEnumerator>> GetEnumerator() => _items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + } +} diff --git a/src/Uno.UWP/Storage/Pickers/FilePickerSelectedFilesArray.cs b/src/Uno.UWP/Storage/Pickers/FilePickerSelectedFilesArray.cs new file mode 100644 index 000000000000..50f87e2e1535 --- /dev/null +++ b/src/Uno.UWP/Storage/Pickers/FilePickerSelectedFilesArray.cs @@ -0,0 +1,39 @@ +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Windows.Storage.Pickers +{ + /// + /// Represents a collection of storage files that the user has selected by using a file picker. + /// + public partial class FilePickerSelectedFilesArray : IReadOnlyList, IEnumerable + { + private readonly IReadOnlyList _items; + + internal FilePickerSelectedFilesArray(StorageFile[] items) + { + _items = items ?? throw new ArgumentNullException(nameof(items)); + } + + public uint Size => (uint)_items.Count; + + public StorageFile this[int index] + { + get => _items[index]; + set => throw new InvalidOperationException(); + } + + public IEnumerator GetEnumerator() => _items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + + public int Count + { + get => _items.Count; + set => throw new InvalidOperationException(); + } + } +}