Upgrades code style - First batch (#22)

This commit is contained in:
Kamron Batman 2018-08-14 06:16:50 +08:00 committed by GitHub
parent 8ee42c8ea2
commit 632e8b4757
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1834 changed files with 10245 additions and 10437 deletions

View file

@ -181,8 +181,8 @@ namespace Server.Commands
// m_Writer = Docs.GetWriter( "docs/types/", m_FileName );
}
public string FileName { get { return m_FileName; } }
public string TypeName { get { return m_TypeName; } }
public string FileName => m_FileName;
public string TypeName => m_TypeName;
public string LinkName( string dirRoot )
{
@ -336,8 +336,7 @@ namespace Server.Commands
string fullName = realType.FullName;
string aliased = null;// = realType.Name;
TypeInfo info = null;
m_Types.TryGetValue( realType, out info );
m_Types.TryGetValue( realType, out TypeInfo info );
if( info != null )
{
@ -1419,8 +1418,8 @@ namespace Server.Commands
private int m_Index;
private List<string> m_Strings;
public int Index { get { return m_Index; } }
public List<string> Strings { get { return m_Strings; } }
public int Index => m_Index;
public List<string> Strings => m_Strings;
public SpeechEntry( int index )
{
@ -1471,8 +1470,7 @@ namespace Server.Commands
lastIndex = index;
SpeechEntry entry = null;
table.TryGetValue( index, out entry );
table.TryGetValue( index, out SpeechEntry entry );
if( entry == null )
table[index] = entry = new SpeechEntry( index );
@ -1496,11 +1494,11 @@ namespace Server.Commands
private string m_Usage;
private string m_Description;
public AccessLevel AccessLevel { get { return m_AccessLevel; } }
public string Name { get { return m_Name; } }
public string[] Aliases { get { return m_Aliases; } }
public string Usage { get { return m_Usage; } }
public string Description { get { return m_Description; } }
public AccessLevel AccessLevel => m_AccessLevel;
public string Name => m_Name;
public string[] Aliases => m_Aliases;
public string Usage => m_Usage;
public string Description => m_Description;
public DocCommandEntry( AccessLevel accessLevel, string name, string[] aliases, string usage, string description )
{
@ -1767,8 +1765,7 @@ namespace Server.Commands
TypeInfo info = new TypeInfo( type );
m_Types[type] = info;
List<TypeInfo> nspaces = null;
m_Namespaces.TryGetValue( nspace, out nspaces );
m_Namespaces.TryGetValue( nspace, out List<TypeInfo> nspaces );
if( nspaces == null )
m_Namespaces[nspace] = nspaces = new List<TypeInfo>();
@ -1779,8 +1776,7 @@ namespace Server.Commands
if( baseType != null && InAssemblies( baseType, asms ) )
{
TypeInfo baseInfo = null;
m_Types.TryGetValue( baseType, out baseInfo );
m_Types.TryGetValue( baseType, out TypeInfo baseInfo );
if( baseInfo == null )
m_Types[baseType] = baseInfo = new TypeInfo( baseType );
@ -1795,8 +1791,7 @@ namespace Server.Commands
if( decType != null )
{
TypeInfo decInfo = null;
m_Types.TryGetValue( decType, out decInfo );
m_Types.TryGetValue( decType, out TypeInfo decInfo );
if( decInfo == null )
m_Types[decType] = decInfo = new TypeInfo( decType );
@ -1814,8 +1809,7 @@ namespace Server.Commands
if( !InAssemblies( iface, asms ) )
continue;
TypeInfo ifaceInfo = null;
m_Types.TryGetValue( iface, out ifaceInfo );
m_Types.TryGetValue( iface, out TypeInfo ifaceInfo );
if( ifaceInfo == null )
m_Types[iface] = ifaceInfo = new TypeInfo( iface );
@ -1948,8 +1942,7 @@ namespace Server.Commands
{
html.Write( " <a " );
TypeInfo typeInfo = null;
m_Types.TryGetValue( parms[j].ParameterType, out typeInfo );
m_Types.TryGetValue( parms[j].ParameterType, out TypeInfo typeInfo );
if( typeInfo != null )
html.Write( "href=\"types/{0}\" ", typeInfo.FileName );
@ -2178,8 +2171,7 @@ namespace Server.Commands
typeHtml.Write( '(' );
TypeInfo decInfo = null;
m_Types.TryGetValue( decType, out decInfo );
m_Types.TryGetValue( decType, out TypeInfo decInfo );
if( decInfo == null )
typeHtml.Write( decType.Name );
@ -2201,8 +2193,7 @@ namespace Server.Commands
{
typeHtml.Write( " : " );
TypeInfo baseInfo = null;
m_Types.TryGetValue( baseType, out baseInfo );
m_Types.TryGetValue( baseType, out TypeInfo baseInfo );
if( baseInfo == null )
typeHtml.Write( baseType.Name );
@ -2222,8 +2213,7 @@ namespace Server.Commands
for( int i = 0; i < ifaces.Length; ++i )
{
Type iface = ifaces[i];
TypeInfo ifaceInfo = null;
m_Types.TryGetValue( iface, out ifaceInfo );
m_Types.TryGetValue( iface, out TypeInfo ifaceInfo );
if( extendCount != 0 )
typeHtml.Write( ", " );
@ -2565,9 +2555,9 @@ namespace Server.Commands
private ModelBodyType m_BodyType;
private string m_Name;
public Body Body { get { return m_Body; } }
public ModelBodyType BodyType { get { return m_BodyType; } }
public string Name { get { return m_Name; } }
public Body Body => m_Body;
public ModelBodyType BodyType => m_BodyType;
public string Name => m_Name;
public BodyEntry( Body body, ModelBodyType bodyType, string name )
{

View file

@ -97,9 +97,7 @@ namespace Server.Commands.Generic
for ( int i = args.Length - 1; i >= 0; --i )
{
ExtensionInfo extInfo = null;
if ( !ExtensionInfo.Table.TryGetValue( args[i], out extInfo ) )
if ( !ExtensionInfo.Table.TryGetValue( args[i], out ExtensionInfo extInfo ) )
continue;
if ( extInfo.IsFixedSize && i != ( size - extInfo.Size - 1 ) )

View file

@ -566,4 +566,4 @@ namespace Server.Commands.Generic
return (IConditional) Activator.CreateInstance( conditionalType );
}
}
}
}

View file

@ -246,4 +246,4 @@ namespace Server.Commands.Generic
return (IComparer) Activator.CreateInstance( comparerType );
}
}
}
}

View file

@ -169,4 +169,4 @@ namespace Server.Commands.Generic
return (IComparer) Activator.CreateInstance( comparerType );
}
}
}
}

