File size: 1,003 Bytes
fab29d7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
using System;
namespace VersOne.Epub.ConsoleDemo
{
internal static class PrintNavigation
{
public static void Run(string filePath)
{
using (EpubBookRef bookRef = EpubReader.OpenBook(filePath))
{
Console.WriteLine("Navigation:");
foreach (EpubNavigationItemRef navigationItemRef in bookRef.GetNavigation())
{
PrintNavigationItem(navigationItemRef, 0);
}
}
Console.WriteLine();
}
private static void PrintNavigationItem(EpubNavigationItemRef navigationItemRef, int identLevel)
{
Console.Write(new string(' ', identLevel * 2));
Console.WriteLine(navigationItemRef.Title);
foreach (EpubNavigationItemRef nestedNavigationItemRef in navigationItemRef.NestedItems)
{
PrintNavigationItem(nestedNavigationItemRef, identLevel + 1);
}
}
}
}
|