public static void ToBytes(CorrectionFactors factors, byte[] bytes, int offset) { bytes[offset] = factors.windDirectionOffset; ToBytes(factors.tempOffset, bytes, offset + 1); ToBytes(factors.pressureFactorF, bytes, offset + 5); ToBytes(factors.pressureFactorG, bytes, offset + 9); ToBytes(factors.pressureFactorH, bytes, offset + 13); ToBytes(factors.speedFactorX, bytes, offset + 17); ToBytes(factors.speedFactorY, bytes, offset + 21); ToBytes(factors.humidityOffset, bytes, offset + 25); ToBytes(factors.speedCalibrationA, bytes, offset + 29); ToBytes(factors.speedCalibrationB, bytes, offset + 33); ToBytes(factors.speedCalibrationC, bytes, offset + 37); ToBytes(factors.speedCalibrationD, bytes, offset + 41); ToBytes(factors.speedCalibrationOffset, bytes, offset + 45); }
public static CorrectionFactors FromString(string value, char[] delim) { string[] split = value.Split(delim ?? DefaultDelim).Select(s => s.Trim()).ToArray(); var factors = new CorrectionFactors(); factors.windDirectionOffset = Byte.Parse(split[0]); factors.tempOffset = Double.Parse(split[1]); factors.pressureFactorF = Double.Parse(split[2]); factors.pressureFactorG = Double.Parse(split[3]); factors.pressureFactorH = Double.Parse(split[4]); factors.speedFactorX = Double.Parse(split[5]); factors.speedFactorY = Double.Parse(split[6]); factors.humidityOffset = Double.Parse(split[7]); factors.speedCalibrationA = Double.Parse(split[8]); factors.speedCalibrationB = Double.Parse(split[9]); factors.speedCalibrationC = Double.Parse(split[10]); factors.speedCalibrationD = Double.Parse(split[11]); factors.speedCalibrationOffset = Double.Parse(split[12]); return factors; }
public static CorrectionFactors ToCorrectionFactors(byte[] bytes, int offset) { var factors = new CorrectionFactors(); factors.windDirectionOffset = bytes[offset]; factors.tempOffset = ToDouble(bytes, offset + 1); factors.pressureFactorF = ToDouble(bytes, offset + 5); factors.pressureFactorG = ToDouble(bytes, offset + 9); factors.pressureFactorH = ToDouble(bytes, offset + 13); factors.speedFactorX = ToDouble(bytes, offset + 17); factors.speedFactorY = ToDouble(bytes, offset + 21); factors.humidityOffset = ToDouble(bytes, offset + 25); factors.speedCalibrationA = ToDouble(bytes, offset + 29); factors.speedCalibrationB = ToDouble(bytes, offset + 33); factors.speedCalibrationC = ToDouble(bytes, offset + 37); factors.speedCalibrationD = ToDouble(bytes, offset + 41); factors.speedCalibrationOffset = ToDouble(bytes, offset + 45); return(factors); }
public static CorrectionFactors FromString(string value, char[] delim) { string[] split = value.Split(delim ?? DefaultDelim).Select(s => s.Trim()).ToArray(); var factors = new CorrectionFactors(); factors.windDirectionOffset = Byte.Parse(split[0]); factors.tempOffset = Double.Parse(split[1]); factors.pressureFactorF = Double.Parse(split[2]); factors.pressureFactorG = Double.Parse(split[3]); factors.pressureFactorH = Double.Parse(split[4]); factors.speedFactorX = Double.Parse(split[5]); factors.speedFactorY = Double.Parse(split[6]); factors.humidityOffset = Double.Parse(split[7]); factors.speedCalibrationA = Double.Parse(split[8]); factors.speedCalibrationB = Double.Parse(split[9]); factors.speedCalibrationC = Double.Parse(split[10]); factors.speedCalibrationD = Double.Parse(split[11]); factors.speedCalibrationOffset = Double.Parse(split[12]); return(factors); }
public static CorrectionFactors ToCorrectionFactors(byte[] bytes, int offset) { var factors = new CorrectionFactors(); factors.windDirectionOffset = bytes[offset]; factors.tempOffset = ToDouble(bytes, offset + 1); factors.pressureFactorF = ToDouble(bytes, offset + 5); factors.pressureFactorG = ToDouble(bytes, offset + 9); factors.pressureFactorH = ToDouble(bytes, offset + 13); factors.speedFactorX = ToDouble(bytes, offset + 17); factors.speedFactorY = ToDouble(bytes, offset + 21); factors.humidityOffset = ToDouble(bytes, offset + 25); factors.speedCalibrationA = ToDouble(bytes, offset + 29); factors.speedCalibrationB = ToDouble(bytes, offset + 33); factors.speedCalibrationC = ToDouble(bytes, offset + 37); factors.speedCalibrationD = ToDouble(bytes, offset + 41); factors.speedCalibrationOffset = ToDouble(bytes, offset + 45); return factors; }