diff options
author | ZaneYork <ZaneYork@qq.com> | 2020-06-02 18:53:09 +0800 |
---|---|---|
committer | ZaneYork <ZaneYork@qq.com> | 2020-06-02 18:53:09 +0800 |
commit | 4fad1f8c0c0fc7ed313c2832ca89cd24fa276569 (patch) | |
tree | feeb53bd650555c419d104b2f4fef063f2a13705 /src | |
parent | 10367a3eae27ccd668986d07522102a141c9ac31 (diff) | |
download | SMAPI-4fad1f8c0c0fc7ed313c2832ca89cd24fa276569.tar.gz SMAPI-4fad1f8c0c0fc7ed313c2832ca89cd24fa276569.tar.bz2 SMAPI-4fad1f8c0c0fc7ed313c2832ca89cd24fa276569.zip |
1.Multithread rewrite
Diffstat (limited to 'src')
-rw-r--r-- | src/SMAPI/Framework/ModLoading/Framework/RecursiveRewriter.cs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/SMAPI/Framework/ModLoading/Framework/RecursiveRewriter.cs b/src/SMAPI/Framework/ModLoading/Framework/RecursiveRewriter.cs index c774c038..aafdefc6 100644 --- a/src/SMAPI/Framework/ModLoading/Framework/RecursiveRewriter.cs +++ b/src/SMAPI/Framework/ModLoading/Framework/RecursiveRewriter.cs @@ -57,12 +57,11 @@ namespace StardewModdingAPI.Framework.ModLoading.Framework /// <returns>Returns whether the module was modified.</returns> public bool RewriteModule() { - bool anyRewritten = false; - - foreach (TypeDefinition type in this.Module.GetTypes()) + return this.Module.GetTypes().AsParallel().WithExecutionMode(ParallelExecutionMode.ForceParallelism).Select(type => { + bool anyRewritten = false; if (type.BaseType == null) - continue; // special type like <Module> + return false; // special type like <Module> anyRewritten |= this.RewriteCustomAttributes(type.CustomAttributes); anyRewritten |= this.RewriteGenericParameters(type.GenericParameters); @@ -108,9 +107,9 @@ namespace StardewModdingAPI.Framework.ModLoading.Framework } } } - } - return anyRewritten; + return anyRewritten; + }).Max(); } |