-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented Domiii's uber-config. App.config should now be obsolete.
- Loading branch information
Showing
11 changed files
with
290 additions
and
155 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,147 @@ | ||
namespace TerrainDisplay | ||
using System; | ||
using System.IO; | ||
using System.Xml; | ||
using System.Xml.Schema; | ||
using System.Xml.Serialization; | ||
|
||
namespace TerrainDisplay | ||
{ | ||
public class TileIdentifier | ||
public class TileIdentifier : IXmlSerializable | ||
{ | ||
public string TileName; | ||
public int MapId; | ||
public string MapName; | ||
public int TileX; | ||
public int TileY; | ||
|
||
public TileIdentifier(int mapId, string mapName, int tileX, int tileY) | ||
|
||
public TileIdentifier() | ||
{ | ||
} | ||
|
||
public TileIdentifier(string tileName, int mapId, string mapName, int tileX, int tileY) | ||
{ | ||
TileName = tileName; | ||
MapId = mapId; | ||
MapName = mapName; | ||
TileX = tileX; | ||
TileY = tileY; | ||
} | ||
|
||
public static TileIdentifier Redridge | ||
public static TileIdentifier Redridge = new TileIdentifier | ||
{ | ||
get | ||
{ | ||
const int mapId = 0; | ||
const string mapName = "Azeroth"; | ||
const int tileX = 49; | ||
const int tileY = 36; | ||
return new TileIdentifier(mapId, mapName, tileX, tileY); | ||
} | ||
TileName = "Redridge", | ||
MapId = 0, | ||
MapName = "Azeroth", | ||
TileX = 49, | ||
TileY = 36 | ||
}; | ||
|
||
public static TileIdentifier CenterTile = new TileIdentifier | ||
{ | ||
TileName = "Map Center", | ||
MapId = 0, | ||
MapName = "Azeroth", | ||
TileX = 32, | ||
TileY = 32 | ||
}; | ||
|
||
public static TileIdentifier Stormwind = new TileIdentifier | ||
{ | ||
TileName = "Stormwind", | ||
MapId = 0, | ||
MapName = "Azeroth", | ||
TileX = 48, | ||
TileY = 30 | ||
}; | ||
|
||
public static TileIdentifier BurningSteppes = new TileIdentifier | ||
{ | ||
TileName = "Burning Steppes", | ||
MapId = 0, | ||
MapName = "Azeroth", | ||
TileX = 49, | ||
TileY = 33 | ||
}; | ||
|
||
#region Implementation of IXmlSerializable | ||
|
||
public XmlSchema GetSchema() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public static TileIdentifier CenterTile | ||
public void ReadXml(XmlReader reader) | ||
{ | ||
get | ||
reader.Read(); | ||
if (!reader.IsStartElement("TileName")) | ||
{ | ||
const int mapId = 0; | ||
const string mapName = "Azeroth"; | ||
const int tileX = 32; | ||
const int tileY = 32; | ||
return new TileIdentifier(mapId, mapName, tileX, tileY); | ||
Console.WriteLine( | ||
"Malformed TileIdentifer entry in the config Xml. TileName should be the first element."); | ||
TileName = "MapCenter"; | ||
} | ||
else | ||
{ | ||
TileName = reader.ReadElementContentAsString(); | ||
} | ||
} | ||
|
||
public static TileIdentifier Stormwind | ||
{ | ||
get | ||
reader.Read(); | ||
if (!reader.IsStartElement("MapId")) | ||
{ | ||
Console.WriteLine( | ||
"Malformed TileIdentifer entry in the config Xml. MapId should be the second element."); | ||
MapId = 0; | ||
} | ||
else | ||
{ | ||
MapId = reader.ReadElementContentAsInt(); | ||
} | ||
|
||
reader.Read(); | ||
if (!reader.IsStartElement("MapName")) | ||
{ | ||
Console.WriteLine( | ||
"Malformed TileIdentifer entry in the config Xml. MapName should be the third element."); | ||
MapName = "Map Center"; | ||
} | ||
else | ||
{ | ||
MapName = reader.ReadElementContentAsString(); | ||
} | ||
|
||
reader.Read(); | ||
if (!reader.IsStartElement("TileX")) | ||
{ | ||
const int mapId = 0; | ||
const string mapName = "Azeroth"; | ||
const int tileX = 48; | ||
const int tileY = 30; | ||
return new TileIdentifier(mapId, mapName, tileX, tileY); | ||
Console.WriteLine( | ||
"Malformed TileIdentifer entry in the config Xml. TileX should be fourth element."); | ||
TileX = 32; | ||
} | ||
else | ||
{ | ||
TileX = reader.ReadElementContentAsInt(); | ||
} | ||
|
||
reader.Read(); | ||
if (!reader.IsStartElement("TileY")) | ||
{ | ||
Console.WriteLine( | ||
"Malformed TileIdentifer entry in the config Xml. TileY should be the fifth element. ... (Speaking of Fifth Element, what a great show, yeah?)"); | ||
TileY = 32; | ||
} | ||
else | ||
{ | ||
TileY = reader.ReadElementContentAsInt(); | ||
} | ||
} | ||
|
||
public static TileIdentifier BurningSteppes | ||
public void WriteXml(XmlWriter writer) | ||
{ | ||
get | ||
{ | ||
const int mapId = 0; | ||
const string mapName = "Azeroth"; | ||
const int tileX = 49; | ||
const int tileY = 33; | ||
return new TileIdentifier(mapId, mapName, tileX, tileY); | ||
} | ||
writer.WriteElementString("TileName", TileName); | ||
writer.WriteElementString("MapId", MapId.ToString()); | ||
writer.WriteElementString("MapName", MapName); | ||
writer.WriteElementString("TileX", TileX.ToString()); | ||
writer.WriteElementString("TileY", TileY.ToString()); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.