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]); }
/// <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]; } }
public void ToStringInvalidFormat() { try { PageLine line = new PageLine(); Console.WriteLine(line.ToString("X")); } catch(FormatException ex) { Console.WriteLine(ex.Message); throw ex; } }
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]); }
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]); }
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(); }
/// <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); }
/// <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; }
/// <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]; }
public void SetLineOutOfRange() { Page page = new Page(); PageLine line = new PageLine(); page.SetLine(16, line); }
public ProtocolWritePageTx(byte header, Mode regim) : base(header, 0x55, regim, new CheckSumXOR7FManager()) { Line = new PageLine(); }
public ProtocolReadPageRx(byte header, Mode regim) : base(header, 0x5A, regim, new CheckSumXOR7FManager()) { Line = new PageLine(); }
public void IndexerOutOfRange() { PageLine line = new PageLine(); line[16] = 0x44; }