Ejemplo n.º 1
0
 public void BadFileName()
 {
     tableReader = new TableReader(TableReaderType.ReadTypeDump);
     var result = tableReader.OpenTable(string.Empty);
     Assert.Equal(false, result);
     Assert.NotEmpty(tableReader.TableErrors);
 }
Ejemplo n.º 2
0
        public void ValueTableDumpInsertEntriesMatch()
        {
            string tableName = "test.tbl";

            using (StreamWriter writer = new StreamWriter(tableName))
            {
                writer.WriteLine("ff=test");
            }

            TableReader insertReader = new TableReader(TableReaderType.ReadTypeInsert);
            insertReader.OpenTable(tableName);
            TableReader dumpReader = new TableReader(TableReaderType.ReadTypeDump);
            dumpReader.OpenTable(tableName);
            Assert.Equal("test", dumpReader.LookupValue[insertReader.LookupValue["test"]]);
            Assert.Equal("FF", insertReader.LookupValue[dumpReader.LookupValue["FF"]]);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Gets the decoded strings.
 /// </summary>
 /// <param name="tableName">The name of the table.</param>
 /// <param name="hexBlock">The Hex block to decode</param>
 /// <param name="endString">Signified the end of a string.</param>
 /// <returns>The decoded strings in an IEnumerable.</returns>
 public IEnumerable <string> GetDecodedStrings(string tableName, byte[] hexBlock, string endString)
 {
     Table.OpenTable(tableName);
     SetHexBlock(hexBlock);
     return(GetDecodedStrings(endString));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Opens the table.
 /// </summary>
 /// <param name="tableFileName">The table file name.</param>
 /// <param name="encoding">The specified character encoding.</param>
 /// <returns><c>true</c>, if table was opened successfully, <c>false</c> otherwise.</returns>
 public bool OpenTable(string tableFileName, Encoding encoding)
 {
     return(Table.OpenTable(tableFileName, encoding));
 }
Ejemplo n.º 5
0
 public void EntriesHaveCorrectEncoding()
 {
     var reader = new TableReader(TableReaderType.ReadTypeDump);
     reader.OpenTable("../../table.shift-jis", "shift-jis");
     Assert.Equal(true, reader.LookupValue.ContainsValue("あ"));
 }
Ejemplo n.º 6
0
 private bool readTableFile(string entry, TableReader reader)
 {
     string tableName = "test.tbl";
     using (StreamWriter writer = new StreamWriter(tableName))
     {
         writer.WriteLine(entry);
     }
     return reader.OpenTable(tableName);
 }