handle junk comments

This commit is contained in:
Jsj 2008-04-01 17:02:17 +00:00
parent 06319605f2
commit 73830ed0e1

View File

@ -151,62 +151,67 @@ namespace DataLoader
bool recdirty = false;
try
{
while (tok >= 0 && tok != Textm.Length)
{
int nxttok = Textm.IndexOfAny(chrarr, tok + 1);
char chr = Textm[tok];
int typ = 0;
if (chr == '\x1')
{
// add the comment to annotation table. Set type to comment.
if (nxttok < 0) nxttok = Textm.Length;
Annotation annot = Annotation.MakeAnnotation(item, CommentType, null, Textm.Substring(tok + 1, nxttok - tok - 1), null, dts, userid);
}
else if (chr == '\x2')
typ = STP_MULT_CHGID;
else if (chr == '\x3')
{
typ = STP_LNK_SEQ;
// check for a double \3 - override tab.
if (tok + 1 < Textm.Length)
{
char nxttokchr = Textm[tok + 1];
if (nxttokchr == '\x3')
{
typ = STP_OVR_TAB;
tok++; // this was a double \3, get past 1st one.
nxttok = Textm.IndexOfAny(chrarr, tok + 1);
}
}
}
else if (chr == '\x5')
{
recdirty = true;
if (ci == null) ci = new ConfigInfo(null);
ci.AddItem("Step", "ContActSum", "True");
if (nxttok < 0) nxttok = Textm.Length;
}
// if not comment or ContActSum (xml) make a steptext element
if (typ == STP_MULT_CHGID || typ == STP_LNK_SEQ || typ == STP_OVR_TAB)
if (tok >= 0 && tok != Textm.Length)
{
string tkstring = Textm.Substring(tok);
int nxttok = 0;
char chr = tkstring[nxttok];
int typ = 0;
if (chr == '\x5') // Continuous Action Summary
{
recdirty = true;
if (ci == null) ci = new ConfigInfo(null);
ci.AddItem("Step", "ContActSum", "True");
tkstring = tkstring.Substring(0,nxttok);
nxttok = tkstring.IndexOfAny("\x3\x2\x1".ToCharArray());
if (nxttok > -1)
chr = tkstring[nxttok];
}
if (chr == '\x3') //Linked Sequence or Step Override Tab (two '\x3')
{
if (nxttok < 0) nxttok = Textm.Length;
// if this is a sequence number - may need to convert hi-end chars
string strn = null;
if (typ == STP_LNK_SEQ)
strn = TextConvert.ConvertSeq(Textm.Substring(tok + 1, nxttok - tok - 1));
typ = STP_LNK_SEQ;
if (((nxttok + 1) <= tkstring.Length) && tkstring[nxttok + 1] == '\x3')
{
typ = STP_OVR_TAB;
strn = tkstring.Substring(nxttok + 2);
}
else
strn = Textm.Substring(tok + 1, nxttok - tok - 1);
strn = TextConvert.ConvertSeq(tkstring.Substring(nxttok + 1));
if (strn != null && strn != "")
{
recdirty = true;
content.ContentDetails.Add(typ, strn);
}
tkstring = tkstring.Substring(0,nxttok);
nxttok = tkstring.IndexOfAny("\x2\x1".ToCharArray());
if (nxttok > -1)
chr = tkstring[nxttok];
}
if (chr == '\x2') // Multiple Change Ids
{
typ = STP_MULT_CHGID;
string strn = tkstring.Substring(nxttok+1);
if (strn != null && strn != "")
{
recdirty = true;
content.ContentDetails.Add(typ, strn);
}
tkstring = tkstring.Substring(0,nxttok);
nxttok = 0; // tkstring.IndexOf('\x1');
if ((tkstring != null) && (tkstring.Length > 0))
chr = tkstring[nxttok];
}
if (chr == '\x1') // Comment
{
// add the comment to annotation table. Set type to comment.
Annotation annot = Annotation.MakeAnnotation(item, CommentType, null, tkstring.Substring(nxttok + 1), null, dts, userid);
}
tok = nxttok;
}
// also see if a check-off needs added.
if (Recid[0] != '0')
{