Skip to content

Commit

Permalink
better output
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwhitney committed Sep 14, 2014
1 parent 01925d4 commit 3d66f5f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions RssFeedToSql/DirectoryIndexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ public void IndexAllDirectoriesUnder(string rootDirectory)
{
using (var writer = new StreamWriter("import.sql", false))
{
foreach (var directory in Directory.GetDirectories(rootDirectory))
var dirs = Directory.GetDirectories(rootDirectory);
Console.WriteLine(dirs.Length + " publications found.");

foreach (var directory in dirs)
{
IndexSingleDirectory(directory, writer);
}
Expand All @@ -53,11 +56,13 @@ public void IndexSingleDirectory(string rootDirectory, TextWriter openStream)

var files = Directory.GetFiles(rootDirectory);

foreach (var file in files)
Console.WriteLine(files.Length + " files found.");
for (int index = 0; index < files.Length; index++)
{
var file = files[index];
_currentArticleId = _currentArticleId + 1;
var text = File.ReadAllText(file, Encoding.Unicode);

var entry = _parser.Parse(text);

entry.Writer.Id = _writers.CreateOrRetrieveId(entry.Writer);
Expand All @@ -67,7 +72,7 @@ public void IndexSingleDirectory(string rootDirectory, TextWriter openStream)
var entrySql = _sqlGen.GenerateSqlFor(entry);
openStream.WriteLine(entrySql);

Console.Write(".");
Console.Write(index + 1 + " ");
}
}

Expand Down

0 comments on commit 3d66f5f

Please sign in to comment.