Address code review round 3 (first part)

This commit is contained in:
aldelaro5 committed 2024-08-28 01:14:00 -04:00
1 parent bfc539bd74
commit b729aee545
6 files changed
+11 -12

No files matched your search

+3 -4
View File
@@ -257,13 +257,12 @@ public abstract class BaseChainloader<TPlugin>
/// <remarks>Some plugins may be skipped if they cannot be loaded (wrong metadata, etc).</remarks>
/// <param name="plugins">Plugins to process.</param>
/// <returns>List of plugins to load in the correct load order.</returns>
protected virtual List<T> ModifyLoadOrder<T>(IList<T> plugins, Dictionary<string, T> existingPlugins)
where T : PluginInfo
protected virtual List<PluginInfo> ModifyLoadOrder(IList<PluginInfo> plugins, Dictionary<string, PluginInfo> existingPlugins)
{
// We use a sorted dictionary to ensure consistent load order
var dependencyDict =
new SortedDictionary<string, IEnumerable<string>>(StringComparer.InvariantCultureIgnoreCase);
var pluginsByGuid = new Dictionary<string, T>();
var pluginsByGuid = new Dictionary<string, PluginInfo>();
foreach (var pluginInfoGroup in plugins.GroupBy(info => info.Metadata.GUID))
{
@@ -441,7 +440,7 @@ public abstract class BaseChainloader<TPlugin>
{
invalidPlugins.Add(pluginInfo.Metadata.GUID);
existingPluginInfos.Remove(pluginInfo.Metadata.GUID);
pluginInfo.LoadContext.Dispose();
pluginInfo.LoadContext?.Dispose();
Logger.Log(LogLevel.Error,
$"Error loading [{pluginInfo}]: {(ex is ReflectionTypeLoadException re ? TypeLoader.TypeLoadExceptionToString(re) : ex.ToString())}");
@@ -7,7 +7,7 @@ using BepInEx.Preloader.Core.Patching;
namespace BepInEx.PatcherProvider;
[PatcherProviderPluginInfo("io.bepinex.bepinexpatcherprovider", "BepInExPatcherProvider", "1.0")]
[PatcherProviderPluginInfo("BepInExPatcherProvider", "BepInExPatcherProvider", "1.0")]
public class BepInExPatcherProvider : BasePatcherProvider
{
private static readonly Dictionary<string, string> AssemblyLocationsByFilename = new();
@@ -6,7 +6,7 @@ using BepInEx.Logging;
namespace BepInEx.PluginProvider;
[BepInPluginProvider("io.bepinex.bepinexpluginprovider", "BepInExPluginProvider", "1.0")]
[BepInPluginProvider("BepInExPluginProvider", "BepInExPluginProvider", "1.0")]
public class BepInExPluginProvider : BasePluginProvider
{
private static readonly Dictionary<string, string> AssemblyLocationsByFilename = new();
@@ -14,13 +14,13 @@
<ProjectReference Include="..\..\..\BepInEx.Core\BepInEx.Core.csproj"/>
<ProjectReference Include="..\..\..\BepInEx.PluginProvider\BepInEx.PluginProvider.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>Content</OutputItemType>
<OutputItemType>None</OutputItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Targets>Build;DocumentationProjectOutputGroup</Targets>
</ProjectReference>
<ProjectReference Include="..\..\..\BepInEx.PatcherProvider\BepInEx.PatcherProvider.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>Content</OutputItemType>
<OutputItemType>None</OutputItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Targets>Build;DocumentationProjectOutputGroup</Targets>
</ProjectReference>
@@ -11,13 +11,13 @@
<ProjectReference Include="..\..\..\BepInEx.Core\BepInEx.Core.csproj"/>
<ProjectReference Include="..\..\..\BepInEx.PluginProvider\BepInEx.PluginProvider.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>Content</OutputItemType>
<OutputItemType>None</OutputItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Targets>Build;DocumentationProjectOutputGroup</Targets>
</ProjectReference>
<ProjectReference Include="..\..\..\BepInEx.PatcherProvider\BepInEx.PatcherProvider.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>Content</OutputItemType>
<OutputItemType>None</OutputItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Targets>Build;DocumentationProjectOutputGroup</Targets>
</ProjectReference>
@@ -13,13 +13,13 @@
<ProjectReference Include="..\..\..\BepInEx.Core\BepInEx.Core.csproj"/>
<ProjectReference Include="..\..\..\BepInEx.PluginProvider\BepInEx.PluginProvider.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>Content</OutputItemType>
<OutputItemType>None</OutputItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Targets>Build;DocumentationProjectOutputGroup</Targets>
</ProjectReference>
<ProjectReference Include="..\..\..\BepInEx.PatcherProvider\BepInEx.PatcherProvider.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>Content</OutputItemType>
<OutputItemType>None</OutputItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Targets>Build;DocumentationProjectOutputGroup</Targets>
</ProjectReference>