6 лаба - В С Ё !
This commit is contained in:
parent
cd50b5bf7a
commit
cf00e1bcc2
@ -15,8 +15,7 @@ namespace ProjectAirplaneWithRadar
|
|||||||
string[] strs = info.Split(separatorForObject);
|
string[] strs = info.Split(separatorForObject);
|
||||||
if (strs.Length == 3)
|
if (strs.Length == 3)
|
||||||
{
|
{
|
||||||
return new DrawningAirplane(Convert.ToInt32(strs[0]),
|
return new DrawningAirplane(Convert.ToInt32(strs[0]), Convert.ToInt32(strs[1]), Color.FromName(strs[2]), width, height);
|
||||||
Convert.ToInt32(strs[1]), Color.FromName(strs[2]), width, height);
|
|
||||||
}
|
}
|
||||||
if (strs.Length == 6)
|
if (strs.Length == 6)
|
||||||
{
|
{
|
||||||
@ -25,21 +24,19 @@ namespace ProjectAirplaneWithRadar
|
|||||||
Color.FromName(strs[2]),
|
Color.FromName(strs[2]),
|
||||||
Color.FromName(strs[3]),
|
Color.FromName(strs[3]),
|
||||||
Convert.ToBoolean(strs[4]),
|
Convert.ToBoolean(strs[4]),
|
||||||
Convert.ToBoolean(strs[6]), width, height);
|
Convert.ToBoolean(strs[5]), width, height);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public static string GetDataForSave(this DrawningAirplane drawningAirplane,
|
public static string GetDataForSave(this DrawningAirplane drawningAirplane,char separatorForObject)
|
||||||
char separatorForObject)
|
|
||||||
{
|
{
|
||||||
var car = drawningAirplane.EntityAirplane;
|
var airplane = drawningAirplane.EntityAirplane;
|
||||||
if (car == null)
|
if (airplane == null)
|
||||||
{
|
{
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
var str =
|
var str = $"{airplane.Speed}{separatorForObject}{airplane.Weight}{separatorForObject}{airplane.BodyColor.Name}";
|
||||||
$"{car.Speed}{separatorForObject}{car.Weight}{separatorForObject}{car.BodyColor.Name}";
|
if (airplane is not EntityAirplaneWithRadar airplaneWithRadar)
|
||||||
if (car is not EntityAirplaneWithRadar airplaneWithRadar)
|
|
||||||
{
|
{
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user