/// <summary> /// Reads the next weatherState of a binaryReader /// </summary> /// <param name="reader">The reader that should be read of</param> /// <returns>The read weatherState</returns> public static WeatherState Parse(BinaryReader reader) { WeatherState state = new WeatherState(); state.SetUuid(Communicator.Uuid.ParseUuid(reader.ReadBytes(16))); state.LastUpdate = reader.ReadUInt32(); state.NrEntries = reader.ReadInt32(); state.Entries = new List <WeatherEntry>(state.NrEntries); for (int i = 0; i < state.NrEntries; i++) { BinaryReader entryReader = new BinaryReader(new MemoryStream(reader.ReadBytes(24))); state.Entries.Add(WeatherEntry.Parse(entryReader)); } return(state); }
/// <summary> /// Reads the next weatherEntry of a binaryReader /// </summary> /// <param name="reader">The reader that should be read of</param> /// <returns>The read weatherEntry</returns> public static WeatherEntry Parse(System.IO.BinaryReader reader) { WeatherEntry entry = new WeatherEntry() { TimeStamp = reader.ReadInt32(), WeatherType = reader.ReadInt32(), WindDirection = reader.ReadInt32(), SolarRadiation = reader.ReadInt32(), RelativeHumidity = reader.ReadInt32(), Temperature = reader.ReadDouble(), PerceivedTemperature = reader.ReadDouble(), DewPoint = reader.ReadDouble(), Precipitation = reader.ReadDouble(), WindSpeed = reader.ReadDouble(), BarometricPressure = reader.ReadDouble() }; return(entry); }