[refactor] 重构。将7Zip及UnitFS移入HybridCLR.Editor模块。合并Generate命令。

main
walon 2022-09-23 09:40:06 +08:00
parent 7f2ee9c22b
commit 0af6f704b2
128 changed files with 60 additions and 92 deletions

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: defceb25af6d66a4c8d9b0cbf4393a01 guid: daa1e09af240aae4da0741843cb2b3f3
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -13,7 +13,7 @@ namespace HybridCLR.Editor.Commands
public static class AOTReferenceGeneratorCommand public static class AOTReferenceGeneratorCommand
{ {
[MenuItem("HybridCLR/GenerateAOTGenericReference", priority = 18)] [MenuItem("HybridCLR/Generate/AOTGenericReference", priority = 18)]
public static void GenerateAOTGenericReference() public static void GenerateAOTGenericReference()
{ {
GenerateAOTGenericReference(true); GenerateAOTGenericReference(true);

View File

@ -0,0 +1,22 @@
using HybridCLR.Editor.Installer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;
namespace HybridCLR.Editor.Commands
{
public static class InstallerCommand
{
[MenuItem("HybridCLR/Installer...", false, 0)]
private static void Open()
{
InstallerWindow window = EditorWindow.GetWindow<InstallerWindow>("HybridCLR Installer", true);
window.minSize = new Vector2(800f, 500f);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b91d62dfcf14d1241b7654d79d5b98a0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,4 +1,4 @@
using HybridCLR.Editor.LinkGenerator; using HybridCLR.Editor.Link;
using HybridCLR.Editor.Meta; using HybridCLR.Editor.Meta;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -16,7 +16,7 @@ namespace HybridCLR.Editor.Commands
public static class LinkGeneratorCommand public static class LinkGeneratorCommand
{ {
[MenuItem("HybridCLR/GenerateLinkXml", priority = 10)] [MenuItem("HybridCLR/Generate/LinkXml", priority = 10)]
public static void GenerateLinkXml() public static void GenerateLinkXml()
{ {
GenerateLinkXml(true); GenerateLinkXml(true);

View File

@ -1,6 +1,6 @@
using HybridCLR.Editor; using HybridCLR.Editor;
using HybridCLR.Editor.Meta; using HybridCLR.Editor.Meta;
using HybridCLR.Editor.MethodBridgeGenerator; using HybridCLR.Editor.MethodBridge;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -58,7 +58,7 @@ namespace HybridCLR.Editor.Commands
CleanIl2CppBuildCache(); CleanIl2CppBuildCache();
} }
[MenuItem("HybridCLR/GenerateMethodBridge", priority = 15)] [MenuItem("HybridCLR/Generate/MethodBridge", priority = 15)]
public static void GenerateMethodBridge() public static void GenerateMethodBridge()
{ {
GenerateMethodBridge(true); GenerateMethodBridge(true);

View File

@ -12,7 +12,7 @@ namespace HybridCLR.Editor.Commands
/// <summary> /// <summary>
/// 按照必要的顺序,执行所有生成操作,适合打包前操作 /// 按照必要的顺序,执行所有生成操作,适合打包前操作
/// </summary> /// </summary>
[MenuItem("HybridCLR/GenerateAll", priority = 30)] [MenuItem("HybridCLR/Generate/All", priority = 30)]
public static void GenerateAll() public static void GenerateAll()
{ {
// 顺序随意 // 顺序随意

View File

@ -1,4 +1,4 @@
using HybridCLR.Editor.LinkGenerator; using HybridCLR.Editor.Link;
using HybridCLR.Editor.ReversePInvokeWrap; using HybridCLR.Editor.ReversePInvokeWrap;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -16,13 +16,13 @@ namespace HybridCLR.Editor.Commands
public static class ReversePInvokeWrapperGeneratorCommand public static class ReversePInvokeWrapperGeneratorCommand
{ {
[MenuItem("HybridCLR/GenerateReversePInvokeWrapper", priority = 20)] [MenuItem("HybridCLR/Generate/ReversePInvokeWrapper", priority = 20)]
public static void GenerateReversePInvokeWrapper() public static void GenerateReversePInvokeWrapper()
{ {
string ReversePInvokeWrapperStubFile = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/hybridclr/metadata/ReversePInvokeMethodStub.cpp"; string ReversePInvokeWrapperStubFile = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/hybridclr/metadata/ReversePInvokeMethodStub.cpp";
string wrapperTemplateStr = AssetDatabase.LoadAssetAtPath<TextAsset>($"{SettingsUtil.TemplatePathInPackage}/ReversePInvokeMethodStub.cpp.txt").text; string wrapperTemplateStr = AssetDatabase.LoadAssetAtPath<TextAsset>($"{SettingsUtil.TemplatePathInPackage}/ReversePInvokeMethodStub.cpp.txt").text;
int wrapperCount = SettingsUtil.GlobalSettings.ReversePInvokeWrapperCount; int wrapperCount = SettingsUtil.GlobalSettings.ReversePInvokeWrapperCount;
var generator = new ReversePInvokeWrapperGenerator(); var generator = new Generator();
generator.Generate(wrapperTemplateStr, wrapperCount,ReversePInvokeWrapperStubFile); generator.Generate(wrapperTemplateStr, wrapperCount,ReversePInvokeWrapperStubFile);
Debug.Log($"GenerateReversePInvokeWrapper. wraperCount:{wrapperCount} output:{ReversePInvokeWrapperStubFile}"); Debug.Log($"GenerateReversePInvokeWrapper. wraperCount:{wrapperCount} output:{ReversePInvokeWrapperStubFile}");
MethodBridgeGeneratorCommand.CleanIl2CppBuildCache(); MethodBridgeGeneratorCommand.CleanIl2CppBuildCache();

View File

@ -14,13 +14,6 @@ namespace HybridCLR.Editor.Installer
{ {
private InstallerController m_Controller; private InstallerController m_Controller;
[MenuItem("HybridCLR/Installer...", false, 0)]
private static void Open()
{
InstallerWindow window = GetWindow<InstallerWindow>("HybridCLR Installer", true);
window.minSize = new Vector2(800f, 500f);
}
private void OnEnable() private void OnEnable()
{ {
m_Controller = new InstallerController(); m_Controller = new InstallerController();

View File

@ -8,9 +8,9 @@ using dnlib.DotNet;
using HybridCLR.Editor.Meta; using HybridCLR.Editor.Meta;
using IAssemblyResolver = HybridCLR.Editor.Meta.IAssemblyResolver; using IAssemblyResolver = HybridCLR.Editor.Meta.IAssemblyResolver;
namespace HybridCLR.Editor.LinkGenerator namespace HybridCLR.Editor.Link
{ {
class Analyzer public class Analyzer
{ {
private readonly IAssemblyResolver _resolver; private readonly IAssemblyResolver _resolver;

View File

@ -7,7 +7,7 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace HybridCLR.Editor.LinkGenerator namespace HybridCLR.Editor.Link
{ {
internal class LinkXmlWriter internal class LinkXmlWriter
{ {

View File

@ -7,7 +7,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
namespace HybridCLR.Editor.MethodBridgeGenerator namespace HybridCLR.Editor.MethodBridge
{ {
public class Analyzer public class Analyzer

View File

@ -11,10 +11,8 @@ using System.Threading.Tasks;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
namespace HybridCLR.Editor.MethodBridgeGenerator namespace HybridCLR.Editor.MethodBridge
{ {
public class Generator public class Generator
{ {
public class Options public class Options

Some files were not shown because too many files have changed in this diff Show More