internal override void SetSpecialVehicleParameter(string i_ParameterName, string i_ParameterValue) { if (i_ParameterName.Equals(m_MotorcycleSpecialParameterNames[0])) { m_EngineVolume = int.Parse(i_ParameterValue); } if (i_ParameterName.Equals(m_MotorcycleSpecialParameterNames[1])) { m_LicenseType = (eMotorcycleLicenseTypes)Enum.Parse(typeof(eMotorcycleLicenseTypes), i_ParameterValue.ToUpper()); } }
public static void UpdateMotorcycle(ref Vehicle i_Vehicle, string i_LicenseType, string i_EngineCapacity) { ParserValidator("float", "Engine capacity needs to be a number.", i_EngineCapacity); eMotorcycleLicenseTypes motorcycleLicenseType = (eMotorcycleLicenseTypes)Enum.Parse(typeof(eMotorcycleLicenseTypes), i_LicenseType); int engineCapacity = int.Parse(i_EngineCapacity); if (engineCapacity < 0) { throw new ValueOutOfRangeException("Engine capacity can't be negative."); } ((Motorcycle)i_Vehicle).LicenseType = motorcycleLicenseType; ((Motorcycle)i_Vehicle).EngineCapacity = engineCapacity; }