Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TableLib.TableReader"/> class.
        /// </summary>
        /// <param name="type">Indicates whether values are being inserted or dumped.</param>
		public TableReader (TableReaderType type)
		{
			LongestHex = 1;
			LongestText = new int[1024];
			LongestText['<'] = 6;
			ReaderType = type;
			TableErrors = new List<TableError>();
			LinkedEntries = new SortedList <string, LinkedEntry>();
			EndTokens = new List<string>();
            LookupValue = new SortedList<string, string>();

            if (ReaderType == TableReaderType.ReadTypeInsert)
            {
                InitHexTable();
            }
		}
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TableLib.TableReader"/> class.
        /// </summary>
        /// <param name="type">Indicates whether values are being inserted or dumped.</param>
        public TableReader(TableReaderType type)
        {
            LongestHex       = 1;
            LongestText      = new int[1024];
            LongestText['<'] = 6;
            ReaderType       = type;
            TableErrors      = new List <TableError>();
            LinkedEntries    = new SortedList <string, LinkedEntry>();
            EndTokens        = new List <string>();
            LookupValue      = new SortedList <string, string>();

            if (ReaderType == TableReaderType.ReadTypeInsert)
            {
                InitHexTable();
            }
        }
Esempio n. 3
0
        public void EntriesReadCorrectly(string entry, string key, string expectedResult,
                                         bool expectedOutcome, TableReaderType mode)
        {
            TableReader tableReader = new TableReader(mode);
            bool        result      = readTableFile(entry, tableReader);

            Assert.Equal(expectedOutcome, result);
            if (expectedOutcome)
            {
                Assert.Equal(expectedResult, tableReader.LookupValue[key]);
            }
            else
            {
                Assert.NotEmpty(tableReader.TableErrors);
            }
        }
Esempio n. 4
0
        public void EntriesReadCorrectly(string entry, string key, string expectedResult,
            bool expectedOutcome, TableReaderType mode)
        {
            TableReader tableReader = new TableReader(mode);
            bool result = readTableFile(entry, tableReader);

            Assert.Equal(expectedOutcome, result);
            if (expectedOutcome)
            {
                Assert.Equal(expectedResult, tableReader.LookupValue[key]);
            }
            else
            {
                Assert.NotEmpty(tableReader.TableErrors);
            }

        }
Esempio n. 5
0
        public void LinkEntriesReadCorrectly(string entry, string key, string expectedEntry,
            int expectedNumber, bool expectedOutcome, TableReaderType mode)
        {
            TableReader tableReader = new TableReader(mode);
            bool result = readTableFile(entry, tableReader);

            Assert.Equal(expectedOutcome, result);
            if (expectedOutcome)
            {
                Assert.Equal(expectedEntry, tableReader.LinkedEntries[key].Text);
                Assert.Equal(expectedNumber, tableReader.LinkedEntries[key].Number);
            }
            else
            {
                Assert.NotEmpty(tableReader.TableErrors);
            }
        }
Esempio n. 6
0
        public void LinkEntriesReadCorrectly(string entry, string key, string expectedEntry,
                                             int expectedNumber, bool expectedOutcome, TableReaderType mode)
        {
            TableReader tableReader = new TableReader(mode);
            bool        result      = readTableFile(entry, tableReader);

            Assert.Equal(expectedOutcome, result);
            if (expectedOutcome)
            {
                Assert.Equal(expectedEntry, tableReader.LinkedEntries[key].Text);
                Assert.Equal(expectedNumber, tableReader.LinkedEntries[key].Number);
            }
            else
            {
                Assert.NotEmpty(tableReader.TableErrors);
            }
        }