Use new command line parameters

Fixed logic to skip steps which don't match the current section
This commit is contained in:
Rich 2014-12-08 20:26:11 +00:00
parent 13d9350fdf
commit 007430be3d

View File

@ -297,12 +297,21 @@ namespace DataLoader
private int GetDocStyleIndx(string dstyleindx, FormatInfo format, Item procitem, /* DocVersion docver,*/ string Number, string Title) private int GetDocStyleIndx(string dstyleindx, FormatInfo format, Item procitem, /* DocVersion docver,*/ string Number, string Title)
{ {
int docstyle = LookupOldToNew(dstyleindx); int docstyle = LookupOldToNew(dstyleindx);
DocStyle ds0 = null;
foreach (DocStyle ds in format.PlantFormat.DocStyles.DocStyleList) foreach (DocStyle ds in format.PlantFormat.DocStyles.DocStyleList)
{ {
if ((ds.OldToNew & docstyle)>0) return (int)ds.Index; if (ds.Index == 0) ds0 = ds;
if ((ds.OldToNew & docstyle) > 0)
{
//frmMain.AddError("--->>>\"Good\"\t\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"\t\"{4}\"\t\"{5}\"",
// procitem.DisplayNumber, (Number ?? "") == "" ? Title : Number, dstyleindx, format, docstyle, ds.Name);
return (int)ds.Index;
}
} }
frmMain.AddError("Bad OldToNew Document Style {0}:{1} dStyleIndex = '{2}'\r\n{3} - Missing OldToNew {4}", frmMain.AddError("Bad OldToNew Document Style {0}:{1} dStyleIndex = '{2}'\r\n{3} - Missing OldToNew {4}",
procitem.DisplayNumber, (Number ?? "") == "" ? Title : Number, dstyleindx, format, docstyle); procitem.DisplayNumber, (Number ?? "") == "" ? Title : Number, dstyleindx, format, docstyle);
//frmMain.AddError("--->>>\"Bad\"\t\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"\t\"{4}\"\t\"{5}\"",
// procitem.DisplayNumber, (Number ?? "") == "" ? Title : Number, dstyleindx, format, docstyle, ds0.Name);
return 0; // Default is Zero return 0; // Default is Zero
} }
//private FormatInfo GetFormat(Item procitem, DocVersion docver) //private FormatInfo GetFormat(Item procitem, DocVersion docver)
@ -684,7 +693,19 @@ namespace DataLoader
Item FrItem = null; Item FrItem = null;
frmMain.pbStepMaximum = dt.Rows.Count-frmMain.pbSectMaximum; frmMain.pbStepMaximum = dt.Rows.Count-frmMain.pbSectMaximum;
int type = 6; int type = 6;
bool sectionShowed = false;
int firstCharSection = (int)(dr["Step"].ToString()[0]);
foreach (DataRowView drv in dv) foreach (DataRowView drv in dv)
{
int firstCharStep = (int)(drv[0].ToString()[0]);
if (firstCharSection != firstCharStep)
{
if(!sectionShowed)
Console.WriteLine("'Section','{0}','{1}','{2}',{3}", procnum,num,dr["Step"].ToString(), (int)(dr["Step"].ToString()[0]));
sectionShowed = true;
Console.WriteLine("'Skipping Step','{0}','{1}','{2}',{3}", procnum,num,drv["Step"].ToString(), (int)(drv["Step"].ToString()[0]));
}
else
{ {
FrItem = MigrateStep(cn, dt, drv, FrItem, conv_caret, pth, docver, sectFormat, secitem, type); FrItem = MigrateStep(cn, dt, drv, FrItem, conv_caret, pth, docver, sectFormat, secitem, type);
if (hasFloatingFoldouts && (sequence[2] == 'x' || sequence[2] == 'X')) if (hasFloatingFoldouts && (sequence[2] == 'x' || sequence[2] == 'X'))
@ -701,6 +722,7 @@ namespace DataLoader
// secitem.MyContent.Save(); // secitem.MyContent.Save();
//} //}
} }
}
dv.Dispose(); dv.Dispose();
} }
return secitem; return secitem;
@ -803,12 +825,12 @@ namespace DataLoader
switch (ex.Message) switch (ex.Message)
{ {
case "Index file not found.":// then delete inf file case "Index file not found.":// then delete inf file
fi = new FileInfo(frmMain.MySettings.ProcedureSetPath + "\\" + FileName + ".inf"); fi = new FileInfo(frmMain.ProcedureSetPath + "\\" + FileName + ".inf");
fi.Delete(); fi.Delete();
LoadSection(ds, da, FileName);// Try Again LoadSection(ds, da, FileName);// Try Again
break; break;
case "External table is not in the expected format.": // then pad dbt file with 128 zeros. case "External table is not in the expected format.": // then pad dbt file with 128 zeros.
fi = new FileInfo(frmMain.MySettings.ProcedureSetPath + "\\" + FileName + ".dbt"); fi = new FileInfo(frmMain.ProcedureSetPath + "\\" + FileName + ".dbt");
FileStream fs = fi.OpenWrite(); FileStream fs = fi.OpenWrite();
fs.Position = fs.Length; fs.Position = fs.Length;
byte[] buf = new byte[128]; byte[] buf = new byte[128];