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