This commit is contained in:
John Jenko 2009-06-12 20:17:03 +00:00
parent 20486ad90a
commit 368c85c98b
2 changed files with 61 additions and 46 deletions

View File

@ -69,6 +69,12 @@ namespace DataLoader
} }
return false; return false;
} }
public int ItemCount
{
get { return xmldoc.DocumentElement.ChildNodes.Count; }
}
public override string ToString() public override string ToString()
{ {
if (xmldoc != null) return xmldoc.InnerXml; if (xmldoc != null) return xmldoc.InnerXml;

View File

@ -22,16 +22,22 @@ namespace DataLoader
Item item = null; Item item = null;
frmMain.UpdateLabels(0, 0, 1); frmMain.UpdateLabels(0, 0, 1);
ConfigInfo ci = null; ConfigInfo ci = new ConfigInfo(null);
string stptext = null; string stptext = null;
if (userid == null || userid == "") userid = "Migration"; if (userid == null || userid == "") userid = "Migration";
int tok = -1; int tok = -1;
char[] chrarr = { '\x1', '\x2', '\x3', '\x5' }; //char[] chrarr = { '\x1', '\x2', '\x3', '\x5' };
char[] chrarr = { '\x1', '\x2', '\x3' };
try try
{ {
// the textm field has step text, but also may have other text stored // the textm field has step text, but also may have other text stored
// with it with a 'token' as a separator (see below). // with it with a 'token' as a separator (see below).
tok = Textm.IndexOfAny(chrarr); tok = Textm.IndexOfAny(chrarr);
// This will find a continuous action flag without finding a hanging indent
if (tok == 0 && Textm[Textm.Length - 1] == '\x5')
tok = Textm.Length - 1;
if (tok < 0) if (tok < 0)
stptext = TextConvert.ConvertText(Textm, conv_caret); stptext = TextConvert.ConvertText(Textm, conv_caret);
else else
@ -52,7 +58,7 @@ namespace DataLoader
if (cbittst != ' ' && (cbittst & 0x80) > 1) if (cbittst != ' ' && (cbittst & 0x80) > 1)
{ {
ManualPagebreak = true; ManualPagebreak = true;
if (ci == null) ci = new ConfigInfo(null); //if (ci == null) ci = new ConfigInfo(null);
ci.AddItem("Step", "ManualPagebreak", "True"); ci.AddItem("Step", "ManualPagebreak", "True");
newstptyp = StepType.Substring(1, 1); newstptyp = StepType.Substring(1, 1);
} }
@ -148,7 +154,10 @@ namespace DataLoader
// '\2' multiple change ids and/or change message // '\2' multiple change ids and/or change message
// '\3' linked sequence // '\3' linked sequence
// '\3\3'override tab // '\3\3'override tab
// '\5' continuous action summary flag // '\5' continuous action summary flag (only if last char in string)
// This assumes that these tokens are stored in reverse order that
// they are processed.
bool recdirty = false; bool recdirty = false;
try try
@ -159,56 +168,45 @@ namespace DataLoader
string tkstring = Textm.Substring(tok); string tkstring = Textm.Substring(tok);
int nxttok = 0; int nxttok = 0;
char chr = tkstring[nxttok]; if (tkstring[tkstring.Length - 1] == '\x5') // Continuous Action Summary
int typ = 0;
if (chr == '\x5') // Continuous Action Summary
{ {
recdirty = true; recdirty = true;
if (ci == null) ci = new ConfigInfo(null); //if (ci == null) ci = new ConfigInfo(null);
ci.AddItem("Step", "ContActSum", "True"); ci.AddItem("Step", "ContActSum", "True");
tkstring = tkstring.Substring(0,nxttok); tkstring = tkstring.Substring(0, tkstring.Length - 1); // strip off Continuous Action Token
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 = tkstring.IndexOf("\x3\x3")) > -1) // Enhanced Override Tab
string strn = null;
typ = STP_LNK_SEQ;
if (((nxttok + 1) <= tkstring.Length) && tkstring[nxttok + 1] == '\x3')
{
typ = STP_OVR_TAB;
strn = tkstring.Substring(nxttok + 2);
}
else
strn = TextConvert.ConvertSeq(tkstring.Substring(nxttok + 1));
if (strn != null && strn != "")
{ {
Console.WriteLine("Override Tab: {0}", tkstring.Substring(nxttok + 1));
ci.AddItem("Step", "OverrideTab", tkstring.Substring(nxttok + 2));
recdirty = true; recdirty = true;
content.ContentDetails.Add(typ, strn); //recdirty |= AddContentDetail(content, STP_OVR_TAB, tkstring.Substring(nxttok + 2));
}
tkstring = tkstring.Substring(0, nxttok); tkstring = tkstring.Substring(0, nxttok);
nxttok = tkstring.IndexOfAny("\x2\x1".ToCharArray());
if (nxttok > -1)
chr = tkstring[nxttok];
} }
if (chr == '\x2') // Multiple Change Ids
{ if ((nxttok = tkstring.IndexOf("\x3")) > -1) //Linked Sequence
typ = STP_MULT_CHGID;
string strn = tkstring.Substring(nxttok+1);
if (strn != null && strn != "")
{ {
Console.WriteLine("Linked Seq: {0}", tkstring.Substring(nxttok + 1));
ci.AddItem("Step", "LinkedSeq", TextConvert.ConvertSeq(tkstring.Substring(nxttok + 1)));
recdirty = true; recdirty = true;
content.ContentDetails.Add(typ, strn); //recdirty |= AddContentDetail(content, STP_LNK_SEQ, TextConvert.ConvertSeq(tkstring.Substring(nxttok + 1)));
}
tkstring = tkstring.Substring(0, nxttok); tkstring = tkstring.Substring(0, nxttok);
nxttok = 0; // tkstring.IndexOf('\x1');
if ((tkstring != null) && (tkstring.Length > 0))
chr = tkstring[nxttok];
} }
if (chr == '\x1') // Comment
if ((nxttok = tkstring.IndexOf("\x2")) > -1) // Multiple Change Ids
{
Console.WriteLine("Multiple Change ID: {0}", tkstring.Substring(nxttok + 1));
ci.AddItem("Step", "MultipleChangeID", tkstring.Substring(nxttok + 1));
recdirty = true;
//recdirty |= AddContentDetail(content, STP_MULT_CHGID, tkstring.Substring(nxttok + 1));
tkstring = tkstring.Substring(0, nxttok);
}
if ((nxttok = tkstring.IndexOf("\x1")) > -1) // Comment
{ {
// add the comment to annotation table. Set type to comment. // add the comment to annotation table. Set type to comment.
Console.WriteLine("Comment text: {0}", tkstring.Substring(nxttok + 1));
Annotation annot = Annotation.MakeAnnotation(item, CommentType, null, tkstring.Substring(nxttok + 1), null, dts, userid); Annotation annot = Annotation.MakeAnnotation(item, CommentType, null, tkstring.Substring(nxttok + 1), null, dts, userid);
} }
} }
@ -219,7 +217,7 @@ namespace DataLoader
{ {
recdirty = true; recdirty = true;
string chkindx = Recid[0].ToString(); string chkindx = Recid[0].ToString();
if (ci == null) ci = new ConfigInfo(null); //if (ci == null) ci = new ConfigInfo(null);
ci.AddItem("Step", "CheckOffIndex", chkindx); ci.AddItem("Step", "CheckOffIndex", chkindx);
} }
@ -232,7 +230,7 @@ namespace DataLoader
// if checkoffs or the continuous action summary flag, save the xml. // if checkoffs or the continuous action summary flag, save the xml.
if (recdirty) if (recdirty)
{ {
if (ci != null) content.Config = ci.ToString(); if (ci.ItemCount != 0) content.Config = ci.ToString();
if (!content.IsSavable) ErrorRpt.ErrorReport(content); if (!content.IsSavable) ErrorRpt.ErrorReport(content);
content.Save(); content.Save();
} }
@ -246,6 +244,17 @@ namespace DataLoader
} }
return item; return item;
} }
//private static bool AddContentDetail(Content content, int type, string strn)
//{
// if (strn != null && strn.Trim() != "" )
// {
// content.ContentDetails.Add(type, strn);
// return true;
// }
// return false;
//}
private string GetParent(string s) private string GetParent(string s)
{ {
string retval = "S"; string retval = "S";