-
Notifications
You must be signed in to change notification settings - Fork 0
/
InputReader.cs
62 lines (55 loc) · 1.41 KB
/
InputReader.cs
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace ConvertICloudNotes
{
public class InputReader : IEnumerator,IEnumerable
{
//
private readonly DirectoryInfo RootDir;
private readonly Notebook[] Notebooks;
int position = -1;
public InputReader(DirectoryInfo InputRootDir)
{
RootDir = InputRootDir;
DirectoryInfo[] notebookDirs = RootDir.GetDirectories();
Notebooks = new Notebook[notebookDirs.Length];
for (int i = 0; i < notebookDirs.Length; i++)
{
Notebooks[i] = new Notebook(notebookDirs[i]);
}
}
public int NotebookCount
{
get { return Notebooks.Length; }
}
public int NotesCount()
{
int count = 0;
foreach (Notebook notebook in Notebooks)
{
count += notebook.NoteCount;
}
return count;
}
public IEnumerator GetEnumerator()
{
return (IEnumerator)this;
}
public bool MoveNext()
{
position++;
return (position < Notebooks.Length);
}
public void Reset()
{
position = 0;
}
public object Current
{
get { return Notebooks[position]; }
}
}
}