-
Notifications
You must be signed in to change notification settings - Fork 0
/
Notebook.cs
54 lines (49 loc) · 1.21 KB
/
Notebook.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
using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
namespace ConvertICloudNotes
{
public class Notebook : IEnumerator,IEnumerable
{
public DirectoryInfo Dir { get; private set; }
private readonly Note[] Notes;
int position = -1;
public Notebook(DirectoryInfo NotebookDir)
{
Dir = NotebookDir;
DirectoryInfo[] noteDirs = Dir.GetDirectories();
Notes = new Note[noteDirs.Length];
for (int i = 0; i < noteDirs.Length; i++)
{
Notes[i] = new Note(noteDirs[i]);
}
}
public string Name
{
get { return Dir.Name; }
}
public int NoteCount
{
get { return Notes.Length; }
}
public IEnumerator GetEnumerator()
{
return (IEnumerator)this;
}
public bool MoveNext()
{
position++;
return (position < Notes.Length);
}
public void Reset()
{
position = 0;
}
public object Current
{
get { return Notes[position]; }
}
}
}