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

@ -33,18 +33,12 @@ namespace Server.Items
public abstract class BaseBulletinBoard : Item
{
private string m_BoardName;
[CommandProperty( AccessLevel.GameMaster )]
public string BoardName
{
get => m_BoardName;
set => m_BoardName = value;
}
public string BoardName { get; set; }
public BaseBulletinBoard( int itemID ) : base( itemID )
{
m_BoardName = "bulletin board";
BoardName = "bulletin board";
Movable = false;
}
@ -188,7 +182,7 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.Write( (string) m_BoardName );
writer.Write( (string) BoardName );
}
public override void Deserialize( GenericReader reader )
@ -201,7 +195,7 @@ namespace Server.Items
{
case 0:
{
m_BoardName = reader.ReadString();
BoardName = reader.ReadString();
break;
}
}
@ -315,19 +309,9 @@ namespace Server.Items
public class BulletinMessage : Item
{
private Mobile m_Poster;
private string m_Subject;
private DateTime m_Time, m_LastPostTime;
private BulletinMessage m_Thread;
private string m_PostedName;
private int m_PostedBody;
private int m_PostedHue;
private BulletinEquip[] m_PostedEquip;
private string[] m_Lines;
public string GetTimeAsString()
{
return m_Time.ToString( "MMM dd, yyyy" );
return Time.ToString( "MMM dd, yyyy" );
}
public override bool CheckTarget( Mobile from, Targeting.Target targ, object targeted )
@ -344,15 +328,15 @@ namespace Server.Items
{
Movable = false;
m_Poster = poster;
m_Subject = subject;
m_Time = DateTime.UtcNow;
m_LastPostTime = m_Time;
m_Thread = thread;
m_PostedName = m_Poster.Name;
m_PostedBody = m_Poster.Body;
m_PostedHue = m_Poster.Hue;
m_Lines = lines;
Poster = poster;
Subject = subject;
Time = DateTime.UtcNow;
LastPostTime = Time;
Thread = thread;
PostedName = Poster.Name;
PostedBody = Poster.Body;
PostedHue = Poster.Hue;
Lines = lines;
List<BulletinEquip> list = new List<BulletinEquip>();
@ -364,21 +348,28 @@ namespace Server.Items
list.Add( new BulletinEquip( item.ItemID, item.Hue ) );
}
m_PostedEquip = list.ToArray();
PostedEquip = list.ToArray();
}
public Mobile Poster => m_Poster;
public BulletinMessage Thread => m_Thread;
public string Subject => m_Subject;
public DateTime Time => m_Time;
public DateTime LastPostTime{ get => m_LastPostTime;
set => m_LastPostTime = value;
}
public string PostedName => m_PostedName;
public int PostedBody => m_PostedBody;
public int PostedHue => m_PostedHue;
public BulletinEquip[] PostedEquip => m_PostedEquip;
public string[] Lines => m_Lines;
public Mobile Poster { get; private set; }
public BulletinMessage Thread { get; private set; }
public string Subject { get; private set; }
public DateTime Time { get; private set; }
public DateTime LastPostTime { get; set; }
public string PostedName { get; private set; }
public int PostedBody { get; private set; }
public int PostedHue { get; private set; }
public BulletinEquip[] PostedEquip { get; private set; }
public string[] Lines { get; private set; }
public BulletinMessage( Serial serial ) : base( serial )
{
@ -390,28 +381,28 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( (Mobile) m_Poster );
writer.Write( (string) m_Subject );
writer.Write( (DateTime) m_Time );
writer.Write( (DateTime) m_LastPostTime );
writer.Write( (bool) (m_Thread != null) );
writer.Write( (Item) m_Thread );
writer.Write( (string) m_PostedName );
writer.Write( (int) m_PostedBody );
writer.Write( (int) m_PostedHue );
writer.Write( (Mobile) Poster );
writer.Write( (string) Subject );
writer.Write( (DateTime) Time );
writer.Write( (DateTime) LastPostTime );
writer.Write( (bool) (Thread != null) );
writer.Write( (Item) Thread );
writer.Write( (string) PostedName );
writer.Write( (int) PostedBody );
writer.Write( (int) PostedHue );
writer.Write( (int) m_PostedEquip.Length );
writer.Write( (int) PostedEquip.Length );
for ( int i = 0; i < m_PostedEquip.Length; ++i )
for ( int i = 0; i < PostedEquip.Length; ++i )
{
writer.Write( (int) m_PostedEquip[i].itemID );
writer.Write( (int) m_PostedEquip[i].hue );
writer.Write( (int) PostedEquip[i].itemID );
writer.Write( (int) PostedEquip[i].hue );
}
writer.Write( (int) m_Lines.Length );
writer.Write( (int) Lines.Length );
for ( int i = 0; i < m_Lines.Length; ++i )
writer.Write( (string) m_Lines[i] );
for ( int i = 0; i < Lines.Length; ++i )
writer.Write( (string) Lines[i] );
}
public override void Deserialize( GenericReader reader )
@ -425,30 +416,30 @@ namespace Server.Items
case 1:
case 0:
{
m_Poster = reader.ReadMobile();
m_Subject = reader.ReadString();
m_Time = reader.ReadDateTime();
m_LastPostTime = reader.ReadDateTime();
Poster = reader.ReadMobile();
Subject = reader.ReadString();
Time = reader.ReadDateTime();
LastPostTime = reader.ReadDateTime();
bool hasThread = reader.ReadBool();
m_Thread = reader.ReadItem() as BulletinMessage;
m_PostedName = reader.ReadString();
m_PostedBody = reader.ReadInt();
m_PostedHue = reader.ReadInt();
Thread = reader.ReadItem() as BulletinMessage;
PostedName = reader.ReadString();
PostedBody = reader.ReadInt();
PostedHue = reader.ReadInt();
m_PostedEquip = new BulletinEquip[reader.ReadInt()];
PostedEquip = new BulletinEquip[reader.ReadInt()];
for ( int i = 0; i < m_PostedEquip.Length; ++i )
for ( int i = 0; i < PostedEquip.Length; ++i )
{
m_PostedEquip[i].itemID = reader.ReadInt();
m_PostedEquip[i].hue = reader.ReadInt();
PostedEquip[i].itemID = reader.ReadInt();
PostedEquip[i].hue = reader.ReadInt();
}
m_Lines = new string[reader.ReadInt()];
Lines = new string[reader.ReadInt()];
for ( int i = 0; i < m_Lines.Length; ++i )
m_Lines[i] = reader.ReadString();
for ( int i = 0; i < Lines.Length; ++i )
Lines[i] = reader.ReadString();
if ( hasThread && m_Thread == null )
if ( hasThread && Thread == null )
Delete();
if ( version == 0 )