Ejemplo n.º 1
0
        /// <summary>
        /// Load configuration from a disk file.
        /// </summary>
        /// <remarks>If successfull the file name is remembered for <see cref="Save()"/>.</remarks>
        /// <param name="filePath">Full path to a disk file.</param>
        public void Load(string filePath)
        {
            // Create the file
            using (FileStream pOut = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                // Create a serializer
                XmlSerializer pSer = new XmlSerializer(GetType(), m_KnownTypes);

                // Store self
                DiSEqCConfiguration pNew = (DiSEqCConfiguration)pSer.Deserialize(pOut);

                // Copy over
                LNB0 = pNew.LNB0;
                LNB1 = pNew.LNB1;
                LNB2 = pNew.LNB2;
                LNB3 = pNew.LNB3;

                // Remember
                m_LoadedFrom = filePath;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Access a receiver by its index.
        /// </summary>
        public DiSEqC this[int lnbIndex]
        {
            get
            {
                // Easy
                switch (lnbIndex)
                {
                    case 0	: return LNB0;
                    case 1	: return LNB1;
                    case 2	: return LNB2;
                    case 3	: return LNB3;
                }

                // Not there
                throw new ArgumentOutOfRangeException("lnbIndex", lnbIndex, "There are only four settings available");
            }
            set
            {
                // Verify
                if ( null == value ) throw new ArgumentNullException("value");

                // Easy
                switch (lnbIndex)
                {
                    case 0	: LNB0 = value; return;
                    case 1	: LNB1 = value; return;
                    case 2	: LNB2 = value; return;
                    case 3	: LNB3 = value; return;
                }

                // Not there
                throw new ArgumentOutOfRangeException("lnbIndex", lnbIndex, "There are only four settings available");
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Allow easy iteration on the four configurable settings.
        /// </summary>
        /// <returns>Enumerator on an <see cref="Array"/> of the four configurable
        /// receiver settings.</returns>
        public IEnumerator GetEnumerator()
        {
            // Create helper array
            DiSEqC[] ret = new DiSEqC[] { LNB0, LNB1, LNB2, LNB3 };

            // Report
            return ret.GetEnumerator();
        }