Essentials + extra crap
Loadings Startups Movement Camera
This commit is contained in:
1 parent
662f4a1d05
commit
5f5ace1b52
734 files changed
+107323
-1713
No files matched your search
+46
@@ -0,0 +1,46 @@
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Mono.Cecil;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace FastScriptReload.Editor.AssemblyPostProcess
|
||||
{
|
||||
[InitializeOnLoad]
|
||||
public static class AddInternalsVisibleToForAllUserAssembliesPostProcess
|
||||
{
|
||||
public static readonly DirectoryInfo AdjustedAssemblyRoot;
|
||||
|
||||
static AddInternalsVisibleToForAllUserAssembliesPostProcess()
|
||||
{
|
||||
AdjustedAssemblyRoot = new DirectoryInfo(Path.Combine(Application.dataPath, "..", "Temp", "Fast Script Reload", "AdjustedDlls"));
|
||||
}
|
||||
|
||||
public static string CreateAssemblyWithInternalsContentsVisibleTo(Assembly changedAssembly, string visibleToAssemblyName)
|
||||
{
|
||||
if(!AdjustedAssemblyRoot.Exists)
|
||||
AdjustedAssemblyRoot.Create();
|
||||
|
||||
using (var assembly = AssemblyDefinition.ReadAssembly(changedAssembly.Location, new ReaderParameters { ReadWrite = false }))
|
||||
{
|
||||
var mainModule = assembly.MainModule;
|
||||
|
||||
var attributeCtor = mainModule.ImportReference(
|
||||
typeof(System.Runtime.CompilerServices.InternalsVisibleToAttribute).GetConstructor(new[] { typeof(string) })
|
||||
);
|
||||
|
||||
var attribute = new CustomAttribute(attributeCtor);
|
||||
attribute.ConstructorArguments.Add(
|
||||
new CustomAttributeArgument(mainModule.TypeSystem.String, visibleToAssemblyName)
|
||||
);
|
||||
|
||||
assembly.CustomAttributes.Add(attribute);
|
||||
|
||||
var newAssemblyPath = new FileInfo(Path.Combine(AdjustedAssemblyRoot.FullName, assembly.Name.Name) + ".dll").FullName;
|
||||
assembly.Write(newAssemblyPath);
|
||||
|
||||
return newAssemblyPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b2f64e1d1e2642f9ab712970582c0b45
|
||||
timeCreated: 1678785285
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 239351
|
||||
packageName: Fast Script Reload
|
||||
packageVersion: 1.6.1
|
||||
assetPath: Assets/FastScriptReload/Scripts/Editor/AssemblyPostProcess/AddInternalsVisibleToForAllUserAssembliesPostProcess.cs
|
||||
uploadId: 710802
|
||||
Reference in new issue
Block a user