Browse Source

Minor tweak to organization of CommitTransaction

pull/46/head
Anairkoen Schno 4 years ago
parent
commit
f8c28a2e7e
1 changed files with 4 additions and 8 deletions
  1. +4
    -8
      IPA.Loader/Loader/PluginManager.cs

+ 4
- 8
IPA.Loader/Loader/PluginManager.cs View File

@ -81,19 +81,15 @@ namespace IPA.Loader
internal static Task CommitTransaction(StateTransitionTransaction transaction)
{
if (UnityGame.OnMainThread)
return CommitTransactionInternal(transaction);
else
return UnityMainThreadTaskScheduler.Factory.StartNew(() => CommitTransactionInternal(transaction)).Unwrap();
}
private static Task CommitTransactionInternal(StateTransitionTransaction transaction)
{
if (!UnityGame.OnMainThread)
return UnityMainThreadTaskScheduler.Factory.StartNew(() => CommitTransaction(transaction)).Unwrap();
lock (commitTransactionLockObject)
{
if (transaction.CurrentlyEnabled.Except(AllPlugins)
.Concat(AllPlugins.Except(transaction.CurrentlyEnabled)).Any()
|| transaction.CurrentlyDisabled.Except(DisabledPlugins)
.Concat(DisabledPlugins.Except(transaction.DisabledPlugins)).Any())
.Concat(DisabledPlugins.Except(transaction.CurrentlyDisabled)).Any())
{ // ensure that the transaction's base state reflects the current state, otherwise throw
throw new InvalidOperationException("Transaction no longer resembles the current state of plugins");
}


Loading…
Cancel
Save