Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -3,35 +3,35 @@ using System.Collections.Generic;
|
|||
|
||||
namespace Server.Engines.MLQuests
|
||||
{
|
||||
[AttributeUsage( AttributeTargets.Class )]
|
||||
public class QuesterNameAttribute : Attribute
|
||||
{
|
||||
public string QuesterName { get; }
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class QuesterNameAttribute : Attribute
|
||||
{
|
||||
private static readonly Type m_Type = typeof(QuesterNameAttribute);
|
||||
private static readonly Dictionary<Type, string> m_Cache = new Dictionary<Type, string>();
|
||||
|
||||
public QuesterNameAttribute( string questerName )
|
||||
{
|
||||
QuesterName = questerName;
|
||||
}
|
||||
public QuesterNameAttribute(string questerName)
|
||||
{
|
||||
QuesterName = questerName;
|
||||
}
|
||||
|
||||
private static readonly Type m_Type = typeof( QuesterNameAttribute );
|
||||
private static readonly Dictionary<Type, string> m_Cache = new Dictionary<Type, string>();
|
||||
public string QuesterName{ get; }
|
||||
|
||||
public static string GetQuesterNameFor( Type t )
|
||||
{
|
||||
if ( t == null )
|
||||
return "";
|
||||
public static string GetQuesterNameFor(Type t)
|
||||
{
|
||||
if (t == null)
|
||||
return "";
|
||||
|
||||
if (m_Cache.TryGetValue( t, out string result ))
|
||||
return result;
|
||||
if (m_Cache.TryGetValue(t, out string result))
|
||||
return result;
|
||||
|
||||
object[] attributes = t.GetCustomAttributes( m_Type, false );
|
||||
object[] attributes = t.GetCustomAttributes(m_Type, false);
|
||||
|
||||
if ( attributes.Length != 0 )
|
||||
result = ( (QuesterNameAttribute)attributes[0] ).QuesterName;
|
||||
else
|
||||
result = t.Name;
|
||||
if (attributes.Length != 0)
|
||||
result = ((QuesterNameAttribute)attributes[0]).QuesterName;
|
||||
else
|
||||
result = t.Name;
|
||||
|
||||
return ( m_Cache[t] = result );
|
||||
}
|
||||
}
|
||||
}
|
||||
return m_Cache[t] = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue