Ejemplo n.º 1
0
    //////////////////////////////////////////////////////////////////////////////

    static void ReadMovies(MoviesDB moviesDB, string path, bool printSep, int width)
    {
        byte[] content = File.ReadAllBytes(path + "/movies.csv");

        long msecs1 = Environment.TickCount;

        string[] empty = new string[0];

        CsvReader reader = new CsvReader(content);

        reader.SkipLine();
        while (!reader.Eof())
        {
            int id = (int)reader.ReadLong();
            reader.Skip(';');
            string name = reader.ReadString();
            reader.Skip(';');
            int year = (int)reader.ReadLong();
            reader.Skip(';');
            double rank = reader.ReadDouble();
            reader.SkipLine();

            moviesDB.AddMovie(id, name, year, rank, empty);
        }

        long msecs2 = Environment.TickCount;

        PrintTime(msecs2 - msecs1, printSep, width);
    }