diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base/EntityBoat.cs b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base/EntityBoat.cs index 790b152..b530db9 100644 --- a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base/EntityBoat.cs +++ b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base/EntityBoat.cs @@ -19,6 +19,5 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base Weight = weight <= 0 ? rnd.Next(30, 100) : weight; BodyColor = bodyColor; } - } } diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base/MapsCollection.cs b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base/MapsCollection.cs index 21d785c..00e41fa 100644 --- a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base/MapsCollection.cs +++ b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base/MapsCollection.cs @@ -103,10 +103,10 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base using (FileStream fs = new(filename, FileMode.Create)) using (StreamWriter sw = new StreamWriter(fs)) { - sw.WriteLine($"MapsCollection{Environment.NewLine}"); + sw.WriteLine("MapsCollection"); foreach (var storage in _mapStorages) { - sw.WriteLine($"{storage.Key}{separatorDict}{storage.Value.GetData(separatorDict, separatorData)}{Environment.NewLine}"); + sw.WriteLine($"{storage.Key}{separatorDict}{storage.Value.GetData(separatorDict, separatorData)}"); } } return true; @@ -126,8 +126,10 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base { string str; int count = 0; + _mapStorages.Clear(); while ((str = sr.ReadLine()) != null) { + if (str == "") { break; } if (count == 0) { if (!str.Contains("MapsCollection")) @@ -139,7 +141,6 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base continue; } } - _mapStorages.Clear(); var elem = str.Split(separatorDict); AbstractMap map = null; switch (elem[1]) diff --git a/ok.txt b/ok.txt index 6f43650..35f65f9 100644 --- a/ok.txt +++ b/ok.txt @@ -1,2 +1,6 @@ MapsCollection -ok|SimpleMap|100:100:Blue;100:100:Yellow:Blue:False:True:True; + +ok|SimpleMap|100:100:Gray;100:100:Yellow:Purple:False:True:True;100:100:Black:White:True:False:False; + +ok1|MySecondMap|100:100:Blue:Green:False:True:False;100:100:Blue; +