fixes TypeCache lookup speed and errors (#95)

This commit is contained in:
Andrew Fryer 2020-02-21 23:07:11 -05:00 • committed by GitHub
parent e97d2cb131
commit f8f372ccb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 101 additions and 109 deletions

View file

@ -101,7 +101,7 @@ namespace Server.Commands
break;
}
Type type = AssemblyHandler.FindTypeByName(name);
Type type = AssemblyHandler.FindFirstTypeForName(name);
if (!IsEntity(type))
{
@ -241,7 +241,7 @@ namespace Server.Commands
try
{
if (IsEnum(type)) return Enum.Parse(type, value, true);
if (IsType(type)) return AssemblyHandler.FindTypeByName(value);
if (IsType(type)) return AssemblyHandler.FindFirstTypeForName(value);
if (IsParsable(type)) return ParseParsable(type, value);
object obj = value;

View file

@ -1025,7 +1025,7 @@ namespace Server.Commands
int indexOf = line.IndexOf(' ');
list.m_Type = AssemblyHandler.FindTypeByName(line.Substring(0, indexOf++), true);
list.m_Type = AssemblyHandler.FindFirstTypeForName(line.Substring(0, indexOf++), true);
if (list.m_Type == null)
throw new ArgumentException($"Type not found for header: '{line}'");

View file

@ -1012,7 +1012,7 @@ namespace Server.Commands
int indexOf = line.IndexOf(' ');
list.m_Type = AssemblyHandler.FindTypeByName(line.Substring(0, indexOf++), true);
list.m_Type = AssemblyHandler.FindFirstTypeForName(line.Substring(0, indexOf++), true);
if (list.m_Type == null)
throw new ArgumentException($"Type not found for header: '{line}'");

View file

@ -316,7 +316,7 @@ namespace Server.Commands
for (int i = 0; i < split.Length; ++i)
{
Type type = AssemblyHandler.FindTypeByName(split[i].Trim());
Type type = AssemblyHandler.FindFirstTypeForName(split[i].Trim());
if (type == null)
Console.WriteLine("Match type not found ('{0}')", split[i].Trim());

View file

@ -444,7 +444,7 @@ namespace Server.Commands.Generic
{
if (e.Length >= 1)
{
Type t = AssemblyHandler.FindTypeByName(e.GetString(0));
Type t = AssemblyHandler.FindFirstTypeForName(e.GetString(0));
if (t == null)
{

View file

@ -89,7 +89,7 @@ namespace Server.Commands.Generic
int index = 0;
Type objectType = AssemblyHandler.FindTypeByName(args[offset + index], true);
Type objectType = AssemblyHandler.FindFirstTypeForName(args[offset + index], true);
if (objectType == null)
throw new Exception($"No type with that name ({args[offset + index]}) was found.");

View file

@ -282,7 +282,7 @@ namespace Server.Commands
int count = bin.ReadInt32();
for (int i = 0; i < count; ++i)
types.Add(AssemblyHandler.FindTypeByFullName(bin.ReadString()));
types.Add(AssemblyHandler.FindFirstTypeForName(bin.ReadString()));
}
long total = 0;

View file

@ -391,7 +391,7 @@ namespace Server.Commands
else if (IsType(type))
try
{
toSet = AssemblyHandler.FindTypeByName(value);
toSet = AssemblyHandler.FindFirstTypeForName(value);
if (toSet == null)
return "No type with that name was found.";