StreamReader & error handling

CheckOff & ChangeBar changes
CheckOff & Gen -> Base
This commit is contained in:
Rich
2010-05-25 16:06:14 +00:00
parent 4e3887c611
commit 699b412bcd
3 changed files with 269 additions and 138 deletions

View File

@@ -60,6 +60,7 @@ public struct DocStyle
// 3 - within each accessory document
public bool IsStepSection; // using oldtonew, determine whether is step
// section or word doc section (new to 32-bit)
public bool UseCheckOffs; // This was originally in fmt. Load fmt to get
public int oldtonew; // Bits for converting from old to new
// document style
public short ContTopHLS; // Flag for including High Level step
@@ -669,6 +670,8 @@ namespace fmtxml
XslCompiledTransform xsl = FmtFileToXml.getTransform(Application.StartupPath + "\\TranslatePag.XSL");
string sResults = "fmt_xml\\" + lfmtname + "p.xml";
xsl.Transform(destfile, sResults); // Perform Transform
if (lfmtname == "GEN")
File.Copy(sResults, "fmt_xml\\BASEp.xml"); // Create BASE from GEN format
}
catch (Exception e)
{
@@ -770,7 +773,7 @@ namespace fmtxml
dc.ContStyle = LoadVE_Font();
dc.EndFlag = brFmt.ReadInt16();
dc.EndStyle = LoadVE_Font();
dc.UseCheckOffs = UseCheckOffsIn(fname.Substring(0, fname.Length - 4), dc.oldtonew);
// use the string offsets to read in the strings.
int[] offst = new int[strings];
for (int j = 0; j < strings; j++)
@@ -820,7 +823,16 @@ namespace fmtxml
XslCompiledTransform xsl = FmtFileToXml.getTransform(Application.StartupPath + "\\TranslateDoc.XSL");
string sResults = "fmt_xml\\" + lfmtname + "d.xml";
xsl.Transform(destfile, sResults); // Perform Transform
}
xsl = FmtFileToXml.getTransform(Application.StartupPath + "\\removeFmtUseCO.XSL");
//xsl.Load(Application.StartupPath + "\\removeempty.XSL");
string sFormatResults = "fmt_xml\\" + lfmtname + "f.xml";
string sResults2 = "fmt_xml\\" + lfmtname + "xf.xml";
xsl.Transform(sFormatResults, sResults2);
File.Delete(sFormatResults);
File.Move(sResults2, sFormatResults);
if (lfmtname == "GEN")
File.Copy(sResults, "fmt_xml\\BASEd.xml"); // Create BASE from GEN format
}
catch (Exception e)
{
Console.WriteLine(e.Message);
@@ -828,6 +840,26 @@ namespace fmtxml
}
}
private bool UseCheckOffsIn(string p, int p_2)
{
try
{
XmlDocument xdoc = new XmlDocument();
string path = "fmt_xml\\" + p + "f.xml";
if (!File.Exists(path)) return false;
xdoc.Load("fmt_xml\\" + p + "f.xml");
XmlNode useCO = xdoc.SelectSingleNode("FormatData/ProcData/CheckOffData/@UseCheckOffsIn");
if (useCO == null) return false;
int iDoc = System.Convert.ToInt32(useCO.Value);
if ((p_2 & iDoc)>0) return true;
}
catch (Exception ex)
{
Console.WriteLine("here");
}
return false;
}
private bool ConvertToSectType(int p)
{
if (((p & (int)E_OldToNewSteps.S0) != 0) || ((p & (int)E_OldToNewSteps.S1) != 0) || ((p & (int)E_OldToNewSteps.S2) != 0) ||