feat(mod): 完成外部 DLL 事务热替换
This commit is contained in:
@@ -30,9 +30,20 @@ namespace ShrinkModFramework
|
||||
verboseLogging);
|
||||
}
|
||||
|
||||
var revisionState = ShrinkExternalModAssemblyLoader.CaptureState();
|
||||
ShrinkModNetworkManager.Configure(settings == null || settings.enableNetworkSync, verboseLogging);
|
||||
var sources = ShrinkModComponentDiscovery.Discover(settings, verboseLogging);
|
||||
await _host.ApplyAsync(sources);
|
||||
try
|
||||
{
|
||||
var sources = ShrinkModComponentDiscovery.Discover(settings, verboseLogging);
|
||||
await _host.ApplyAsync(sources);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// DLL revision discovery is part of the same composition transaction:
|
||||
// a failing replacement must not make the failed assembly current.
|
||||
ShrinkExternalModAssemblyLoader.RestoreState(revisionState);
|
||||
throw;
|
||||
}
|
||||
|
||||
if (verboseLogging)
|
||||
UnityEngine.Debug.Log($"[ShrinkModFramework] Cordis 模组组合已提交,共 {_host.Mods.Count} 个。");
|
||||
|
||||
Reference in New Issue
Block a user