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.Linq;
|
||||
@@ -36,16 +37,21 @@ namespace PlantBox.Shared.Communication.Commands
|
||||
throw new ArgumentException($"Excepted 3 arguments, got {arguments.Length}");
|
||||
}
|
||||
|
||||
Humidity = double.Parse(arguments[0], CultureInfo.InvariantCulture);
|
||||
Luminosity = double.Parse(arguments[1], CultureInfo.InvariantCulture);
|
||||
Temperature = double.Parse(arguments[2], CultureInfo.InvariantCulture);
|
||||
Humidity = arguments[0].ToDouble();
|
||||
Luminosity = arguments[1].ToDouble();
|
||||
Temperature = arguments[2].ToDouble();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override string[] Serialize()
|
||||
{
|
||||
return new[] { Humidity, Luminosity, Temperature }.Select(x => x.ToString(CultureInfo.InvariantCulture)).ToArray();
|
||||
return new[]
|
||||
{
|
||||
Humidity.ToArgument(),
|
||||
Luminosity.ToArgument(),
|
||||
Temperature.ToArgument()
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user