/// <summary>
        /// FileVersion.Current - need 42 bytes
        /// </summary>
        /// <param name="bytes"></param>
        /// <param name="offset"></param>
        /// <param name="version"></param>
        public SchedulePoint(byte[] bytes, int offset = 0,
                             FileVersion version      = FileVersion.Current)
            : base(bytes, offset, version)
        {
            offset += BasePoint.GetSize(FileVersion);
            switch (FileVersion)
            {
            case FileVersion.Current:
                Control          = (OffOn)bytes.ToByte(ref offset);
                AutoManual       = (AutoManual)bytes.ToByte(ref offset);
                Override1Control = (OffOn)bytes.ToByte(ref offset);
                Override2Control = (OffOn)bytes.ToByte(ref offset);
                Off    = bytes.ToByte(ref offset);
                Unused = bytes.ToByte(ref offset);
                var T3000PointSize = T3000Point.GetSize(FileVersion);
                Override1Point = new T3000Point(bytes.ToBytes(ref offset, T3000PointSize), 0, FileVersion);
                Override2Point = new T3000Point(bytes.ToBytes(ref offset, T3000PointSize), 0, FileVersion);
                break;

            default:
                throw new FileVersionNotImplementedException(FileVersion);
            }

            CheckOffset(offset, GetSize(FileVersion));
        }
        public new static int GetSize(FileVersion version = FileVersion.Current)
        {
            var size = BasePoint.GetSize(version);

            switch (version)
            {
            case FileVersion.Current:
                return(size + 16);      //add 16

            default:
                throw new FileVersionNotImplementedException(version);
            }
        }
Example #3
0
        /// <summary>
        /// FileVersion.Current - Need 39 bytes
        /// FileVersion.Dos - Need 36 bytes
        /// </summary>
        /// <param name="bytes"></param>
        /// <param name="offset"></param>
        /// <param name="version"></param>
        public VariablePoint(byte[] bytes, int offset = 0,
                             FileVersion version      = FileVersion.Current)
            : base(bytes, offset, version)
        {
            offset += BasePoint.GetSize(FileVersion);

            int  valueRaw;
            Unit unit;

            switch (FileVersion)
            {
            case FileVersion.Dos:
                valueRaw      = bytes.ToInt32(ref offset);
                AutoManual    = (AutoManual)bytes.GetBit(0, ref offset).ToByte();
                DigitalAnalog = (DigitalAnalog)bytes.GetBit(1, ref offset).ToByte();
                Control       = (OffOn)bytes.GetBit(2, ref offset).ToByte();
                offset       += 1;//after GetBit
                unit          = (Unit)bytes.ToByte(ref offset);
                break;

            case FileVersion.Current:
                valueRaw      = bytes.ToInt32(ref offset);
                AutoManual    = (AutoManual)bytes.ToByte(ref offset);
                DigitalAnalog = (DigitalAnalog)bytes.ToByte(ref offset);
                Control       = (OffOn)bytes.ToByte(ref offset);
                offset       += 1;//this byte is unused
                unit          = UnitsFromByte(bytes.ToByte(ref offset), DigitalAnalog);
                break;

            default:
                throw new FileVersionNotImplementedException(FileVersion);
            }

            Value = new VariableValue(valueRaw, unit);

            //TODO: Fix for digital values
            if (unit == Unit.OffOn)
            {
                Value.MaxRange = 1000;
            }
            else if (unit == Unit.CustomDigital1)
            {
                Value.MaxRange = 2000;
            }

            CheckOffset(offset, GetSize(FileVersion));
        }
Example #4
0
        /// <summary>
        /// FileVersion.Current - need 33 bytes
        /// </summary>
        /// <param name="bytes"></param>
        /// <param name="offset"></param>
        /// <param name="version"></param>
        public HolidayPoint(byte[] bytes, int offset = 0,
                            FileVersion version      = FileVersion.Current)
            : base(bytes, offset, version)
        {
            offset += BasePoint.GetSize(FileVersion);

            switch (FileVersion)
            {
            case FileVersion.Current:
                Control    = (OffOn)bytes.ToByte(ref offset);
                AutoManual = (AutoManual)bytes.ToByte(ref offset);
                Unused     = bytes.ToByte(ref offset);
                break;

            default:
                throw new FileVersionNotImplementedException(FileVersion);
            }

            CheckOffset(offset, GetSize(FileVersion));
        }
        /// <summary>
        /// FileVersion.Current - Need 46 bytes
        /// </summary>
        /// <param name="bytes"></param>
        /// <param name="offset"></param>
        /// <param name="version"></param>
        public ScreenPoint(byte[] bytes, int offset = 0,
                           FileVersion version      = FileVersion.Current)
            : base(bytes, offset, version)
        {
            offset += BasePoint.GetSize(FileVersion);

            switch (FileVersion)
            {
            case FileVersion.Current:
                PictureFile = bytes.GetString(ref offset, 11).ClearBinarySymvols();
                RefreshTime = bytes.ToByte(ref offset);
                GraphicMode = (TextGraphic)bytes.ToByte(ref offset);
                X           = bytes.ToByte(ref offset);
                Y           = bytes.ToUInt16(ref offset);
                break;

            default:
                throw new FileVersionNotImplementedException(FileVersion);
            }

            CheckOffset(offset, GetSize(FileVersion));
        }
        /// <summary>
        /// FileVersion.Current - Need 37 bytes
        /// </summary>
        /// <param name="bytes"></param>
        /// <param name="offset"></param>
        /// <param name="version"></param>
        public ProgramPoint(byte[] bytes, int offset = 0,
                            FileVersion version      = FileVersion.Current)
            : base(bytes, offset, version)
        {
            offset += BasePoint.GetSize(FileVersion);

            switch (FileVersion)
            {
            case FileVersion.Current:
                Length     = bytes.ToUInt16(ref offset);
                Control    = (OffOn)bytes.ToByte(ref offset);
                AutoManual = (AutoManual)bytes.ToByte(ref offset);
                NormalCom  = (NormalCom)bytes.ToByte(ref offset);
                ErrorCode  = bytes.ToByte(ref offset);
                Unused     = bytes.ToByte(ref offset);
                break;

            default:
                throw new FileVersionNotImplementedException(FileVersion);
            }

            CheckOffset(offset, GetSize(FileVersion));
        }