private static string SerializeZone( [NotNull] Zone zone )
{
if ( zone == null )
throw new ArgumentNullException( "zone" );
string xheader;
if ( zone.CreatedBy != null ) {
xheader = zone.CreatedBy + " " + zone.CreatedDate.ToCompactString() + " ";
} else {
xheader = "- - ";
}
if ( zone.EditedBy != null ) {
xheader += zone.EditedBy + " " + zone.EditedDate.ToCompactString();
} else {
xheader += "- -";
}
var zoneExceptions = zone.Controller.ExceptionList;
string whitelist = zone.rawWhitelist ?? zoneExceptions.Included.JoinToString( " ", p => p.Name );
string blacklist = zone.rawBlacklist ?? zoneExceptions.Excluded.JoinToString( " ", p => p.Name );
return String.Format( "{0},{1},{2},{3},{4}",
String.Format( "{0} {1} {2} {3} {4} {5} {6} {7}",
zone.Name,
zone.Bounds.XMin, zone.Bounds.YMin, zone.Bounds.ZMin,
zone.Bounds.XMax, zone.Bounds.YMax, zone.Bounds.ZMax,
zone.Controller.MinRank.FullName ),
whitelist,
blacklist,
xheader,
null == zone.Message ? "" : zone.Message.Replace( ',', '\\' ) );
}