Add a save function

This commit is contained in:
Tim Young 2017-09-16 08:11:35 -05:00
parent 84e15883fd
commit 7d1883b765
1 changed files with 16 additions and 0 deletions

View File

@ -40,6 +40,22 @@ namespace SpriteLibrary
LoadSpriteInfo();
}
internal void Save()
{
if(!DoesResourceExist(Filename))
{
//we will try to save it as a file
try
{
WriteToXmlFile<List<SpriteInfo>>(Filename, SpriteInfoList);
}
catch (Exception e)
{
throw new Exception("SpriteDatabase failed to save: Filename:" + Filename +"\n" + "ERROR: " + e.ToString(), e);
}
}
}
public void SetSnapGridSize(Size GridSize)
{
if (GridSize.Width <= 0) return;