public override void UpdateFromString(string updateString)
{
if (IsValidUpdateString(updateString))
{
if (Motor.GetLocationFromUpdateString(updateString) == LocationOnRover)
{
// We dont want to include the identifier nor the last bracket
var updateArray = GetUpdateStringArrayWithoutIdentifier(updateString);
this.Current = float.Parse(updateArray[2]);
this.Temperature = float.Parse(updateArray[3]);
}
else
{
throw new InvalidUpdateStringException(updateString, "The motor location does not match the one indicated by the update string.");
}
}
else
{
throw new InvalidUpdateStringException(updateString);
}
}