Пример #1
0
        /// <summary>
        /// Reads the next daytimerEntry of a binaryReader
        /// </summary>
        /// <param name="reader">The binaryReader that should be read of</param>
        /// <returns>The read daytimerEntry</returns>
        public static DaytimerEntry Parse(System.IO.BinaryReader reader)
        {
            DaytimerEntry entry = new DaytimerEntry();

            entry.Mode         = reader.ReadInt32();
            entry.From         = reader.ReadInt32();
            entry.To           = reader.ReadInt32();
            entry.NeedActivate = reader.ReadInt32();
            entry.Value        = reader.ReadDouble();
            return(entry);
        }
Пример #2
0
        /// <summary>
        /// Reads the next daytimerEntry of a binaryReader
        /// </summary>
        /// <param name="reader">The binaryReader that should be read of</param>
        /// <returns>The read daytimerEntry</returns>
        public static DaytimerEntry Parse(System.IO.BinaryReader reader)
        {
            DaytimerEntry entry = new DaytimerEntry {
                Mode         = reader.ReadInt32(),
                From         = reader.ReadInt32(),
                To           = reader.ReadInt32(),
                NeedActivate = reader.ReadInt32(),
                Value        = reader.ReadDouble()
            };

            return(entry);
        }
Пример #3
0
        /// <summary>
        /// Reads the next daytimerState of a binaryReader
        /// </summary>
        /// <param name="reader">The reader that should be read of</param>
        /// <returns>The read daytimerState</returns>
        public static DaytimerState Parse(BinaryReader reader)
        {
            DaytimerState state = new DaytimerState();

            state.SetUuid(Communicator.Uuid.ParseUuid(reader.ReadBytes(16)));
            state.DefaultValue = reader.ReadDouble();
            state.NrEntries    = reader.ReadInt32();
            state.Entries      = new List <DaytimerEntry>(state.NrEntries);
            for (int i = 0; i < state.NrEntries; i++)
            {
                BinaryReader entryReader = new BinaryReader(new MemoryStream(reader.ReadBytes(24)));
                state.Entries.Add(DaytimerEntry.Parse(entryReader));
            }
            return(state);
        }