From 77e55dbb9ce24a9ff480cb2b71298d5c78b7df9c Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 3 Nov 2009 16:27:35 +0000 Subject: [PATCH] --- PROMS/fmtxml/FmtFileToXml.cs | 61 +++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/PROMS/fmtxml/FmtFileToXml.cs b/PROMS/fmtxml/FmtFileToXml.cs index 465cc632..5625c78f 100644 --- a/PROMS/fmtxml/FmtFileToXml.cs +++ b/PROMS/fmtxml/FmtFileToXml.cs @@ -2543,9 +2543,9 @@ namespace fmtxml { if (Tabindx[i] == j) { - fmtdata.StepData[i+1].TabData.IdentEdit = DoTabs(fmtdata.StepData[i].TabData.Font, fmtdata.PurchaseOptions, i, tabstrings[j, 0]); + fmtdata.StepData[i+1].TabData.IdentEdit = DoTabs(fmtdata.StepData[i].TabData.Font, fmtdata.PurchaseOptions, i, tabstrings[j, 0], true); fmtdata.StepData[i+1].TabData.IdentEditWid = CalculateTabWid(tabstrings[j, 0]).ToString(); - fmtdata.StepData[i+1].TabData.Ident = DoTabs(fmtdata.StepData[i].TabData.Font, fmtdata.PurchaseOptions, i, tabstrings[j, 1]); + fmtdata.StepData[i + 1].TabData.Ident = DoTabs(fmtdata.StepData[i].TabData.Font, fmtdata.PurchaseOptions, i, tabstrings[j, 1], true); fmtdata.StepData[i+1].TabData.IdentWid = CalculateTabWid(tabstrings[j, 1]).ToString(); break; } @@ -2582,8 +2582,33 @@ namespace fmtxml { indx = offset[arcnt]; arcnt++; - if (indx > 0) fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat = fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat + GetStringFromByte(input, indx); - else fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat = null; + if (indx > 0) + { + string p = GetStringFromByte(input, indx); + if (p != null) + { + if (p[0] == '+') + { + string tmp = null; + if (fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat.IndexOf("{numeric}") > -1) + tmp = p.Replace("+", "{numericWpar}"); + else if (fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat.IndexOf("{alpha}") > -1) + tmp = p.Replace("+", "{alphaWpar}"); + else if (fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat.IndexOf("{ALPHA}") > -1) + tmp = p.Replace("+", "{ALPHAWpar}"); + else + tmp = p.Replace("+", "{UNKNOWNWpar}"); + fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat = tmp; + } + else + fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat = fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat + p; + } + else + fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat = null; + } + else + fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat = null; + //if (indx > 0) fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat = fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat + GetStringFromByte(input, indx); } // replace word strings for (int i = 0; i < MAXREPLACE; i++) @@ -2878,9 +2903,9 @@ namespace fmtxml { if (Tabindx[i] == j) { - fmtdata.StepData[i + 1].TabData.RNOIdentEdit = DoTabs(fmtdata.StepData[i].TabData.Font, fmtdata.PurchaseOptions, i, tabstrings[j, 0]); + fmtdata.StepData[i + 1].TabData.RNOIdentEdit = DoTabs(fmtdata.StepData[i].TabData.Font, fmtdata.PurchaseOptions, i, tabstrings[j, 0], fmtdata.StepData[i].StepNumberForHighLevel=="True"); fmtdata.StepData[i + 1].TabData.RNOIdentEditWid = CalculateTabWid(tabstrings[j, 0]).ToString(); - fmtdata.StepData[i + 1].TabData.RNOIdent = DoTabs(fmtdata.StepData[i].TabData.Font, fmtdata.PurchaseOptions, i, tabstrings[j, 1]); + fmtdata.StepData[i + 1].TabData.RNOIdent = DoTabs(fmtdata.StepData[i].TabData.Font, fmtdata.PurchaseOptions, i, tabstrings[j, 1], fmtdata.StepData[i].StepNumberForHighLevel == "True"); fmtdata.StepData[i + 1].TabData.RNOIdentWid = CalculateTabWid(tabstrings[j, 1]).ToString(); break; } @@ -4277,7 +4302,7 @@ namespace fmtxml try { // replace newline with {par} - wkstr = wkstr.Replace("\n", "{par}"); + wkstr = wkstr.Replace("\n", @"{\par}"); // special change bar token (various cpl formats) wkstr = wkstr.Replace("\x08\x08\x08\x08\x08\x05", "{CHG_BAR with Backspace Token}"); @@ -4368,10 +4393,13 @@ namespace fmtxml if (tablen < 0) tablen = 0; return ColToPoints(tablen); } - private string DoTabs(VE_Font vefont, string po, int i, string p) + private string DoTabs(VE_Font vefont, string po, int i, string p, bool doNumeric) { - if (p == null || p == "") return p; + if ((p == null || p == "")&&i!=0) return p; + string wkstr = p; + if (i==0 && p==null) + return "{seq}"; //Number Formatting // $ - Uppercase Alphabetical (IP2, GEN, CAL2, VLNCAS) // & - Roman Numeral - UpperCase @@ -4401,8 +4429,17 @@ namespace fmtxml if (i == 0 && ((indx = wkstr.IndexOf("{")) < 0)) // sequential - put in "{seq}" wkstr = wkstr.Insert(0, "{seq}"); // high, immediate, continuous, lossofac, high5 - put in " {numeric} " - else if ((i == 1 || i == 2 || i == 8 || i == 17 || i == 40) && ((indx = wkstr.IndexOf("{")) < 0)) - wkstr = wkstr.Insert(1, "{numeric}"); + else if ((i == 1 || i == 2 || i == 8 || i == 17 || i == 40) && ((indx = wkstr.IndexOf("{")) < 0) && doNumeric) + { + int indxColon = wkstr.IndexOf(":"); + int indxPercent = wkstr.IndexOf("%"); + if (indxColon>0) + wkstr = wkstr.Insert(indxColon, "{numeric}"); + else if (indxPercent>0) + wkstr = wkstr.Insert(indxPercent+1, "{numeric}"); // put numeric after section prefix + else + wkstr = wkstr.Insert(1, "{numeric}"); + } //Section Numbers // % - Prefix with section number (works string in 16 bit, ie.e For 4.3 the prefix becomes 4. @@ -5237,4 +5274,4 @@ private string [] SubStepValue = {"Substep","And","Or","EquipmentList","Equipmen } } -} \ No newline at end of file +}