|
|
@ -1,12 +1,15 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Linq; |
|
|
|
using System.Linq; |
|
|
|
using System.Reflection; |
|
|
|
using System.Reflection; |
|
|
|
|
|
|
|
using OfficeOpenXml; |
|
|
|
|
|
|
|
|
|
|
|
namespace Tools.ExcelResolver.Editor |
|
|
|
namespace Tools.ExcelResolver.Editor |
|
|
|
{ |
|
|
|
{ |
|
|
|
internal static partial class ExcelResolverUtil |
|
|
|
internal static partial class ExcelResolverUtil |
|
|
|
{ |
|
|
|
{ |
|
|
|
private static TType[] _allTTypes; |
|
|
|
private static TType[] _allTTypes; |
|
|
|
|
|
|
|
private static ExcelRange _currentCell; |
|
|
|
|
|
|
|
private static string _currentClassName; |
|
|
|
|
|
|
|
|
|
|
|
internal static TType[] GetAllTTypes() |
|
|
|
internal static TType[] GetAllTTypes() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -20,23 +23,28 @@ namespace Tools.ExcelResolver.Editor |
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// 更具类型字符串获取 TType |
|
|
|
/// 更具类型字符串获取 TType |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
/// <param name="typeText"></param> |
|
|
|
/// <param name="targetText"></param> |
|
|
|
/// <returns></returns> |
|
|
|
/// <returns></returns> |
|
|
|
internal static TType GetTTypeByString(string typeText) |
|
|
|
internal static TType GetTTypeByString(string targetText, ExcelRange cell = null, string className = null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
_currentCell = cell ?? _currentCell; |
|
|
|
typeText = typeText.ToLower(); |
|
|
|
_currentClassName = className ?? _currentClassName; |
|
|
|
|
|
|
|
targetText = targetText.ToLower(); |
|
|
|
_allTTypes ??= GetAllTTypes(); |
|
|
|
_allTTypes ??= GetAllTTypes(); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var tType in _allTTypes) |
|
|
|
foreach (var tType in _allTTypes) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (tType.String2TType(typeText)) |
|
|
|
if (tType.String2TType(targetText)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return tType; |
|
|
|
return tType; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
throw new Exception($"未找到类型 {typeText}"); |
|
|
|
throw new Exception($"type定义错误 " + |
|
|
|
|
|
|
|
$"className: '<color=cyan>{_currentClassName}</color>' " + |
|
|
|
|
|
|
|
$"FullAddress: <color=cyan>{_currentCell.FullAddress}</color> " + |
|
|
|
|
|
|
|
$"Text: '<color=cyan>{_currentCell.Text}</color>' " + |
|
|
|
|
|
|
|
$"targetText: '<color=cyan>{targetText}</color>'"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |