-
Notifications
You must be signed in to change notification settings - Fork 0
/
GedcomLineObject.cs
102 lines (94 loc) · 2.96 KB
/
GedcomLineObject.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Ekmansoft.FamilyTree.Codec.Gedcom
{
class GedcomLineObject
{
private readonly static TraceSource trace = new TraceSource("GedcomLineObject", SourceLevels.Warning);
//public String xrefIdString;
public IList<GedcomLineData> gedcomLines;
//public int parseLineNo;
public GedcomLineObject parent;
//public GedcomLineObject child;
private int level;
//private GedcomFileCharacterSet characterSet;
public GedcomLineObject(int inLevel)
{
//xrefIdString = "";
//parseLineNo = 0;
gedcomLines = new List<GedcomLineData>();
parent = null;
//child = null;
level = inLevel;
//characterSet = inCharacterSet;
}
public void Print()
{
if (trace.Switch.Level.HasFlag(SourceLevels.Information))
{
trace.TraceInformation("GedcomLineObject(" + level + "," + gedcomLines.Count + ")");
//trace.TraceInformation(" xref [" + xrefIdString + "]");
for (int i = 0; i < gedcomLines.Count; i++)
{
//gedcomLines[i].Print();
trace.TraceInformation(gedcomLines[i].tagString);
if (gedcomLines[i].child != null)
{
trace.TraceInformation(" child[" + gedcomLines[i].child.GetLevel() + " " + gedcomLines[i].child.gedcomLines.Count + "]");
}
trace.TraceInformation("");
}
}
}
public void PrintShort()
{
//PrintSpaces(level);
//trace.TraceInformation("xref[" + xrefIdString + "]");
for (int i = 0; i < gedcomLines.Count; i++)
{
gedcomLines[i].PrintShort();
}
}
public void ObjectDecodeStart(String objectName, GedcomLineObject gedcomLineObject)
{
if (!trace.Switch.Level.HasFlag(SourceLevels.Information))
{
return;
}
if (objectName != null)
{
trace.TraceInformation(objectName + ":start ===============================================");
}
for (int i = 0; i < gedcomLineObject.gedcomLines.Count; i++)
{
GedcomLineData lineData = gedcomLineObject.gedcomLines[i];
if (lineData.xrefIdString.Length > 0)
{
trace.TraceInformation(" xref: " + lineData.xrefIdString + " ");
}
//trace.TraceInformation(" individual-line: " + lineData.level + " " + lineData.tagString + " " + lineData.valueString + " ");
trace.TraceInformation(lineData.lineNo + " " + lineData.tagString + " " + lineData.valueString + " ");
if (lineData.child != null)
{
ObjectDecodeStart(null, lineData.child);
}
}
if (objectName != null)
{
trace.TraceInformation(objectName + ":end ===============================================");
}
}
public int GetLevel()
{
return level;
}
public void Clear()
{
while (gedcomLines.Count > 0)
{
gedcomLines.RemoveAt(0);
}
}
};
}