Browse Source

Exposed IgnoredPlugins to the world

pull/44/head
Anairkoen Schno 4 years ago
parent
commit
4a4719c7c5
4 changed files with 60 additions and 30 deletions
  1. +6
    -0
      IPA.Loader/Loader/PluginManager.cs
  2. +0
    -29
      Net3-Proxy/IReadOnlyList.cs
  3. +1
    -1
      Net3-Proxy/Net3-Proxy.csproj
  4. +53
    -0
      Net3-Proxy/ReadOnlyCollections.cs

+ 6
- 0
IPA.Loader/Loader/PluginManager.cs View File

@ -305,6 +305,12 @@ namespace IPA.Loader
public static IEnumerable<PluginMetadata> DisabledPlugins => PluginLoader.DisabledPlugins; public static IEnumerable<PluginMetadata> DisabledPlugins => PluginLoader.DisabledPlugins;
private static readonly HashSet<PluginExecutor> runtimeDisabledPlugins = new HashSet<PluginExecutor>(); private static readonly HashSet<PluginExecutor> runtimeDisabledPlugins = new HashSet<PluginExecutor>();
/// <summary>
/// Gets a read-only dictionary of an ignored plugin to the reason it was ignored, as an <see cref="IgnoreReason"/>.
/// </summary>
/// <value>a dictionary of <see cref="PluginMetadata"/> to <see cref="IgnoreReason"/> of ignored plugins</value>
public static IReadOnlyDictionary<PluginMetadata, IgnoreReason> IgnoredPlugins => PluginLoader.ignoredPlugins;
/// <summary> /// <summary>
/// An <see cref="IEnumerable{T}"/> of old IPA plugins. /// An <see cref="IEnumerable{T}"/> of old IPA plugins.
/// </summary> /// </summary>


+ 0
- 29
Net3-Proxy/IReadOnlyList.cs View File

@ -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<T> : IEnumerable<T>
{
private IList<T> list;
private IReadOnlyList(IList<T> lst)
{
list = lst;
}
public IEnumerator<T> 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<T>(List<T> list) => new IReadOnlyList<T>(list);
}
}

+ 1
- 1
Net3-Proxy/Net3-Proxy.csproj View File

@ -45,7 +45,7 @@
<Compile Include="ExpressionEx.cs" /> <Compile Include="ExpressionEx.cs" />
<Compile Include="Extensions.cs" /> <Compile Include="Extensions.cs" />
<Compile Include="File.cs" /> <Compile Include="File.cs" />
<Compile Include="IReadOnlyList.cs" />
<Compile Include="ReadOnlyCollections.cs" />
<Compile Include="Path.cs" /> <Compile Include="Path.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TaskEx6.cs" /> <Compile Include="TaskEx6.cs" />


+ 53
- 0
Net3-Proxy/ReadOnlyCollections.cs View File

@ -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<T> : IEnumerable<T>
{
private readonly IList<T> list;
private IReadOnlyList(IList<T> lst)
=> list = lst;
public IEnumerator<T> 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<T>(List<T> list) => new IReadOnlyList<T>(list);
}
public class IReadOnlyDictionary<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>
{
private readonly IDictionary<TKey, TValue> dict;
private IReadOnlyDictionary(IDictionary<TKey, TValue> d)
=> dict = d;
public IEnumerator<KeyValuePair<TKey, TValue>> 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<TKey, TValue>(Dictionary<TKey, TValue> dict)
=> new IReadOnlyDictionary<TKey, TValue>(dict);
}
}

Loading…
Cancel
Save