Changes properties to use automatic property initializers

This commit is contained in:
Kamron Batman 2018-09-14 15:23:29 -07:00
parent f0a48ad431
commit 06fa31a7bf
623 changed files with 13072 additions and 19304 deletions

View file

@ -9,7 +9,6 @@ namespace Server.Engines.Chat
private string m_Password;
private List<ChatUser> m_Users, m_Banned, m_Moderators, m_Voices;
private bool m_VoiceRestricted;
private bool m_AlwaysAvailable;
public Channel( string name )
{
@ -141,7 +140,7 @@ namespace Server.Engines.Chat
m_Users.Add( user );
user.CurrentChannel = this;
if ( user.Mobile.AccessLevel >= AccessLevel.GameMaster || (!m_AlwaysAvailable && m_Users.Count == 1) )
if ( user.Mobile.AccessLevel >= AccessLevel.GameMaster || (!AlwaysAvailable && m_Users.Count == 1) )
AddModerator( user );
SendUsersTo( user );
@ -165,7 +164,7 @@ namespace Server.Engines.Chat
SendCommand( ChatCommand.RemoveUserFromChannel, user, user.Username );
ChatSystem.SendCommandTo( user.Mobile, ChatCommand.LeaveChannel );
if ( m_Users.Count == 0 && !m_AlwaysAvailable )
if ( m_Users.Count == 0 && !AlwaysAvailable )
RemoveChannel( this );
}
}
@ -241,11 +240,7 @@ namespace Server.Engines.Chat
}
}
public bool AlwaysAvailable
{
get => m_AlwaysAvailable;
set => m_AlwaysAvailable = value;
}
public bool AlwaysAvailable { get; set; }
public void AddVoiced( ChatUser user )
{
@ -441,15 +436,13 @@ namespace Server.Engines.Chat
}
}
private static List<Channel> m_Channels = new List<Channel>();
public static List<Channel> Channels => m_Channels;
public static List<Channel> Channels { get; } = new List<Channel>();
public static void SendChannelsTo( ChatUser user )
{
for ( int i = 0; i < m_Channels.Count; ++i )
for ( int i = 0; i < Channels.Count; ++i )
{
Channel channel = m_Channels[i];
Channel channel = Channels[i];
if ( !channel.IsBanned( user ) )
ChatSystem.SendCommandTo( user.Mobile, ChatCommand.AddChannel, channel.Name, "0" );
@ -468,7 +461,7 @@ namespace Server.Engines.Chat
if ( channel == null )
{
channel = new Channel( name, password );
m_Channels.Add( channel );
Channels.Add( channel );
}
ChatUser.GlobalSendCommand( ChatCommand.AddChannel, name, "0" ) ;
@ -486,22 +479,22 @@ namespace Server.Engines.Chat
if ( channel == null )
return;
if ( m_Channels.Contains( channel ) && channel.m_Users.Count == 0 )
if ( Channels.Contains( channel ) && channel.m_Users.Count == 0 )
{
ChatUser.GlobalSendCommand( ChatCommand.RemoveChannel, channel.Name ) ;
channel.m_Moderators.Clear();
channel.m_Voices.Clear();
m_Channels.Remove( channel );
Channels.Remove( channel );
}
}
public static Channel FindChannelByName( string name )
{
for ( int i = 0; i < m_Channels.Count; ++i )
for ( int i = 0; i < Channels.Count; ++i )
{
Channel channel = m_Channels[i];
Channel channel = Channels[i];
if ( channel.m_Name == name )
return channel;