public Zone(string raw, World world)
{
string[] parts = raw.Split(',');
string[] header = parts[0].Split(' ');
Name = header[0];
Bounds = new BoundingBox(Int32.Parse(header[1]), Int32.Parse(header[2]), Int32.Parse(header[3]),
Int32.Parse(header[4]), Int32.Parse(header[5]), Int32.Parse(header[6]));
Rank buildRank = RankManager.ParseRank(header[7]);
// if all else fails, fall back to lowest class
if (buildRank == null)
{
if (world != null)
{
Controller.MinRank = world.BuildSecurity.MinRank;
}
else
{
Controller.MinRank = null;
}
Logger.Log("Zone: Error parsing zone definition: unknown rank \"{0}\". Permission reset to default ({1}).", LogType.Error,
header[7], Controller.MinRank.Name);
}
else
{
Controller.MinRank = buildRank;
}
// Part 2:
foreach (string player in parts[1].Split(' '))
{
if (!Player.IsValidName(player))
{
continue;
}
PlayerInfo info = PlayerDB.FindPlayerInfoExact(player);
if (info == null)
{
continue; // player name not found in the DB (discarded)
}
Controller.Include(info);
}
// Part 3: excluded list
foreach (string player in parts[2].Split(' '))
{
if (!Player.IsValidName(player))
{
continue;
}
PlayerInfo info = PlayerDB.FindPlayerInfoExact(player);
if (info == null)
{
continue; // player name not found in the DB (discarded)
}
Controller.Exclude(info);
}
Controller.UpdatePlayerListCache();
// Part 4: extended header
if (parts.Length > 3)
{
string[] xheader = parts[3].Split(' ');
CreatedBy = PlayerDB.FindPlayerInfoExact(xheader[0]);
if (CreatedBy != null)
{
CreatedDate = DateTime.Parse(xheader[1]);
}
EditedBy = PlayerDB.FindPlayerInfoExact(xheader[2]);
if (EditedBy != null)
{
EditedDate = DateTime.Parse(xheader[3]);
}
}
}