예제 #1
0
        public static PR1132Configuration Deserialize(Stream file)
        {
            file.Seek(6, SeekOrigin.Begin);

            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);
        }
예제 #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;
            }
        }