Ejemplo n.º 1
0
        public static Pr1132Configuration Deserialize(Stream file)
        {
            if (!Validate(file))
            {
                return(null);
            }

            var cfg = new Pr1132Configuration();

            for (int i = 0; i < 16; i++)
            {
                var buf = new byte[32];
                file.Read(buf, 0, 32);
                cfg.Groups[i] = ParseGroup(buf);
            }

            for (int i = 0; i < 32; i++)
            {
                var buf = new byte[25];
                file.Read(buf, 0, 25);
                cfg.Channels[i] = ParseChannel(buf);
            }

            ParseTimeSettings(file.ReadByte(), ref cfg);

            for (int i = 0; i < 7; i++)
            {
                var buf = new byte[7];
                file.Read(buf, 0, 7);
                cfg.Timers[i] = ParseTimer(buf);
            }

            return(cfg);
        }
Ejemplo n.º 2
0
        private static void ParseTimeSettings(int buf, ref Pr1132Configuration cfg)
        {
            if (buf != -1)
            {
                var timeSettings = (byte)buf;

                cfg.TimeOffset     = (timeSettings & 63) - 11;
                cfg.UseDst         = (timeSettings & 64) > 0;
                cfg.AutoUpdateTime = (timeSettings & 128) > 0;
            }
        }