This commit is contained in:
Калышев Ян 2022-11-07 10:29:23 +04:00
parent 53a65a328e
commit 5be7b09d73
3 changed files with 9 additions and 5 deletions

View File

@ -19,6 +19,5 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base
Weight = weight <= 0 ? rnd.Next(30, 100) : weight;
BodyColor = bodyColor;
}
}
}

View File

@ -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])

6
ok.txt
View File

@ -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;