public static void Save()
{
var lines = new List <string>();
foreach (Chest chest in Chests)
{
if (chest == null)
{
return; //it shouldn't EVER be null
}
else
{
if (Chest.TileIsChest(chest.GetPosition()))
{
if (chest.GetOwner() != "")
{
lines.Add(string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}",
chest.GetID(), chest.GetPosition().X, chest.GetPosition().Y,
chest.GetOwner(), chest.IsLocked(), chest.IsRegionLocked(),
chest.GetPassword(), chest.IsRefill(),
string.Join(",", chest.GetRefillItemNames())));
}
}
}
}
File.WriteAllLines(ChestSavePath, lines.ToArray());
}