Refactor using extensions
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using PlantBox.Shared.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
@@ -26,9 +27,9 @@ namespace PlantBox.Shared.Communication.Commands
|
||||
}
|
||||
|
||||
Name = arguments[0];
|
||||
Type = (PlantType)Enum.Parse(typeof(PlantType), arguments[1], true);
|
||||
State = (PlantState)Enum.Parse(typeof(PlantState), arguments[2], true);
|
||||
Water = double.Parse(arguments[3], CultureInfo.InvariantCulture);
|
||||
Type = arguments[1].ToEnumValue<PlantType>();
|
||||
State = arguments[2].ToEnumValue<PlantState>();
|
||||
Water = arguments[3].ToDouble();
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -40,7 +41,7 @@ namespace PlantBox.Shared.Communication.Commands
|
||||
Name,
|
||||
Type.ToString(),
|
||||
State.ToString(),
|
||||
Water.ToString(CultureInfo.InvariantCulture)
|
||||
Water.ToArgument()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user