View file

@ -282,8 +282,7 @@ namespace Server.Commands.Generic
{
if ( e.Length >= 1 )
{
BaseCommand command = null;
m_Commands.TryGetValue( e.GetString( 0 ), out command );
m_Commands.TryGetValue( e.GetString( 0 ), out BaseCommand command );
if ( command == null )
{
@ -341,4 +340,4 @@ namespace Server.Commands.Generic
}
}
}
}
}

View file

@ -36,8 +36,7 @@ namespace Server.Commands.Generic
}
else
{
BaseCommand command = null;
Commands.TryGetValue( e.GetString( 1 ), out command );
Commands.TryGetValue( e.GetString( 1 ), out BaseCommand command );
if ( command == null )
{

View file

@ -35,8 +35,7 @@ namespace Server.Commands.Generic
}
else
{
BaseCommand command = null;
Commands.TryGetValue( e.GetString( 1 ), out command );
Commands.TryGetValue( e.GetString( 1 ), out BaseCommand command );
if ( command == null )
{
@ -98,4 +97,4 @@ namespace Server.Commands.Generic
}
}
}
}
}

View file

@ -26,9 +26,7 @@ namespace Server.Commands.Generic
public void Redirect( CommandEventArgs e )
{
BaseCommand command = null;
Commands.TryGetValue( e.Command, out command );
Commands.TryGetValue( e.Command, out BaseCommand command );
if ( command == null )
e.Mobile.SendMessage( "That is either an invalid command name or one that does not support this modifier." );
@ -93,4 +91,4 @@ namespace Server.Commands.Generic
RunCommand( from, targeted, command, args );
}
}
}
}

View file

@ -19,8 +19,8 @@ namespace Server.Commands
private static Dictionary<string, CommandInfo> m_HelpInfos = new Dictionary<string, CommandInfo>();
private static List<CommandInfo> m_SortedHelpInfo = new List<CommandInfo>(); //No need for SortedList cause it's only sorted once at creation...
public static Dictionary<string, CommandInfo> HelpInfos{ get { return m_HelpInfos; } }
public static List<CommandInfo> SortedHelpInfo { get { return m_SortedHelpInfo; } }
public static Dictionary<string, CommandInfo> HelpInfos => m_HelpInfos;
public static List<CommandInfo> SortedHelpInfo => m_SortedHelpInfo;
[CallPriority( 100 )]
public static void Initialize()
@ -37,9 +37,7 @@ namespace Server.Commands
if( e.Length > 0 )
{
string arg = e.GetString( 0 ).ToLower();
CommandInfo c;
if( m_HelpInfos.TryGetValue( arg, out c ) )
if (m_HelpInfos.TryGetValue( arg, out CommandInfo c ))
{
Mobile m = e.Mobile;
@ -419,4 +417,4 @@ namespace Server.Commands
}
}
}
}
}