Adds style cop (#109)
This commit is contained in:
parent
3e715bcb60
commit
556a17aba8
1725 changed files with 33831 additions and 38046 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -10,7 +10,7 @@ namespace Server.Accounting
|
|||
{
|
||||
public static bool Enabled = true;
|
||||
|
||||
private static List<InvalidAccountAccessLog> m_List = new List<InvalidAccountAccessLog>();
|
||||
private static readonly List<InvalidAccountAccessLog> m_List = new List<InvalidAccountAccessLog>();
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
@ -75,8 +75,7 @@ namespace Server.Accounting
|
|||
"{0}\t{1}\t{2}",
|
||||
DateTime.UtcNow,
|
||||
ns,
|
||||
accessLog.Counts
|
||||
);
|
||||
accessLog.Counts);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -113,13 +112,13 @@ namespace Server.Accounting
|
|||
RefreshAccessTime();
|
||||
}
|
||||
|
||||
public IPAddress Address{ get; set; }
|
||||
public IPAddress Address { get; set; }
|
||||
|
||||
public DateTime LastAccessTime{ get; set; }
|
||||
public DateTime LastAccessTime { get; set; }
|
||||
|
||||
public bool HasExpired => DateTime.UtcNow >= LastAccessTime + TimeSpan.FromHours(1.0);
|
||||
|
||||
public int Counts{ get; set; }
|
||||
public int Counts { get; set; }
|
||||
|
||||
public void RefreshAccessTime()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace Server.Accounting
|
|||
/// <summary>
|
||||
/// A string representing who added this comment.
|
||||
/// </summary>
|
||||
public string AddedBy{ get; }
|
||||
public string AddedBy { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the body of this comment. Setting this value will reset LastModified.
|
||||
|
|
@ -51,7 +51,7 @@ namespace Server.Accounting
|
|||
/// <summary>
|
||||
/// The date and time when this account was last modified -or- the comment creation time, if never modified.
|
||||
/// </summary>
|
||||
public DateTime LastModified{ get; private set; }
|
||||
public DateTime LastModified { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Serializes this AccountComment instance to an XmlTextWriter.
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@ namespace Server.Misc
|
|||
|
||||
public class AccountHandler
|
||||
{
|
||||
private static int MaxAccountsPerIP = 1;
|
||||
private static bool AutoAccountCreation = true;
|
||||
private static bool RestrictDeletion = !TestCenter.Enabled;
|
||||
private static TimeSpan DeleteDelay = TimeSpan.FromDays(7.0);
|
||||
private static readonly int MaxAccountsPerIP = 1;
|
||||
private static readonly bool AutoAccountCreation = true;
|
||||
private static readonly bool RestrictDeletion = !TestCenter.Enabled;
|
||||
private static readonly TimeSpan DeleteDelay = TimeSpan.FromDays(7.0);
|
||||
|
||||
public static PasswordProtection ProtectPasswords = PasswordProtection.NewCrypt;
|
||||
|
||||
private static CityInfo[] StartingCities =
|
||||
private static readonly CityInfo[] StartingCities =
|
||||
{
|
||||
new CityInfo("New Haven", "New Haven Bank", 1150168, 3667, 2625, 0),
|
||||
new CityInfo("Yew", "The Empath Abbey", 1075072, 633, 858, 0),
|
||||
|
|
@ -47,7 +47,7 @@ namespace Server.Misc
|
|||
// ..
|
||||
new CityInfo( "Haven", "Buckler's Hideaway", 3667, 2625, 0 )
|
||||
|
||||
if ( Core.AOS )
|
||||
if (Core.AOS)
|
||||
{
|
||||
//CityInfo haven = new CityInfo( "Haven", "Uzeraan's Mansion", 3618, 2591, 0 );
|
||||
CityInfo haven = new CityInfo( "Haven", "Uzeraan's Mansion", 3503, 2574, 14 );
|
||||
|
|
@ -55,7 +55,7 @@ namespace Server.Misc
|
|||
}
|
||||
*/
|
||||
|
||||
private static bool PasswordCommandEnabled = false;
|
||||
private static readonly bool PasswordCommandEnabled = false;
|
||||
|
||||
private static Dictionary<IPAddress, int> m_IPTable;
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ namespace Server.Misc
|
|||
'<', '>', ':', '"', '/', '\\', '|', '?', '*'
|
||||
};
|
||||
|
||||
public static AccessLevel LockdownLevel{ get; set; }
|
||||
public static AccessLevel LockdownLevel { get; set; }
|
||||
|
||||
public static Dictionary<IPAddress, int> IPTable
|
||||
{
|
||||
|
|
@ -174,10 +174,10 @@ namespace Server.Misc
|
|||
from.SendMessage(
|
||||
"Your IP address does not match that which created this account. A page has been entered into the help system on your behalf.");
|
||||
|
||||
from.SendLocalizedMessage(501234, "",
|
||||
0x35); /* The next available Counselor/Game Master will respond as soon as possible.
|
||||
* Please check your Journal for messages every few minutes.
|
||||
*/
|
||||
/* The next available Counselor/Game Master will respond as soon as possible.
|
||||
* Please check your Journal for messages every few minutes.
|
||||
*/
|
||||
from.SendLocalizedMessage(501234, "", 0x35);
|
||||
|
||||
PageQueue.Enqueue(new PageEntry(from,
|
||||
$"[Automated: Change Password]<br>Desired password: {pass}<br>Current IP address: {ipAddress}<br>Account IP address: {accessList[0]}",
|
||||
|
|
@ -222,8 +222,7 @@ namespace Server.Misc
|
|||
state.Send(new CharacterListUpdate(acct));
|
||||
}
|
||||
else if (m.AccessLevel == AccessLevel.Player &&
|
||||
Region.Find(m.LogoutLocation, m.LogoutMap).IsPartOf<Jail>()
|
||||
) //Don't need to check current location, if netstate is null, they're logged out
|
||||
Region.Find(m.LogoutLocation, m.LogoutMap).IsPartOf<Jail>()) // Don't need to check current location, if netstate is null, they're logged out
|
||||
{
|
||||
state.Send(new DeleteResult(DeleteResultType.BadRequest));
|
||||
state.Send(new CharacterListUpdate(acct));
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ namespace Server.Accounting
|
|||
/// <summary>
|
||||
/// Gets or sets the name of this tag.
|
||||
/// </summary>
|
||||
public string Name{ get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of this tag.
|
||||
/// </summary>
|
||||
public string Value{ get; set; }
|
||||
public string Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Serializes this AccountTag instance to an XmlTextWriter.
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ namespace Server.Accounting
|
|||
using StreamWriter op = new StreamWriter(filePath);
|
||||
XmlTextWriter xml = new XmlTextWriter(op) { Formatting = Formatting.Indented, IndentChar = '\t', Indentation = 1 };
|
||||
|
||||
|
||||
xml.WriteStartDocument(true);
|
||||
|
||||
xml.WriteStartElement("accounts");
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace Server
|
|||
object toAdd;
|
||||
|
||||
IPAddress addr;
|
||||
if ( IPAddress.TryParse( line, out addr ) )
|
||||
if (IPAddress.TryParse( line, out addr ))
|
||||
toAdd = addr;
|
||||
else
|
||||
toAdd = line;
|
||||
|
|
@ -41,7 +41,7 @@ namespace Server
|
|||
}
|
||||
}
|
||||
|
||||
public static List<IFirewallEntry> List{ get; }
|
||||
public static List<IFirewallEntry> List { get; }
|
||||
|
||||
public static IFirewallEntry ToFirewallEntry(object entry)
|
||||
{
|
||||
|
|
@ -60,7 +60,7 @@ namespace Server
|
|||
if (IPAddress.TryParse(entry, out IPAddress addr))
|
||||
return new IPFirewallEntry(addr);
|
||||
|
||||
//Try CIDR parse
|
||||
// Try CIDR parse
|
||||
string[] str = entry.Split('/');
|
||||
|
||||
if (str.Length == 2)
|
||||
|
|
@ -147,15 +147,15 @@ namespace Server
|
|||
|
||||
for ( int i = 0; !contains && i < m_Blocked.Count; ++i )
|
||||
{
|
||||
if ( m_Blocked[i] is IPAddress )
|
||||
if (m_Blocked[i] is IPAddress)
|
||||
contains = ip.Equals( m_Blocked[i] );
|
||||
else if ( m_Blocked[i] is String )
|
||||
else if (m_Blocked[i] is String)
|
||||
{
|
||||
string s = (string)m_Blocked[i];
|
||||
|
||||
contains = Utility.IPMatchCIDR( s, ip );
|
||||
|
||||
if ( !contains )
|
||||
if (!contains)
|
||||
contains = Utility.IPMatch( s, ip );
|
||||
}
|
||||
}
|
||||
|
|
@ -164,8 +164,6 @@ namespace Server
|
|||
* */
|
||||
}
|
||||
|
||||
#region Firewall Entries
|
||||
|
||||
public interface IFirewallEntry
|
||||
{
|
||||
bool IsBlocked(IPAddress address);
|
||||
|
|
@ -173,7 +171,7 @@ namespace Server
|
|||
|
||||
public class IPFirewallEntry : IFirewallEntry
|
||||
{
|
||||
private IPAddress m_Address;
|
||||
private readonly IPAddress m_Address;
|
||||
|
||||
public IPFirewallEntry(IPAddress address) => m_Address = address;
|
||||
|
||||
|
|
@ -203,8 +201,8 @@ namespace Server
|
|||
|
||||
public class CIDRFirewallEntry : IFirewallEntry
|
||||
{
|
||||
private int m_CIDRLength;
|
||||
private IPAddress m_CIDRPrefix;
|
||||
private readonly int m_CIDRLength;
|
||||
private readonly IPAddress m_CIDRPrefix;
|
||||
|
||||
public CIDRFirewallEntry(IPAddress cidrPrefix, int cidrLength)
|
||||
{
|
||||
|
|
@ -240,7 +238,7 @@ namespace Server
|
|||
|
||||
public class WildcardIPFirewallEntry : IFirewallEntry
|
||||
{
|
||||
private string m_Entry;
|
||||
private readonly string m_Entry;
|
||||
|
||||
private bool m_Valid;
|
||||
|
||||
|
|
@ -249,7 +247,7 @@ namespace Server
|
|||
public bool IsBlocked(IPAddress address)
|
||||
{
|
||||
if (!m_Valid)
|
||||
return false; //Why process if it's invalid? it'll return false anyway after processing it.
|
||||
return false; // Why process if it's invalid? it'll return false anyway after processing it.
|
||||
|
||||
bool matched = Utility.IPMatch(m_Entry, address, out bool valid);
|
||||
m_Valid = valid;
|
||||
|
|
@ -268,7 +266,5 @@ namespace Server
|
|||
|
||||
public override int GetHashCode() => m_Entry.GetHashCode();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Server.Misc
|
|||
|
||||
public static IPAddress[] Exemptions =
|
||||
{
|
||||
//IPAddress.Parse( "127.0.0.1" ),
|
||||
// IPAddress.Parse( "127.0.0.1" ),
|
||||
};
|
||||
|
||||
public static bool IsExempt(IPAddress ip)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue