fixes TypeCache lookup speed and errors (#95)
This commit is contained in:
parent
e97d2cb131
commit
f8f372ccb9
26 changed files with 101 additions and 109 deletions
|
|
@ -23,7 +23,7 @@ namespace Server.Engines.BulkOrders
|
|||
string type = reader.ReadString();
|
||||
|
||||
if (type != null)
|
||||
ItemType = AssemblyHandler.FindTypeByFullName(type);
|
||||
ItemType = AssemblyHandler.FindFirstTypeForName(type);
|
||||
|
||||
AmountCur = reader.ReadEncodedInt();
|
||||
Number = reader.ReadEncodedInt();
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace Server.Engines.BulkOrders
|
|||
string type = reader.ReadString();
|
||||
|
||||
if (type != null)
|
||||
ItemType = AssemblyHandler.FindTypeByFullName(type);
|
||||
ItemType = AssemblyHandler.FindFirstTypeForName(type);
|
||||
|
||||
RequireExceptional = reader.ReadBool();
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ namespace Server.Engines.BulkOrders
|
|||
string type = reader.ReadString();
|
||||
|
||||
if ( type != null )
|
||||
realType = AssemblyHandler.FindTypeByFullName( type );
|
||||
realType = AssemblyHandler.FindFirstTypeForName( type );
|
||||
|
||||
Details = new SmallBulkEntry( realType, reader.ReadInt(), reader.ReadInt() );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ namespace Server.Engines.BulkOrders
|
|||
string type = reader.ReadString();
|
||||
|
||||
if (type != null)
|
||||
Type = AssemblyHandler.FindTypeByFullName(type);
|
||||
Type = AssemblyHandler.FindFirstTypeForName(type);
|
||||
|
||||
m_Number = reader.ReadInt();
|
||||
Graphic = reader.ReadInt();
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
if ( split.Length >= 2 )
|
||||
{
|
||||
Type type = AssemblyHandler.FindTypeByName( split[0] );
|
||||
Type type = AssemblyHandler.FindFirstTypeForName( split[0] );
|
||||
int graphic = Utility.ToInt32( split[split.Length - 1] );
|
||||
|
||||
if ( type != null && graphic > 0 )
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ namespace Server.Engines.Doom
|
|||
if (TypeName == null)
|
||||
return;
|
||||
|
||||
Type type = AssemblyHandler.FindTypeByName(TypeName, true);
|
||||
Type type = AssemblyHandler.FindFirstTypeForName(TypeName, true);
|
||||
|
||||
if (type == null)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using Server.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Server.Factions
|
||||
|
|
@ -56,7 +57,7 @@ namespace Server.Factions
|
|||
{
|
||||
Assembly asm = asms[i];
|
||||
TypeCache tc = AssemblyHandler.GetTypeCache(asm);
|
||||
Type[] types = tc.Types;
|
||||
Type[] types = tc.Types.ToArray();
|
||||
|
||||
for (int j = 0; j < types.Length; ++j)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ namespace Server.Engines.MLQuests.Items
|
|||
string typeName = reader.ReadString();
|
||||
|
||||
if (typeName != null)
|
||||
m_QuestType = AssemblyHandler.FindTypeByFullName(typeName, false);
|
||||
m_QuestType = AssemblyHandler.FindFirstTypeForName(typeName, false);
|
||||
|
||||
Message = TextDefinition.Deserialize(reader);
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ namespace Server.Engines.MLQuests.Items
|
|||
string typeName = reader.ReadString();
|
||||
|
||||
if (typeName != null)
|
||||
m_TicketType = AssemblyHandler.FindTypeByFullName(typeName, false);
|
||||
m_TicketType = AssemblyHandler.FindFirstTypeForName(typeName, false);
|
||||
|
||||
Message = TextDefinition.Deserialize(reader);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace Server.Engines.MLQuests
|
|||
|
||||
string[] split = line.Split('\t');
|
||||
|
||||
Type type = AssemblyHandler.FindTypeByName(split[0]);
|
||||
Type type = AssemblyHandler.FindFirstTypeForName(split[0]);
|
||||
|
||||
if (type == null || !baseQuestType.IsAssignableFrom(type))
|
||||
{
|
||||
|
|
@ -77,7 +77,7 @@ namespace Server.Engines.MLQuests
|
|||
|
||||
for (int i = 1; i < split.Length; ++i)
|
||||
{
|
||||
Type questerType = AssemblyHandler.FindTypeByName(split[i]);
|
||||
Type questerType = AssemblyHandler.FindFirstTypeForName(split[i]);
|
||||
|
||||
if (questerType == null || !baseQuesterType.IsAssignableFrom(questerType))
|
||||
{
|
||||
|
|
@ -158,7 +158,7 @@ namespace Server.Engines.MLQuests
|
|||
return;
|
||||
}
|
||||
|
||||
Type index = AssemblyHandler.FindTypeByName(e.GetString(0));
|
||||
Type index = AssemblyHandler.FindFirstTypeForName(e.GetString(0));
|
||||
|
||||
if (index == null || !Quests.TryGetValue(index, out MLQuest quest))
|
||||
{
|
||||
|
|
@ -184,7 +184,7 @@ namespace Server.Engines.MLQuests
|
|||
return;
|
||||
}
|
||||
|
||||
Type index = AssemblyHandler.FindTypeByName(e.GetString(0));
|
||||
Type index = AssemblyHandler.FindFirstTypeForName(e.GetString(0));
|
||||
|
||||
if (index == null || !Quests.TryGetValue(index, out MLQuest quest))
|
||||
{
|
||||
|
|
@ -636,7 +636,7 @@ namespace Server.Engines.MLQuests
|
|||
if (typeName == null)
|
||||
return null; // not serialized
|
||||
|
||||
Type questType = AssemblyHandler.FindTypeByFullName(typeName);
|
||||
Type questType = AssemblyHandler.FindFirstTypeForName(typeName);
|
||||
|
||||
if (questType == null)
|
||||
return null; // no longer a type
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace Server.Engines.Quests
|
|||
if (fullName == null)
|
||||
return null;
|
||||
|
||||
return AssemblyHandler.FindTypeByFullName(fullName, false);
|
||||
return AssemblyHandler.FindFirstTypeForName(fullName, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ namespace Server.Mobiles
|
|||
{
|
||||
public class SpawnerType
|
||||
{
|
||||
public static Type GetType(string name) => AssemblyHandler.FindTypeByName(name);
|
||||
public static Type GetType(string name) => AssemblyHandler.FindFirstTypeForName(name);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue