-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
StandardFormatRecord.cs
80 lines (70 loc) · 1.55 KB
/
StandardFormatRecord.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
using System;
using System.Collections;
namespace StandardFormatLib
{
/// <summary>
///
/// </summary>
public class StandardFormatRecord
{
private ArrayList m_Fields; //Array of Standard Format Fields
public StandardFormatRecord()
{
m_Fields = new ArrayList();
}
public StandardFormatRecord(string strRecord)
{
int nBeg = 0;
int nEnd = 0;
string strField = "";
StandardFormatField sff;
m_Fields = new ArrayList();
nBeg = strRecord.IndexOf(StandardFormatFile.kBackSlash, nBeg);
do
{
nEnd = strRecord.IndexOf(StandardFormatFile.kBackSlash, nBeg+1) - 1;
if (nEnd < 0)
nEnd = strRecord.Length;
strField = strRecord.Substring(nBeg,nEnd-nBeg);
sff = new StandardFormatField(strField);
m_Fields.Add(sff);
nBeg = nEnd +1;;
}
while (nBeg < strRecord.Length);
m_Fields.TrimToSize();
}
public string GetFieldContents(string strFieldMarker)
{
string strFieldContents = "";
StandardFormatField sff;
for (int i =0; i<m_Fields.Count; i++)
{
sff = (StandardFormatField) m_Fields[i];
if ( strFieldMarker == sff.GetFieldMarker() )
{
strFieldContents = sff.GetFieldContents();
break;
}
}
return strFieldContents;
}
public StandardFormatField GetField(int n)
{
return (StandardFormatField) m_Fields[n];
}
public void AddField(StandardFormatField sff)
{
m_Fields.Add(sff);
}
public void DelField(int n)
{
m_Fields.RemoveAt(n);
}
public int Count()
{
if (m_Fields == null)
return 0;
else return m_Fields.Count;
}
}
}