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

@ -4,14 +4,9 @@ namespace Server.Gumps
{
public class ChildNode
{
private ParentNode m_Parent;
private string m_Name;
private Point3D m_Location;
public ChildNode( XmlTextReader xml, ParentNode parent )
{
m_Parent = parent;
Parent = parent;
Parse( xml );
}
@ -19,9 +14,9 @@ namespace Server.Gumps
private void Parse( XmlTextReader xml )
{
if ( xml.MoveToAttribute( "name" ) )
m_Name = xml.Value;
Name = xml.Value;
else
m_Name = "empty";
Name = "empty";
int x = 0, y = 0, z = 0;
@ -34,13 +29,13 @@ namespace Server.Gumps
if ( xml.MoveToAttribute( "z" ) )
z = Utility.ToInt32( xml.Value );
m_Location = new Point3D( x, y, z );
Location = new Point3D( x, y, z );
}
public ParentNode Parent => m_Parent;
public ParentNode Parent { get; }
public string Name => m_Name;
public string Name { get; private set; }
public Point3D Location => m_Location;
public Point3D Location { get; private set; }
}
}

View file

@ -6,14 +6,10 @@ namespace Server.Gumps
{
public class LocationTree
{
private Map m_Map;
private ParentNode m_Root;
private Dictionary<Mobile, ParentNode> m_LastBranch;
public LocationTree( string fileName, Map map )
{
m_LastBranch = new Dictionary<Mobile, ParentNode>();
m_Map = map;
LastBranch = new Dictionary<Mobile, ParentNode>();
Map = map;
string path = Path.Combine( "Data/Locations/", fileName );
@ -23,17 +19,17 @@ namespace Server.Gumps
xml.WhitespaceHandling = WhitespaceHandling.None;
m_Root = Parse( xml );
Root = Parse( xml );
xml.Close();
}
}
public Dictionary<Mobile, ParentNode> LastBranch => m_LastBranch;
public Dictionary<Mobile, ParentNode> LastBranch { get; }
public Map Map => m_Map;
public Map Map { get; }
public ParentNode Root => m_Root;
public ParentNode Root { get; }
private ParentNode Parse( XmlTextReader xml )
{

View file

@ -5,14 +5,9 @@ namespace Server.Gumps
{
public class ParentNode
{
private ParentNode m_Parent;
private object[] m_Children;
private string m_Name;
public ParentNode( XmlTextReader xml, ParentNode parent )
{
m_Parent = parent;
Parent = parent;
Parse( xml );
}
@ -20,13 +15,13 @@ namespace Server.Gumps
private void Parse( XmlTextReader xml )
{
if ( xml.MoveToAttribute( "name" ) )
m_Name = xml.Value;
Name = xml.Value;
else
m_Name = "empty";
Name = "empty";
if ( xml.IsEmptyElement )
{
m_Children = new object[0];
Children = new object[0];
}
else
{
@ -49,14 +44,14 @@ namespace Server.Gumps
}
}
m_Children = children.ToArray();
Children = children.ToArray();
}
}
public ParentNode Parent => m_Parent;
public ParentNode Parent { get; }
public object[] Children => m_Children;
public object[] Children { get; private set; }
public string Name => m_Name;
public string Name { get; private set; }
}
}