fixed ScriptCompilerPatch
This commit is contained in:
@@ -140,12 +140,6 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="TorchService.cs">
|
|
||||||
<SubType>Component</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="TorchServiceInstaller.cs">
|
|
||||||
<SubType>Component</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Remove="ServerManager.cs" />
|
<Compile Remove="ServerManager.cs" />
|
||||||
<Compile Remove="ViewModels\SessionSettingsViewModel1.cs" />
|
<Compile Remove="ViewModels\SessionSettingsViewModel1.cs" />
|
||||||
<Compile Remove="Views\WorldSelectControl.xaml.cs" />
|
<Compile Remove="Views\WorldSelectControl.xaml.cs" />
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
@@ -12,7 +11,6 @@ using System.Reflection.Emit;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Microsoft.CodeAnalysis;
|
using Microsoft.CodeAnalysis;
|
||||||
using ProtoBuf;
|
|
||||||
using Torch.Managers.PatchManager;
|
using Torch.Managers.PatchManager;
|
||||||
using Torch.Managers.PatchManager.MSIL;
|
using Torch.Managers.PatchManager.MSIL;
|
||||||
using Torch.Utils;
|
using Torch.Utils;
|
||||||
@@ -42,10 +40,14 @@ namespace Torch.Patches
|
|||||||
context.GetPattern(Register2Method).AddTranspiler(nameof(RegisterTranspiler));
|
context.GetPattern(Register2Method).AddTranspiler(nameof(RegisterTranspiler));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void WhitelistCtorPrefix(MyScriptCompiler scriptCompiler)
|
private static void WhitelistCtorPrefix(MyScriptCompiler scriptCompiler, MyScriptWhitelist __instance)
|
||||||
{
|
{
|
||||||
|
var basePath = new FileInfo(typeof(object).Assembly.Location).DirectoryName!;
|
||||||
|
|
||||||
scriptCompiler.AddReferencedAssemblies(
|
scriptCompiler.AddReferencedAssemblies(
|
||||||
typeof(ValueType).Assembly.Location,
|
Path.Combine(basePath, "netstandard.dll"),
|
||||||
|
Path.Combine(basePath, "mscorlib.dll"),
|
||||||
|
Path.Combine(basePath, "System.Runtime.dll"),
|
||||||
typeof(LinkedList<>).Assembly.Location,
|
typeof(LinkedList<>).Assembly.Location,
|
||||||
typeof(Regex).Assembly.Location,
|
typeof(Regex).Assembly.Location,
|
||||||
typeof(Enumerable).Assembly.Location,
|
typeof(Enumerable).Assembly.Location,
|
||||||
@@ -55,6 +57,7 @@ namespace Torch.Patches
|
|||||||
typeof(TypeConverter).Assembly.Location,
|
typeof(TypeConverter).Assembly.Location,
|
||||||
typeof(System.Diagnostics.TraceSource).Assembly.Location,
|
typeof(System.Diagnostics.TraceSource).Assembly.Location,
|
||||||
typeof(ProtoBuf.Meta.RuntimeTypeModel).Assembly.Location,
|
typeof(ProtoBuf.Meta.RuntimeTypeModel).Assembly.Location,
|
||||||
|
typeof(ProtoBuf.ProtoMemberAttribute).Assembly.Location,
|
||||||
Path.Combine(MyFileSystem.ExePath, "Sandbox.Game.dll"),
|
Path.Combine(MyFileSystem.ExePath, "Sandbox.Game.dll"),
|
||||||
Path.Combine(MyFileSystem.ExePath, "Sandbox.Common.dll"),
|
Path.Combine(MyFileSystem.ExePath, "Sandbox.Common.dll"),
|
||||||
Path.Combine(MyFileSystem.ExePath, "Sandbox.Graphics.dll"),
|
Path.Combine(MyFileSystem.ExePath, "Sandbox.Graphics.dll"),
|
||||||
@@ -73,6 +76,9 @@ namespace Torch.Patches
|
|||||||
MyModWatchdog.Init(updateThread);
|
MyModWatchdog.Init(updateThread);
|
||||||
MyScriptCompiler.Static.AddImplicitIngameNamespacesFromTypes(referencedTypes);
|
MyScriptCompiler.Static.AddImplicitIngameNamespacesFromTypes(referencedTypes);
|
||||||
MyScriptCompiler.Static.AddConditionalCompilationSymbols(symbols);
|
MyScriptCompiler.Static.AddConditionalCompilationSymbols(symbols);
|
||||||
|
using var batch = MyScriptCompiler.Static.Whitelist.OpenBatch();
|
||||||
|
// Dict and queue in different assemblies, microsoft being microsoft
|
||||||
|
batch.AllowNamespaceOfTypes(MyWhitelistTarget.ModApi, typeof(ConcurrentQueue<>));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -122,31 +122,6 @@
|
|||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Compile Update="Views\CollectionEditor.xaml.cs">
|
|
||||||
<DependentUpon>CollectionEditor.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="Views\DictionaryEditor.xaml.cs">
|
|
||||||
<DependentUpon>DictionaryEditor.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="Views\EmbeddedCollectionEditor.xaml.cs">
|
|
||||||
<DependentUpon>EmbeddedCollectionEditor.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="Views\FlagsEditor.xaml.cs">
|
|
||||||
<DependentUpon>FlagsEditor.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="Views\ObjectCollectionEditor.xaml.cs">
|
|
||||||
<DependentUpon>ObjectCollectionEditor.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="Views\ObjectEditor.xaml.cs">
|
|
||||||
<DependentUpon>ObjectEditor.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="Views\PropertyGrid.xaml.cs">
|
|
||||||
<DependentUpon>PropertyGrid.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="..\Versioning\AssemblyVersion.cs" Link="Properties/AssemblyVersion.cs" />
|
|
||||||
<Compile Remove="Commands\Permissions\PermissionManager.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Torch.API\Torch.API.csproj" />
|
<ProjectReference Include="..\Torch.API\Torch.API.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
Reference in New Issue
Block a user