public void TestEncryptedMemoryTable()
        {
            dumpTable(outputTable);
            // read encrypted table back
            MemoryTable encryptedTable = new MemoryTable(EncryptedMemoryTableFile, true);

            encryptedTable.tableName = "Read Encrypted MemoryTable From " + EncryptedMemoryTableFile;
            encryptedTable.read();
            dumpTable(encryptedTable);
        }
        public void TestNonEncryptedMemoryTable()
        {
            outputTable.encrypted = false;
            outputTable.csvfile   = UETableFile;
            outputTable.tableName = UETableName;
            outputTable.write();

            MemoryTable readTable = new MemoryTable(UETableFile);

            readTable.read();
            dumpTable(readTable);
        }
        public void Initialize()
        {
            tstobj = new TestObject();
            tstobj.aDictionary.Add("Fourth", "Fourth String");
            outputTable           = new MemoryTable(EncryptedMemoryTableFile, true);
            outputTable.tableName = "Initial Encrypted Table: Written to: " + outputTable.csvfile;
            string[] hdr   = { "Product", "Description", "Quantity", "Cost", "Total" };
            string[] data1 = { "Honda", "Honda Civic", "2000", "200", "1000" };
            string[] data2 = { "Acura", "Acura Integra", "5000", "450", "8000" };

            string[] insertData = { "BMW", "Bonn Motor Works", "5000", "450", "8000" };
            outputTable.addRow(hdr);
            outputTable.addRow(data1);
            outputTable.addRow(data2);
            outputTable.updateRow("Honda", "Description", "Honda Accord");
            outputTable.updateRow(insertData);
            outputTable.write();
            Console.WriteLine("Output Table written to file: " + outputTable.csvfile);
        }
        public void dumpTable(MemoryTable testTable)
        {
            // dump table using TableRow.get(key) syntax
            List <string> headers = testTable.headers;

            Console.WriteLine(testTable.tableName + " has Number of Rows = " + testTable.NumRows);
            List <TableRow> allRows = testTable.getAllRows();
            int             rownum  = 0;

            foreach (TableRow row in allRows)
            {
                ++rownum;
                Console.Write("--> Row: " + rownum);
                foreach (string colname in headers)
                {
                    string keyval = row.getColValue(colname);
                    Console.Write(" :" + colname + "=" + keyval);
                }
                Console.WriteLine();
            }

            // iterate and display all entries in the memory table using array syntax
            Dictionary <string, List <string> > tableData = testTable.tableData;

            Console.WriteLine("Number of header columns=" + headers.Count);
            StringBuilder builder = new StringBuilder();

            builder.Append("Table Data for: " + testTable.csvfile + " ---> \n");
            foreach (var item in tableData)
            {
                var key = item.Key;
                builder.Append("Row Key: " + key);
                List <string> row    = item.Value;
                int           colnum = 0;
                foreach (var col in row)
                {
                    builder.Append(" : " + headers[colnum] + "=" + col);
                    ++colnum;
                }
                builder.Append("\n");
            }
            Console.WriteLine(builder.ToString());
        }