Exemple #1
0
        public void TestPJX()
        {
            var dbf    = new Dbf(Path.Combine(testDir, "testproj.PJX"), Path.Combine(testDir, "testproj.PJT"));
            var reader = new DbfReader(dbf);

            var rows    = reader.ReadRows(includeMemo: true);
            var project = Project.FromRows(rows);
        }
Exemple #2
0
 public void ReadNullTbl_Large()
 {
     var dbf    = new Dbf(Path.Combine(testDir, "_largenullable.dbf"));
     var reader = new DbfReader(dbf);
     var header = dbf.GetHeader();
     var row2   = reader.ReadRow(0);
     var rows   = reader.ReadRows().ToList();
 }
Exemple #3
0
        public void TestDBC()
        {
            var dbf    = new Dbf(Path.Combine(testDir, "largedb.dbc"), Path.Combine(testDir, "largedb.dct"));
            var reader = new DbfReader(dbf);
            var rows   = reader.ReadRows(includeMemo: true);
            var db     = Database.FromDbf(dbf);

            //Assert.Equal(6, reader.ReadRow(1)[1].ToString().Length);
            //Assert.Equal(254, reader.ReadRow(0)[1].ToString().Length);
            Assert.Equal(254, reader.ReadRow(2)[1].ToString().Length);
        }
Exemple #4
0
        public void ReadDbfRows()
        {
            var dbf    = new Dbf(Path.Combine(testDir, "poshistorie.dbf"));
            var reader = new DbfReader(dbf);
            int count  = 0;

            foreach (var r in reader.ReadRows((i, x) => true, includeMemo: false, includeDeleted: true))
            {
                count++;
                //if (count > 50) break;
            }
            output.WriteLine("Count: {0} ({1})", count, dbf.GetHeader().RecordCount);
            Assert.Equal(dbf.GetHeader().RecordCount, count);
        }
Exemple #5
0
        public static Database FromDbf(Dbf dbf)
        {
            var header = dbf.GetHeader();

            if ((header.Flags & DbfHeaderFlags.DBC) == 0)
            {
                throw new InvalidCastException("Not a Database(DBC)");
            }
            var reader = new DbfReader(dbf);
            var rows   = reader.ReadRows(includeMemo: true);
            var db     = ParseDatabaseFromRows(rows);

            return(db);
        }
Exemple #6
0
        public void Test1()
        {
            var dbf = new Dbf(Path.Combine(testDir, "dbTable2.dbf"));
            //var dbf = new Dbf(Path.Combine(@"C:\vfp projects\WindowsShell", "varchr.dbf"));
            var reader = new DbfReader(dbf);

            var row    = reader.ReadRow(0);
            var header = dbf.GetHeader();

            OutputHelper.MarkdownTable(header.Fields, reader.ReadRows(), h => h, output.WriteLine);

            var row2 = reader.ReadRow(1);
            var row3 = reader.ReadRow(2);

            //var rows = reader.ReadRows(includeMemo: true).ToList();

            //Assert.Equal(6, reader.ReadRow(1)[1].ToString().Length);
            //Assert.Equal(254, reader.ReadRow(0)[1].ToString().Length);
            //Assert.Equal(254, reader.ReadRow(2)[1].ToString().Length);
        }