1
This commit is contained in:
142
Packages/Tests/StringTest.cs
Normal file
142
Packages/Tests/StringTest.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
using System.Text;
|
||||
using UnityEngine.TestTools;
|
||||
using System.Linq;
|
||||
namespace BITKit
|
||||
{
|
||||
public class StringTest
|
||||
{
|
||||
[Test]
|
||||
public void JoinString()
|
||||
{
|
||||
List<string> stringList = new()
|
||||
{
|
||||
"UX",
|
||||
"Test",
|
||||
"Creator"
|
||||
};
|
||||
Debug.Log(string.Join("/",stringList));
|
||||
}
|
||||
[Test]
|
||||
public void SpliteNamespace()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
List<string> ignoreNamespaces = new()
|
||||
{
|
||||
"System",
|
||||
"UnityEngine",
|
||||
"Unity",
|
||||
"Microsoft",
|
||||
"UnityEditor",
|
||||
"Google",
|
||||
"Mono",
|
||||
"ZXing",
|
||||
"ImmersiveVRTools",
|
||||
"MonKey",
|
||||
"FLib",
|
||||
"Kcp",
|
||||
"Udx",
|
||||
"Sirenix",
|
||||
"TMPro",
|
||||
"RotaryHeart",
|
||||
"Cinemachine",
|
||||
"ParadoxNotion",
|
||||
"Net",
|
||||
"VSCodeEditor",
|
||||
"AOT",
|
||||
"UnityEditorInternal",
|
||||
"UnityEngineInternal",
|
||||
"JetBrains",
|
||||
"Bee",
|
||||
"NotInvited",
|
||||
"HighlightPlus",
|
||||
"DG",
|
||||
"Hierarchy2",
|
||||
"Cysharp",
|
||||
"JetBrains",
|
||||
"Packages",
|
||||
"Newtonsoft_X",
|
||||
"Binding",
|
||||
"NodeCanvas",
|
||||
"SaveDuringPlay",
|
||||
"LimWorks",
|
||||
"MagicaCloth2",
|
||||
"FastScriptReload",
|
||||
"ParrelSync",
|
||||
"KinematicCharacterController",
|
||||
"LimWorksEditor",
|
||||
"BuildComponent",
|
||||
"dnlib",
|
||||
"BigIntegerLibrary",
|
||||
"Ionic",
|
||||
"log4net",
|
||||
"DG",
|
||||
"ImmersiveVrToolsCommon",
|
||||
"NUnit",
|
||||
"HarmonyLib",
|
||||
"MonoMod",
|
||||
"WebDav",
|
||||
"PlasticGui",
|
||||
"Codice",
|
||||
"GluonGui",
|
||||
"PlasticPipe",
|
||||
"XDiffGui",
|
||||
"MacFsWatcher",
|
||||
"MacUI",
|
||||
"PlayerBuildProgramLibrary",
|
||||
"ExCSS",
|
||||
"ScriptCompilationBuildProgram",
|
||||
"BeeBuildProgramCommon",
|
||||
"Accessibility",
|
||||
"CodiceApp",
|
||||
"Newtonsoft",
|
||||
"MergetoolGui",
|
||||
"TreeEditor",
|
||||
"MackySoft",
|
||||
"FullscreenEditor",
|
||||
|
||||
};
|
||||
var allTypes =new List<Type>();
|
||||
var supportTypes=new List<Type>();
|
||||
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
try
|
||||
{
|
||||
allTypes.AddRange(assembly.GetExportedTypes());
|
||||
}
|
||||
catch
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
stringBuilder.AppendLine($"以获取到类型:{allTypes.Count()}个");
|
||||
foreach (var type in allTypes)
|
||||
{
|
||||
var typeName = type.Name;
|
||||
var nameSpace = type.Namespace;
|
||||
var rootNamespace =string.IsNullOrEmpty(nameSpace)?string.Empty : nameSpace.Split(@".").First();
|
||||
var contrast = ignoreNamespaces.Contains(rootNamespace);
|
||||
//stringBuilder.AppendLine($"类型名称:{typeName}\t命名空间{nameSpace}\t根命名空间:{rootNamespace}\t对比结果:{contrast}");
|
||||
if(contrast)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
supportTypes.Add(type);
|
||||
}
|
||||
}
|
||||
stringBuilder.AppendLine($"所有类型{allTypes.Count()}个\t支持类型{supportTypes.Count}");
|
||||
stringBuilder.AppendLine("已支持的命名空间:");
|
||||
foreach (var x in supportTypes.Select(x=>x.Namespace).Distinct())
|
||||
{
|
||||
stringBuilder.AppendLine(x);
|
||||
}
|
||||
Debug.Log(stringBuilder);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user