Add serialization exceptions
This commit is contained in:
parent
dd34fcbfa9
commit
469dc33087
@ -58,7 +58,7 @@ namespace AirBomber.Generics
|
|||||||
public bool SaveData(string FileName)
|
public bool SaveData(string FileName)
|
||||||
{
|
{
|
||||||
if (_entityStorages.Count == 0)
|
if (_entityStorages.Count == 0)
|
||||||
return false;
|
throw new Exception("Невалиданя операция, нет данных для сохранения");
|
||||||
|
|
||||||
using (StreamWriter writer = new StreamWriter(FileName, false))
|
using (StreamWriter writer = new StreamWriter(FileName, false))
|
||||||
{
|
{
|
||||||
@ -81,12 +81,12 @@ namespace AirBomber.Generics
|
|||||||
public bool LoadData(string FileName)
|
public bool LoadData(string FileName)
|
||||||
{
|
{
|
||||||
if (!File.Exists(FileName))
|
if (!File.Exists(FileName))
|
||||||
return false;
|
throw new Exception("Файл не найден");
|
||||||
|
|
||||||
using (StreamReader reader = new StreamReader(FileName))
|
using (StreamReader reader = new StreamReader(FileName))
|
||||||
{
|
{
|
||||||
if (reader.ReadLine() != "BomberStorage")
|
if (reader.ReadLine() != "BomberStorage")
|
||||||
return false;
|
throw new Exception("Неверный формат данных");
|
||||||
|
|
||||||
_entityStorages.Clear();
|
_entityStorages.Clear();
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ namespace AirBomber.Generics
|
|||||||
if (Renderer != null)
|
if (Renderer != null)
|
||||||
{
|
{
|
||||||
if ((Collection + Renderer) == -1)
|
if ((Collection + Renderer) == -1)
|
||||||
return false;
|
throw new Exception("Ошибка добавления в коллекцию");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user