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
|
|
@ -24,156 +24,142 @@ using System.Reflection;
|
|||
|
||||
namespace Server
|
||||
{
|
||||
[AttributeUsage( AttributeTargets.Property )]
|
||||
public class HueAttribute : Attribute
|
||||
{
|
||||
public HueAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class HueAttribute : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
[AttributeUsage( AttributeTargets.Property )]
|
||||
public class BodyAttribute : Attribute
|
||||
{
|
||||
public BodyAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class BodyAttribute : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
[AttributeUsage( AttributeTargets.Class | AttributeTargets.Struct )]
|
||||
public class PropertyObjectAttribute : Attribute
|
||||
{
|
||||
public PropertyObjectAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
|
||||
public class PropertyObjectAttribute : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
[AttributeUsage( AttributeTargets.Class | AttributeTargets.Struct )]
|
||||
public class NoSortAttribute : Attribute
|
||||
{
|
||||
public NoSortAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
|
||||
public class NoSortAttribute : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
[AttributeUsage( AttributeTargets.Method )]
|
||||
public class CallPriorityAttribute : Attribute
|
||||
{
|
||||
public int Priority { get; set; }
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class CallPriorityAttribute : Attribute
|
||||
{
|
||||
public CallPriorityAttribute(int priority)
|
||||
{
|
||||
Priority = priority;
|
||||
}
|
||||
|
||||
public CallPriorityAttribute( int priority )
|
||||
{
|
||||
Priority = priority;
|
||||
}
|
||||
}
|
||||
public int Priority{ get; set; }
|
||||
}
|
||||
|
||||
public class CallPriorityComparer : IComparer<MethodInfo>
|
||||
{
|
||||
public int Compare( MethodInfo x, MethodInfo y )
|
||||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
public class CallPriorityComparer : IComparer<MethodInfo>
|
||||
{
|
||||
public int Compare(MethodInfo x, MethodInfo y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
|
||||
if ( x == null )
|
||||
return 1;
|
||||
if (x == null)
|
||||
return 1;
|
||||
|
||||
if ( y == null )
|
||||
return -1;
|
||||
if (y == null)
|
||||
return -1;
|
||||
|
||||
var xPriority = GetPriority( x );
|
||||
var yPriority = GetPriority( y );
|
||||
int xPriority = GetPriority(x);
|
||||
int yPriority = GetPriority(y);
|
||||
|
||||
if ( xPriority > yPriority )
|
||||
return 1;
|
||||
if (xPriority > yPriority)
|
||||
return 1;
|
||||
|
||||
if ( xPriority < yPriority )
|
||||
return -1;
|
||||
if (xPriority < yPriority)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int GetPriority( MethodInfo mi )
|
||||
{
|
||||
object[] objs = mi.GetCustomAttributes( typeof( CallPriorityAttribute ), true );
|
||||
private int GetPriority(MethodInfo mi)
|
||||
{
|
||||
object[] objs = mi.GetCustomAttributes(typeof(CallPriorityAttribute), true);
|
||||
|
||||
if ( objs.Length == 0 )
|
||||
return 0;
|
||||
if (objs.Length == 0)
|
||||
return 0;
|
||||
|
||||
if ( !(objs[0] is CallPriorityAttribute attr) )
|
||||
return 0;
|
||||
if (!(objs[0] is CallPriorityAttribute attr))
|
||||
return 0;
|
||||
|
||||
return attr.Priority;
|
||||
}
|
||||
}
|
||||
return attr.Priority;
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage( AttributeTargets.Class )]
|
||||
public class TypeAliasAttribute : Attribute
|
||||
{
|
||||
public string[] Aliases { get; }
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class TypeAliasAttribute : Attribute
|
||||
{
|
||||
public TypeAliasAttribute(params string[] aliases)
|
||||
{
|
||||
Aliases = aliases;
|
||||
}
|
||||
|
||||
public TypeAliasAttribute( params string[] aliases )
|
||||
{
|
||||
Aliases = aliases;
|
||||
}
|
||||
}
|
||||
public string[] Aliases{ get; }
|
||||
}
|
||||
|
||||
[AttributeUsage( AttributeTargets.Class | AttributeTargets.Struct )]
|
||||
public class ParsableAttribute : Attribute
|
||||
{
|
||||
public ParsableAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
|
||||
public class ParsableAttribute : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
[AttributeUsage( AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum )]
|
||||
public class CustomEnumAttribute : Attribute
|
||||
{
|
||||
public string[] Names { get; }
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum)]
|
||||
public class CustomEnumAttribute : Attribute
|
||||
{
|
||||
public CustomEnumAttribute(string[] names)
|
||||
{
|
||||
Names = names;
|
||||
}
|
||||
|
||||
public CustomEnumAttribute( string[] names )
|
||||
{
|
||||
Names = names;
|
||||
}
|
||||
}
|
||||
public string[] Names{ get; }
|
||||
}
|
||||
|
||||
[AttributeUsage( AttributeTargets.Constructor )]
|
||||
public class ConstructibleAttribute : Attribute
|
||||
{
|
||||
public AccessLevel AccessLevel { get; set; }
|
||||
[AttributeUsage(AttributeTargets.Constructor)]
|
||||
public class ConstructibleAttribute : Attribute
|
||||
{
|
||||
public ConstructibleAttribute() :
|
||||
this(AccessLevel.Player) //Lowest accesslevel for current functionality (Level determined by access to [add)
|
||||
{
|
||||
}
|
||||
|
||||
public ConstructibleAttribute() : this( AccessLevel.Player ) //Lowest accesslevel for current functionality (Level determined by access to [add)
|
||||
{
|
||||
}
|
||||
public ConstructibleAttribute(AccessLevel accessLevel)
|
||||
{
|
||||
AccessLevel = accessLevel;
|
||||
}
|
||||
|
||||
public ConstructibleAttribute( AccessLevel accessLevel )
|
||||
{
|
||||
AccessLevel = accessLevel;
|
||||
}
|
||||
}
|
||||
public AccessLevel AccessLevel{ get; set; }
|
||||
}
|
||||
|
||||
[AttributeUsage( AttributeTargets.Property )]
|
||||
public class CommandPropertyAttribute : Attribute
|
||||
{
|
||||
public AccessLevel ReadLevel { get; }
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class CommandPropertyAttribute : Attribute
|
||||
{
|
||||
public CommandPropertyAttribute(AccessLevel level, bool readOnly)
|
||||
{
|
||||
ReadLevel = level;
|
||||
ReadOnly = readOnly;
|
||||
}
|
||||
|
||||
public AccessLevel WriteLevel { get; }
|
||||
public CommandPropertyAttribute(AccessLevel level) : this(level, level)
|
||||
{
|
||||
}
|
||||
|
||||
public bool ReadOnly { get; }
|
||||
public CommandPropertyAttribute(AccessLevel readLevel, AccessLevel writeLevel)
|
||||
{
|
||||
ReadLevel = readLevel;
|
||||
WriteLevel = writeLevel;
|
||||
}
|
||||
|
||||
public CommandPropertyAttribute( AccessLevel level, bool readOnly )
|
||||
{
|
||||
ReadLevel = level;
|
||||
ReadOnly = readOnly;
|
||||
}
|
||||
public AccessLevel ReadLevel{ get; }
|
||||
|
||||
public CommandPropertyAttribute( AccessLevel level ) : this( level, level )
|
||||
{
|
||||
}
|
||||
public AccessLevel WriteLevel{ get; }
|
||||
|
||||
public CommandPropertyAttribute( AccessLevel readLevel, AccessLevel writeLevel )
|
||||
{
|
||||
ReadLevel = readLevel;
|
||||
WriteLevel = writeLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool ReadOnly{ get; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue