Skip to content

Commit

Permalink
Prefer shared types in plugin loader (#4060)
Browse files Browse the repository at this point in the history
  • Loading branch information
aquafir authored Nov 28, 2023
1 parent 6d5f47a commit ca5c50f
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions Source/ACE.Server/Mods/ModContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ModContainer
public ModMetadata Meta { get; set; }
public ModStatus Status = ModStatus.Unloaded;

public Assembly ModAssembly { get; set; }
public Assembly ModAssembly { get; set; }
public Type ModType { get; set; }
public IHarmonyMod Instance { get; set; }

Expand All @@ -36,7 +36,6 @@ public class ModContainer
ModAssembly.ManifestModule.ScopeName.Replace(".dll", "." + ModMetadata.TYPENAME);

public PluginLoader Loader { get; private set; }
//private FileSystemWatcher _dllWatcher;
private DateTime _lastChange = DateTime.Now;

/// <summary>
Expand All @@ -50,31 +49,16 @@ public void Initialize()
return;
}

//Watching for changes in the dll might be needed if it has unreleased resources?
//https://github.com/natemcmaster/DotNetCorePlugins/issues/86
//_dllWatcher = new FileSystemWatcher()
//{
// Path = FolderPath,
// //Filter = DllPath,
// Filter = $"{FolderName}.dll",
// EnableRaisingEvents = true,
// NotifyFilter = NotifyFilters.LastWrite //?
//};
//_dllWatcher.Changed += ModDll_Changed;
//_dllWatcher.Created += ModDll_Created;
//_dllWatcher.Renamed += ModDll_Renamed;
//_dllWatcher.Deleted += ModDll_Changed;
//_dllWatcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName;

Loader = PluginLoader.CreateFromAssemblyFile(
assemblyFile: DllPath,
isUnloadable: true,
sharedTypes: new Type[] { },
sharedTypes: new Type[] { },
configure: config =>
{
config.EnableHotReload = Meta.HotReload;
config.IsLazyLoaded = false; //?
}
config.IsLazyLoaded = false;
config.PreferSharedTypes = true;
}
);
Loader.Reloaded += Reload;

Expand Down

0 comments on commit ca5c50f

Please sign in to comment.