Changes properties to use automatic property initializers
This commit is contained in:
parent
f0a48ad431
commit
06fa31a7bf
623 changed files with 13072 additions and 19304 deletions
|
|
@ -34,21 +34,17 @@ namespace Server
|
|||
|
||||
public class ClientVersion : IComparable, IComparer
|
||||
{
|
||||
private int m_Major, m_Minor, m_Revision, m_Patch;
|
||||
private ClientType m_Type;
|
||||
private string m_SourceString;
|
||||
public int Major { get; }
|
||||
|
||||
public int Major => m_Major;
|
||||
public int Minor { get; }
|
||||
|
||||
public int Minor => m_Minor;
|
||||
public int Revision { get; }
|
||||
|
||||
public int Revision => m_Revision;
|
||||
public int Patch { get; }
|
||||
|
||||
public int Patch => m_Patch;
|
||||
public ClientType Type { get; }
|
||||
|
||||
public ClientType Type => m_Type;
|
||||
|
||||
public string SourceString => m_SourceString;
|
||||
public string SourceString { get; }
|
||||
|
||||
public ClientVersion( int maj, int min, int rev, int pat ) : this( maj, min, rev, pat, ClientType.Regular )
|
||||
{
|
||||
|
|
@ -56,13 +52,13 @@ namespace Server
|
|||
|
||||
public ClientVersion( int maj, int min, int rev, int pat, ClientType type )
|
||||
{
|
||||
m_Major = maj;
|
||||
m_Minor = min;
|
||||
m_Revision = rev;
|
||||
m_Patch = pat;
|
||||
m_Type = type;
|
||||
Major = maj;
|
||||
Minor = min;
|
||||
Revision = rev;
|
||||
Patch = pat;
|
||||
Type = type;
|
||||
|
||||
m_SourceString = _ToStringImpl();
|
||||
SourceString = _ToStringImpl();
|
||||
}
|
||||
|
||||
public static bool operator == ( ClientVersion l, ClientVersion r )
|
||||
|
|
@ -97,7 +93,7 @@ namespace Server
|
|||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return m_Major ^ m_Minor ^ m_Revision ^ m_Patch ^ (int)m_Type;
|
||||
return Major ^ Minor ^ Revision ^ Patch ^ (int)Type;
|
||||
}
|
||||
|
||||
public override bool Equals( object obj )
|
||||
|
|
@ -110,38 +106,38 @@ namespace Server
|
|||
if ( v == null )
|
||||
return false;
|
||||
|
||||
return m_Major == v.m_Major
|
||||
&& m_Minor == v.m_Minor
|
||||
&& m_Revision == v.m_Revision
|
||||
&& m_Patch == v.m_Patch
|
||||
&& m_Type == v.m_Type;
|
||||
return Major == v.Major
|
||||
&& Minor == v.Minor
|
||||
&& Revision == v.Revision
|
||||
&& Patch == v.Patch
|
||||
&& Type == v.Type;
|
||||
}
|
||||
|
||||
private string _ToStringImpl()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder(16);
|
||||
|
||||
builder.Append(m_Major);
|
||||
builder.Append(Major);
|
||||
builder.Append('.');
|
||||
builder.Append(m_Minor);
|
||||
builder.Append(Minor);
|
||||
builder.Append('.');
|
||||
builder.Append(m_Revision);
|
||||
builder.Append(Revision);
|
||||
|
||||
if (m_Major <= 5 && m_Minor <= 0 && m_Revision <= 6) //Anything before 5.0.7
|
||||
if (Major <= 5 && Minor <= 0 && Revision <= 6) //Anything before 5.0.7
|
||||
{
|
||||
if (m_Patch > 0)
|
||||
builder.Append((char)('a' + (m_Patch - 1)));
|
||||
if (Patch > 0)
|
||||
builder.Append((char)('a' + (Patch - 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Append('.');
|
||||
builder.Append(m_Patch);
|
||||
builder.Append(Patch);
|
||||
}
|
||||
|
||||
if (m_Type != ClientType.Regular)
|
||||
if (Type != ClientType.Regular)
|
||||
{
|
||||
builder.Append(' ');
|
||||
builder.Append(m_Type.ToString());
|
||||
builder.Append(Type.ToString());
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
|
|
@ -154,7 +150,7 @@ namespace Server
|
|||
|
||||
public ClientVersion( string fmt )
|
||||
{
|
||||
m_SourceString = fmt;
|
||||
SourceString = fmt;
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -167,37 +163,37 @@ namespace Server
|
|||
while ( br3 < fmt.Length && char.IsDigit( fmt, br3 ) )
|
||||
br3++;
|
||||
|
||||
m_Major = Utility.ToInt32( fmt.Substring( 0, br1 ) );
|
||||
m_Minor = Utility.ToInt32( fmt.Substring( br1 + 1, br2 - br1 - 1 ) );
|
||||
m_Revision = Utility.ToInt32( fmt.Substring( br2 + 1, br3 - br2 - 1 ) );
|
||||
Major = Utility.ToInt32( fmt.Substring( 0, br1 ) );
|
||||
Minor = Utility.ToInt32( fmt.Substring( br1 + 1, br2 - br1 - 1 ) );
|
||||
Revision = Utility.ToInt32( fmt.Substring( br2 + 1, br3 - br2 - 1 ) );
|
||||
|
||||
if ( br3 < fmt.Length )
|
||||
{
|
||||
if ( m_Major <= 5 && m_Minor <= 0 && m_Revision <= 6 ) //Anything before 5.0.7
|
||||
if ( Major <= 5 && Minor <= 0 && Revision <= 6 ) //Anything before 5.0.7
|
||||
{
|
||||
if ( !char.IsWhiteSpace( fmt, br3 ) )
|
||||
m_Patch = (fmt[br3] - 'a') + 1;
|
||||
Patch = (fmt[br3] - 'a') + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Patch = Utility.ToInt32( fmt.Substring( br3+1, fmt.Length - br3 - 1 ) );
|
||||
Patch = Utility.ToInt32( fmt.Substring( br3+1, fmt.Length - br3 - 1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( fmt.IndexOf( "god" ) >= 0 || fmt.IndexOf( "gq" ) >= 0 )
|
||||
m_Type = ClientType.God;
|
||||
Type = ClientType.God;
|
||||
else if ( fmt.IndexOf( "third dawn" ) >= 0 || fmt.IndexOf( "uo:td" ) >= 0 || fmt.IndexOf( "uotd" ) >= 0 || fmt.IndexOf( "uo3d" ) >= 0 || fmt.IndexOf( "uo:3d" ) >= 0 )
|
||||
m_Type = ClientType.UOTD;
|
||||
Type = ClientType.UOTD;
|
||||
else
|
||||
m_Type = ClientType.Regular;
|
||||
Type = ClientType.Regular;
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_Major = 0;
|
||||
m_Minor = 0;
|
||||
m_Revision = 0;
|
||||
m_Patch = 0;
|
||||
m_Type = ClientType.Regular;
|
||||
Major = 0;
|
||||
Minor = 0;
|
||||
Revision = 0;
|
||||
Patch = 0;
|
||||
Type = ClientType.Regular;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -211,21 +207,21 @@ namespace Server
|
|||
if ( o == null )
|
||||
throw new ArgumentException();
|
||||
|
||||
if ( m_Major > o.m_Major )
|
||||
if ( Major > o.Major )
|
||||
return 1;
|
||||
if ( m_Major < o.m_Major )
|
||||
if ( Major < o.Major )
|
||||
return -1;
|
||||
if ( m_Minor > o.m_Minor )
|
||||
if ( Minor > o.Minor )
|
||||
return 1;
|
||||
if ( m_Minor < o.m_Minor )
|
||||
if ( Minor < o.Minor )
|
||||
return -1;
|
||||
if ( m_Revision > o.m_Revision )
|
||||
if ( Revision > o.Revision )
|
||||
return 1;
|
||||
if ( m_Revision < o.m_Revision )
|
||||
if ( Revision < o.Revision )
|
||||
return -1;
|
||||
if ( m_Patch > o.m_Patch )
|
||||
if ( Patch > o.Patch )
|
||||
return 1;
|
||||
if ( m_Patch < o.m_Patch )
|
||||
if ( Patch < o.Patch )
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue