From 4a4719c7c5c107a1ff2c798ca97fb2e1875c092c Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Mon, 6 Apr 2020 02:46:31 -0500 Subject: [PATCH] Exposed IgnoredPlugins to the world --- IPA.Loader/Loader/PluginManager.cs | 6 ++++ Net3-Proxy/IReadOnlyList.cs | 29 ---------------- Net3-Proxy/Net3-Proxy.csproj | 2 +- Net3-Proxy/ReadOnlyCollections.cs | 53 ++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 30 deletions(-) delete mode 100644 Net3-Proxy/IReadOnlyList.cs create mode 100644 Net3-Proxy/ReadOnlyCollections.cs diff --git a/IPA.Loader/Loader/PluginManager.cs b/IPA.Loader/Loader/PluginManager.cs index 06df93d5..c8af2db6 100644 --- a/IPA.Loader/Loader/PluginManager.cs +++ b/IPA.Loader/Loader/PluginManager.cs @@ -305,6 +305,12 @@ namespace IPA.Loader public static IEnumerable DisabledPlugins => PluginLoader.DisabledPlugins; private static readonly HashSet runtimeDisabledPlugins = new HashSet(); + /// + /// Gets a read-only dictionary of an ignored plugin to the reason it was ignored, as an . + /// + /// a dictionary of to of ignored plugins + public static IReadOnlyDictionary IgnoredPlugins => PluginLoader.ignoredPlugins; + /// /// An of old IPA plugins. /// diff --git a/Net3-Proxy/IReadOnlyList.cs b/Net3-Proxy/IReadOnlyList.cs deleted file mode 100644 index b32792ea..00000000 --- a/Net3-Proxy/IReadOnlyList.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Net3_Proxy -{ - - public class IReadOnlyList : IEnumerable - { - private IList list; - - private IReadOnlyList(IList lst) - { - list = lst; - } - - public IEnumerator GetEnumerator() => list.GetEnumerator(); - - IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)list).GetEnumerator(); - - public int Count => list.Count; - - public T this[int index] => list[index]; - - public static implicit operator IReadOnlyList(List list) => new IReadOnlyList(list); - } -} diff --git a/Net3-Proxy/Net3-Proxy.csproj b/Net3-Proxy/Net3-Proxy.csproj index f98daa50..7d2de56c 100644 --- a/Net3-Proxy/Net3-Proxy.csproj +++ b/Net3-Proxy/Net3-Proxy.csproj @@ -45,7 +45,7 @@ - + diff --git a/Net3-Proxy/ReadOnlyCollections.cs b/Net3-Proxy/ReadOnlyCollections.cs new file mode 100644 index 00000000..8dd3dcc5 --- /dev/null +++ b/Net3-Proxy/ReadOnlyCollections.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Net3_Proxy +{ + + public class IReadOnlyList : IEnumerable + { + private readonly IList list; + + private IReadOnlyList(IList lst) + => list = lst; + + public IEnumerator GetEnumerator() => list.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)list).GetEnumerator(); + + public int Count => list.Count; + + public T this[int index] => list[index]; + + public static implicit operator IReadOnlyList(List list) => new IReadOnlyList(list); + } + + public class IReadOnlyDictionary : IEnumerable> + { + private readonly IDictionary dict; + + private IReadOnlyDictionary(IDictionary d) + => dict = d; + + public IEnumerator> GetEnumerator() + => dict.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => dict.GetEnumerator(); + + public int Count => dict.Count; + + public bool ContainsKey(TKey key) => dict.ContainsKey(key); + + public bool TryGetValue(TKey key, out TValue val) + => dict.TryGetValue(key, out val); + + public TValue this[TKey key] => dict[key]; + + public static implicit operator IReadOnlyDictionary(Dictionary dict) + => new IReadOnlyDictionary(dict); + } +}