1
This commit is contained in:
41
Packages/Core/Sharp/BITSharp.cs
Normal file
41
Packages/Core/Sharp/BITSharp.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
public class BITSharp
|
||||
{
|
||||
private static readonly ConcurrentDictionary<string, Type> Dictionary = new();
|
||||
static Assembly[] assemblies;
|
||||
public static bool TryGetTypeFromFullName(string fullClassName,out Type type)
|
||||
{
|
||||
type = GetTypeFromFullName(fullClassName);
|
||||
return type is not null ? true : false;
|
||||
}
|
||||
public static Type GetTypeFromFullName(string fullClassName)
|
||||
{
|
||||
return Dictionary.GetOrAdd(fullClassName, SearchType);
|
||||
}
|
||||
static Type SearchType(string fullName)
|
||||
{
|
||||
assemblies = assemblies??AppDomain.CurrentDomain.GetAssemblies();
|
||||
foreach (var assembly in assemblies)
|
||||
{
|
||||
var type = assembly.GetType(fullName,false);
|
||||
if (type is not null)
|
||||
{
|
||||
return type;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
11
Packages/Core/Sharp/BITSharp.cs.meta
Normal file
11
Packages/Core/Sharp/BITSharp.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: baf3ccf13f762a14db1cacb396c6a13a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user