mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-19 15:51:45 +00:00
Address code review round 5
This commit is contained in:
1 parent
7315b7dd66
commit
be1beb5e13
10 files changed
+44
-25
No files matched your search
@@ -12,6 +12,9 @@
|
||||
<PackageReference Include="SemanticVersioning" Version="2.0.2"/>
|
||||
<PackageReference Include="MonoMod.Utils" Version="22.5.1.1"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Contract\IPlugin.cs"/>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- CopyLocalLockFileAssemblies causes to also output shared assemblies: https://github.com/NuGet/Home/issues/4837#issuecomment-354536302 -->
|
||||
<!-- Since all core assemblies usually follow naming of System.*, we just delete them for now -->
|
||||
|
||||
@@ -19,6 +19,8 @@ public abstract class BaseChainloader<TPlugin>
|
||||
|
||||
private static Regex allowedGuidRegex { get; } = new(@"^[a-zA-Z0-9\._\-]+$");
|
||||
|
||||
internal BaseChainloader() { }
|
||||
|
||||
/// <summary>
|
||||
/// Analyzes the given type definition and attempts to convert it to a valid <see cref="PluginInfo" />
|
||||
/// </summary>
|
||||
@@ -369,6 +371,12 @@ public abstract class BaseChainloader<TPlugin>
|
||||
Logger.Log(LogLevel.Message, "Chainloader startup complete");
|
||||
}
|
||||
|
||||
[Obsolete("Use a plugin provider instead", true)]
|
||||
public IList<PluginInfo> LoadPlugins(params string[] pluginsPaths)
|
||||
{
|
||||
throw new NotSupportedException("Use a plugin provider instead");
|
||||
}
|
||||
|
||||
private void LoadPlugins(List<PluginInfo> plugins, bool provider)
|
||||
{
|
||||
var existingPluginInfos = provider ? Providers : Plugins;
|
||||
|
||||
@@ -1,23 +1,28 @@
|
||||
using BepInEx.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BepInEx.Configuration;
|
||||
using BepInEx.Logging;
|
||||
|
||||
namespace BepInEx.Contract;
|
||||
|
||||
internal interface IPlugin
|
||||
namespace BepInEx.Contract
|
||||
{
|
||||
/// <summary>
|
||||
/// Information about this plugin as it was loaded.
|
||||
/// </summary>
|
||||
PluginInfo Info { get; }
|
||||
public interface IPlugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Information about this plugin as it was loaded.
|
||||
/// </summary>
|
||||
PluginInfo Info { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Logger instance tied to this plugin.
|
||||
/// </summary>
|
||||
ManualLogSource Log { get; }
|
||||
/// <summary>
|
||||
/// Logger instance tied to this plugin.
|
||||
/// </summary>
|
||||
ManualLogSource Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Default config file tied to this plugin. The config file will not be created until
|
||||
/// any settings are added and changed, or <see cref="ConfigFile.Save"/> is called.
|
||||
/// </summary>
|
||||
ConfigFile Config { get; }
|
||||
/// <summary>
|
||||
/// Default config file tied to this plugin. The config file will not be created until
|
||||
/// any settings are added and changed, or <see cref="ConfigFile.Save"/> is called.
|
||||
/// </summary>
|
||||
ConfigFile Config { get; }
|
||||
}
|
||||
}
|
||||
@@ -229,8 +229,6 @@ public static class Utility
|
||||
/// <returns>True, if the symbols were found. Otherwise, false.</returns>
|
||||
public static bool TryResolveAssemblySymbols(string dllPath, out byte[] symbolsData)
|
||||
{
|
||||
symbolsData = null;
|
||||
|
||||
var subDirectory = Path.GetDirectoryName(dllPath);
|
||||
|
||||
var potentialSymbolsFileNames = new[]
|
||||
@@ -257,6 +255,7 @@ public static class Utility
|
||||
return true;
|
||||
}
|
||||
|
||||
symbolsData = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<TargetFrameworks>net35;netstandard2.0</TargetFrameworks>
|
||||
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
|
||||
<Description>BepInEx patcher provider module</Description>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<TargetFrameworks>net35;netstandard2.0</TargetFrameworks>
|
||||
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
|
||||
<Description>BepInEx plugin provider module</Description>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
using System;
|
||||
using BepInEx.Bootstrap;
|
||||
using BepInEx.Configuration;
|
||||
using BepInEx.Contract;
|
||||
using BepInEx.Logging;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace BepInEx.NET.Common
|
||||
{
|
||||
public abstract class BasePlugin : IPlugin
|
||||
public abstract class BasePlugin
|
||||
{
|
||||
protected BasePlugin()
|
||||
{
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
using System;
|
||||
using BepInEx.Bootstrap;
|
||||
using BepInEx.Configuration;
|
||||
using BepInEx.Contract;
|
||||
using BepInEx.Logging;
|
||||
using Il2CppInterop.Runtime.InteropTypes;
|
||||
|
||||
namespace BepInEx.Unity.IL2CPP;
|
||||
|
||||
public abstract class BasePlugin : IPlugin
|
||||
public abstract class BasePlugin
|
||||
{
|
||||
protected BasePlugin()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using BepInEx.Bootstrap;
|
||||
using BepInEx.Configuration;
|
||||
using BepInEx.Contract;
|
||||
using BepInEx.Logging;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
@@ -42,6 +42,12 @@ public class UnityChainloader : BaseChainloader<BaseUnityPlugin>
|
||||
/// </summary>
|
||||
public static GameObject ManagerObject { get; private set; }
|
||||
|
||||
public static new UnityChainloader Instance
|
||||
{
|
||||
get => (UnityChainloader)BaseChainloader<BaseUnityPlugin>.Instance;
|
||||
set => BaseChainloader<BaseUnityPlugin>.Instance = value;
|
||||
}
|
||||
|
||||
protected override string ConsoleTitle => _consoleTitle;
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user