7лаба
This commit is contained in:
parent
11cf233e44
commit
2b67952e64
@ -148,18 +148,18 @@ public void SaveData(string filename)
|
||||
{
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
throw new Exception("Файл не найден");
|
||||
throw new FileNotFoundException("Файл не найден");
|
||||
}
|
||||
using (StreamReader sr = new StreamReader(filename))
|
||||
{
|
||||
string str = sr.ReadLine();
|
||||
if (str == null || str.Length == 0)
|
||||
{
|
||||
throw new Exception("Нет данных для загрузки");
|
||||
throw new NullReferenceException("Нет данных для загрузки");
|
||||
}
|
||||
if (!str.StartsWith("ShipStorage"))
|
||||
{
|
||||
throw new Exception("Неверный формат данных");
|
||||
throw new FormatException("Неверный формат данных");
|
||||
|
||||
}
|
||||
_shipStorages.Clear();
|
||||
@ -190,7 +190,7 @@ public void SaveData(string filename)
|
||||
}
|
||||
catch (ApplicationException ex)
|
||||
{
|
||||
throw new Exception($"Ошибка добавления в коллекцию: {ex.Message}");
|
||||
throw new ApplicationException($"Ошибка добавления в коллекцию: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user