diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/ExtentionDrawningCar.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/ExtentionDrawingLocomotive.cs
similarity index 97%
rename from ProjectElectricLocomotive/ProjectElectricLocomotive/ExtentionDrawningCar.cs
rename to ProjectElectricLocomotive/ProjectElectricLocomotive/ExtentionDrawingLocomotive.cs
index f577133..a2f4878 100644
--- a/ProjectElectricLocomotive/ProjectElectricLocomotive/ExtentionDrawningCar.cs
+++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/ExtentionDrawingLocomotive.cs
@@ -53,7 +53,7 @@ namespace ProjectElectricLocomotive
///
/// Получение данных для сохранения в файл
///
- /// Сохраняемый объект
+ /// Сохраняемый объект
/// Разделитель даннных
/// Строка с данными по объекту
public static string GetDataForSave(this DrawingLocomotive drawningLoco, char separatorForObject)
diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/LocomotiveGenericStorage.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/LocomotiveGenericStorage.cs
index 70be0c9..100df98 100644
--- a/ProjectElectricLocomotive/ProjectElectricLocomotive/LocomotiveGenericStorage.cs
+++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/LocomotiveGenericStorage.cs
@@ -104,8 +104,7 @@ namespace ProjectElectricLocomotive.Generics
File.Delete(filename);
}
StringBuilder data = new();
- foreach (KeyValuePair> record in _locomotivesStorage)
+ foreach (KeyValuePair> record in _locomotivesStorage)
{
StringBuilder records = new();
foreach (DrawingLocomotive? elem in record.Value.GetLocomotives)
@@ -156,19 +155,14 @@ namespace ProjectElectricLocomotive.Generics
_locomotivesStorage.Clear();
string strs = "";
- bool firstinit = true;
while ((strs = fs.ReadLine()) != null)
{
- if (strs == null && firstinit)
+
+ if (strs == null)
{
return false;
}
- else if (strs == null)
- {
- break;
- }
- firstinit = false;
string[] record = strs.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
if (record.Length != 2)
@@ -182,7 +176,7 @@ namespace ProjectElectricLocomotive.Generics
DrawingLocomotive? loco = elem?.CreateDrawingLocomotive(_separatorForObject, _pictureWidth, _pictureHeight);
if (loco != null)
{
- if ((collection + loco) == -1) // or vice versa
+ if ((collection + loco) == -1) // for my realization it's -1, for eegov's realization it's boolean
{
return false;
}
@@ -191,77 +185,7 @@ namespace ProjectElectricLocomotive.Generics
_locomotivesStorage.Add(record[0], collection);
}
return true;
-
}
-
- /*foreach(string data in str)
- {
- string[] record = data.Split(_separatorForKeyValue,
- StringSplitOptions.RemoveEmptyEntries);
- if (record.Length != 2)
- {
- continue;
- }
- LocomotiveGenericCollection
- collection = new(_pictureWidth, _pictureHeight);
- string[] set = record[1].Split(_separatorRecords,
- StringSplitOptions.RemoveEmptyEntries);
- foreach (string elem in set)
- {
- DrawingLocomotive? loco =
- elem?.CreateDrawingLocomotive(_separatorForObject, _pictureWidth, _pictureHeight);
- if (loco != null)
- {
- if ((collection + loco) != -1) // or vice versa
- {
- return false;
- }
- }
- }
- _locomotivesStorage.Add(record[0], collection);
- }
- return true;
-
- }*/
- /*var strs = bufferTextFromFile.Split(new char[] { '\n', '\r' },
- StringSplitOptions.RemoveEmptyEntries);
- if (str == null || str.Length == 0)
- {
- return false;
- }
- if (!strs[0].StartsWith("LocomotiveStorage"))
- {
- //если нет такой записи, то это не те данные
- return false;
- }
- _locomotivesStorage.Clear();
- foreach (string data in str)
- {
- string[] record = data.Split(_separatorForKeyValue,
- StringSplitOptions.RemoveEmptyEntries);
- if (record.Length != 2)
- {
- continue;
- }
- LocomotiveGenericCollection
- collection = new(_pictureWidth, _pictureHeight);
- string[] set = record[1].Split(_separatorRecords,
- StringSplitOptions.RemoveEmptyEntries);
- foreach (string elem in set)
- {
- DrawingLocomotive? loco =
- elem?.CreateDrawingLocomotive(_separatorForObject, _pictureWidth, _pictureHeight);
- if (loco != null)
- {
- if ((collection + loco) != -1) // or vice versa
- {
- return false;
- }
- }
- }
- _locomotivesStorage.Add(record[0], collection);
- }
- return true;*/
}
}
}