mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-19 15:51:45 +00:00
33 lines
943 B
C#
33 lines
943 B
C#
using System;
|
|
using System.IO;
|
|
|
|
namespace BepInEx.PluginProvider;
|
|
|
|
internal class BepInExPluginLoadContext : IPluginLoadContext
|
|
{
|
|
public string AssemblyIdentifier { get; internal set; }
|
|
public string AssemblyHash { get; internal set; }
|
|
public byte[] GetAssemblyData()
|
|
{
|
|
return File.ReadAllBytes(AssemblyIdentifier);
|
|
}
|
|
|
|
public byte[] GetAssemblySymbolsData()
|
|
{
|
|
if (Utility.TryResolveAssemblySymbols(AssemblyIdentifier, out var assemblySymbolsData))
|
|
return assemblySymbolsData;
|
|
|
|
return assemblySymbolsData;
|
|
}
|
|
|
|
public byte[] GetFile(string relativePath)
|
|
{
|
|
if (relativePath == null)
|
|
throw new ArgumentNullException(nameof(relativePath));
|
|
|
|
string assemblyFolder = Path.GetDirectoryName(AssemblyIdentifier);
|
|
string filePath = Path.Combine(assemblyFolder, relativePath);
|
|
return File.ReadAllBytes(filePath);
|
|
}
|
|
}
|