示例#1
0
        public void Indexer()
        {
            PageLine line = new PageLine();

            line[0] = 0x44;
            line[15] = 0x66;

            Assert.AreEqual<byte>(0x44, line[0]);
            Assert.AreEqual<byte>(0x66, line[15]);
            Assert.AreEqual<byte>(0x00, line[1]);
        }
示例#2
0
        /// <summary>
        /// Set page line
        /// </summary>
        /// <param name="lineNumber">Line number</param>
        /// <param name="line">Line</param>
        public void SetLine(int lineNumber, PageLine line)
        {
            if (lineNumber < 0 || lineNumber >= NumberOfLines)
            {
                throw new IndexOutOfRangeException("lineNumber");
            }

            for (int i = 0; i < PageLine.Size; i++)
            {
                cells[lineNumber * PageLine.Size + i] = line[i];
            }
        }
示例#3
0
 public void ToStringInvalidFormat()
 {
     try
     {
         PageLine line = new PageLine();
         Console.WriteLine(line.ToString("X"));
     }
     catch(FormatException ex)
     {
         Console.WriteLine(ex.Message);
         throw ex;
     }
 }
示例#4
0
        public void ToByteArray()
        {
            PageLine line = new PageLine();

            line[0] = 0x44;
            line[15] = 0x66;

            byte[] array = line;

            Assert.AreEqual(PageLine.Size, array.Length);
            Assert.AreEqual<byte>(0x44, array[0]);
            Assert.AreEqual<byte>(0, array[1]);
            Assert.AreEqual<byte>(0x66, array[15]);
        }
示例#5
0
        public void SetLine()
        {
            Page page = new Page();
            PageLine line = new PageLine();
            line[0] = 0x22;
            line[15] = 0xAA;

            page.SetLine(0, line);
            page.SetLine(15, line);

            Assert.AreEqual<byte>(0x22, page[0]);
            Assert.AreEqual<byte>(0xAA, page[15]);
            Assert.AreEqual<byte>(0x22, page[240]);
            Assert.AreEqual<byte>(0xAA, page[255]);
        }
示例#6
0
        public void ToFormattedString()
        {
            PageLine line = new PageLine();

            for (int i = 0; i < PageLine.Size; i++)
                line[i] = (byte)(0x30 + i);

            Console.WriteLine(line.ToString());
            Console.WriteLine();
            Console.WriteLine(line.ToString("G"));
            Console.WriteLine();
            Console.WriteLine(line.ToString("H"));
            Console.WriteLine();
            Console.WriteLine(line.ToString("C"));
            Console.WriteLine();
        }
示例#7
0
        /// <summary>
        /// Get page line
        /// </summary>
        /// <param name="lineNumber">Line number</param>
        /// <returns>Line</returns>
        public PageLine GetLine(int lineNumber)
        {
            if (lineNumber < 0 || lineNumber >= NumberOfLines)
            {
                throw new IndexOutOfRangeException("lineNumber");
            }

            PageLine line = new PageLine();

            for (int i = 0; i < PageLine.Size; i++)
            {
                line[i] = cells[lineNumber * PageLine.Size + i];
            }

            return(line);
        }
示例#8
0
        /// <summary>
        /// Get page line
        /// </summary>
        /// <param name="lineNumber">Line number</param>
        /// <returns>Line</returns>
        public PageLine GetLine(int lineNumber)
        {
            if (lineNumber < 0 || lineNumber >= NumberOfLines)
                throw new IndexOutOfRangeException("lineNumber");

            PageLine line = new PageLine();

            for (int i = 0; i < PageLine.Size; i++)
                line[i] = cells[lineNumber * PageLine.Size + i];

            return line;
        }
示例#9
0
        /// <summary>
        /// Set page line
        /// </summary>
        /// <param name="lineNumber">Line number</param>
        /// <param name="line">Line</param>
        public void SetLine(int lineNumber, PageLine line)
        {
            if (lineNumber < 0 || lineNumber >= NumberOfLines)
                throw new IndexOutOfRangeException("lineNumber");

            for (int i = 0; i < PageLine.Size; i++)
                cells[lineNumber * PageLine.Size + i] = line[i];
        }
示例#10
0
 public void SetLineOutOfRange()
 {
     Page page = new Page();
     PageLine line = new PageLine();
     page.SetLine(16, line);
 }
示例#11
0
 public ProtocolWritePageTx(byte header, Mode regim)
     : base(header, 0x55, regim, new CheckSumXOR7FManager())
 {
     Line = new PageLine();
 }
示例#12
0
 public ProtocolReadPageRx(byte header, Mode regim)
     : base(header, 0x5A, regim, new CheckSumXOR7FManager())
 {
     Line = new PageLine();
 }
示例#13
0
 public void IndexerOutOfRange()
 {
     PageLine line = new PageLine();
     line[16] = 0x44;
 }