Добавление метода в класс-коллекцию
This commit is contained in:
parent
db78391b7f
commit
127a678e28
@ -24,17 +24,17 @@ namespace ProjectElectricLocomotive.DrawingObjects
|
||||
if (strs.Length == 3)
|
||||
{
|
||||
return new DrawingLocomotive(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 == 7)
|
||||
if (strs.Length == 6)
|
||||
{
|
||||
return new DrawningSportCar(Convert.ToInt32(strs[0]),
|
||||
return new DrawingElectricLocomotive(Convert.ToInt32(strs[0]),
|
||||
Convert.ToInt32(strs[1]),
|
||||
Color.FromName(strs[2]),
|
||||
Color.FromName(strs[3]),
|
||||
Convert.ToBoolean(strs[4]),
|
||||
Convert.ToBoolean(strs[5]),
|
||||
Convert.ToBoolean(strs[6]), width, height);
|
||||
Convert.ToBoolean(strs[5]), width, height);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -44,8 +44,7 @@ namespace ProjectElectricLocomotive.DrawingObjects
|
||||
/// <param name="drawningCar">Сохраняемый объект</param>
|
||||
/// <param name="separatorForObject">Разделитель даннных</param>
|
||||
/// <returns>Строка с данными по объекту</returns>
|
||||
public static string GetDataForSave(this DrawingLocomotive drawningCar,
|
||||
char separatorForObject)
|
||||
public static string GetDataForSave(this DrawingLocomotive drawningCar, char separatorForObject)
|
||||
{
|
||||
var loco = drawningCar.EntityLocomotive;
|
||||
if (loco == null)
|
||||
@ -61,6 +60,5 @@ namespace ProjectElectricLocomotive.DrawingObjects
|
||||
return
|
||||
$"{str}{separatorForObject}{electricLocomotive.AdditionalColor.Name}{separatorForObject}{electricLocomotive.Pantograph}{separatorForObject}{electricLocomotive.Compartment}";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -87,5 +87,9 @@ namespace ProjectElectricLocomotive.Generics
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение объектов коллекции
|
||||
/// </summary>
|
||||
public IEnumerable<T?> GetLocomotives => _collection.GetLocomotives();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user