BasePlugin.cs 679 B

1234567891011121314151617181920212223242526272829303132
  1. using BepInEx.Configuration;
  2. using BepInEx.Logging;
  3. namespace BepInEx.NetLauncher
  4. {
  5. public abstract class BasePlugin
  6. {
  7. public ManualLogSource Log { get; }
  8. public ConfigFile Config { get; }
  9. public HarmonyLib.Harmony HarmonyInstance { get; set; }
  10. protected BasePlugin()
  11. {
  12. var metadata = MetadataHelper.GetMetadata(this);
  13. HarmonyInstance = new HarmonyLib.Harmony("BepInEx.Plugin." + metadata.GUID);
  14. Log = Logger.CreateLogSource(metadata.Name);
  15. Config = new ConfigFile(Utility.CombinePaths(Paths.ConfigPath, metadata.GUID + ".cfg"), false, metadata);
  16. }
  17. public abstract void Load();
  18. public virtual bool Unload()
  19. {
  20. return false;
  21. }
  22. }
  23. }