112 lines
4.6 KiB
C#
112 lines
4.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Xml;
|
|
|
|
namespace fmtxml
|
|
{
|
|
public partial class FmtFileToXml
|
|
{
|
|
public void AddPlantSpecific(string genFileName, ref FormatData fmtdata)
|
|
{
|
|
string genName = genFileName.Substring(genFileName.LastIndexOf('\\') + 1);
|
|
genName = genName.Substring(0, genName.IndexOf('.'));
|
|
switch (genName.ToUpper())
|
|
{
|
|
case "TP":
|
|
AddTPFmt(ref fmtdata);
|
|
break;
|
|
case "RGE":
|
|
case "RGESAM1":
|
|
case "RGESAM2":
|
|
case "RGESMPE":
|
|
AddRGEFmt(ref fmtdata);
|
|
break;
|
|
case "WCN2":
|
|
AddWCN2Fmt(ref fmtdata);
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void AddTPFmt(ref FormatData fmtdata)
|
|
{
|
|
// When a plant does not have the TextSubFollowsTextStyle, the 16bit code was adding two characters
|
|
// before the tab if the parent of this step is a Caution or Note. But the two characters was related
|
|
// to the spaces on the parents tab. The code was very hard to follow. This format variable was
|
|
// introduced to allow setting of the number of spaces before the tab.
|
|
fmtdata.StepData[1].CautionOrNoteSubstepIndent = "2";
|
|
}
|
|
private void AddRGEFmt(ref FormatData fmtdata)
|
|
{
|
|
// The RGE formats had a PrintPosAdjust in 16 bit on the High, Immediate, LossocAC & continuous step
|
|
// types with a value of -1 (move back one character). However, on the printed output, it printed
|
|
// as about a 1/4 of a character. This value will be set in the 32bit format file to a -2.4 in
|
|
// these step types.
|
|
fmtdata.StepData[2].StepPrintData.PosAdjust = "-2.4";
|
|
fmtdata.StepData[3].StepPrintData.PosAdjust = "-2.4";
|
|
fmtdata.StepData[9].StepPrintData.PosAdjust = "-2.4";
|
|
fmtdata.StepData[18].StepPrintData.PosAdjust = "-2.4";
|
|
// The RGE formats tabs for HLS were printing one character over to the left in 32 bit, except for
|
|
// immediate (index = 3). Adjust format tab data to make it match 16bit.
|
|
fmtdata.StepData[2].TabData.Ident = " {numeric} ";
|
|
fmtdata.StepData[2].TabData.IdentEdit = " {numeric} ";
|
|
fmtdata.StepData[2].TabData.RNOIdentEdit="";
|
|
fmtdata.StepData[2].TabData.RNOIdent="";
|
|
fmtdata.StepData[2].TabData.IdentEditWid="";
|
|
fmtdata.StepData[2].TabData.IdentWid="18";
|
|
fmtdata.StepData[2].TabData.RNOIdentEditWid="18";
|
|
fmtdata.StepData[2].TabData.RNOIdentWid = "18";
|
|
fmtdata.StepData[9].TabData.IdentEdit="*{numeric} ";
|
|
fmtdata.StepData[9].TabData.Ident="*{numeric} ";
|
|
fmtdata.StepData[9].TabData.RNOIdentEdit="* ";
|
|
fmtdata.StepData[9].TabData.RNOIdent = "* ";
|
|
|
|
|
|
}
|
|
private void AddWCN2Fmt(ref FormatData fmtdata)
|
|
{
|
|
// the WCN2 tab for continuous HLS type had only 1 space after the period ('.'). The other
|
|
// tabs had two spaces. This tab type also uses the C0 macro to draw the lines above/below
|
|
// the number. Because it only had 1 space, the tab and lines were not matching the
|
|
// 16bit output. A space is added here to make the continuous HLS type match the number
|
|
// of spaces as other HLS tabs, and to make the printed output match that of 16bit.
|
|
fmtdata.StepData[9].TabData.Ident = fmtdata.StepData[9].TabData.Ident + " ";
|
|
fmtdata.StepData[9].TabData.IdentEdit = fmtdata.StepData[9].TabData.IdentEdit + " ";
|
|
fmtdata.StepData[9].TabData.RNOIdent = fmtdata.StepData[9].TabData.RNOIdent + " ";
|
|
fmtdata.StepData[9].TabData.RNOIdentEdit = fmtdata.StepData[9].TabData.RNOIdentEdit + " ";
|
|
}
|
|
}
|
|
public partial class RtfToSvg
|
|
{
|
|
public void AppendPlantSpecific(string genFileName, XmlDocument myDoc)
|
|
{
|
|
string genName = genFileName.Substring(genFileName.LastIndexOf('\\') + 1);
|
|
genName = genName.Substring(0, genName.IndexOf('.'));
|
|
switch (genName.ToUpper())
|
|
{
|
|
case "WCN2":
|
|
AddWCN2(myDoc);
|
|
break;
|
|
case "WCN1":
|
|
AddWCN2(myDoc); // same cover page box as wcn2
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void AddWCN2(XmlDocument myDoc)
|
|
{
|
|
XmlDocument xd = new XmlDocument();
|
|
// include the svg level so that the xmlns can be set to be the same as the generated document.
|
|
xd.LoadXml("<svg xmlns=\"http://www.w3.org/2000/svg\"><g id=\"B9\">\r\n" +
|
|
"<rect x=\"4\" y=\"-3\" width=\"352.5\" height=\"120\" fill=\"none\" stroke=\"black\" stroke-width=\"1.2\" />\r\n" +
|
|
"<line x1=\"4\" y1=\"21\" x2=\"355.5\" y2=\"21\" stroke-width=\"1.2\" />\r\n" +
|
|
"<line x1=\"4\" y1=\"45\" x2=\"355.5\" y2=\"45\" stroke-width=\"1.2\" />\r\n" +
|
|
"<line x1=\"4\" y1=\"69\" x2=\"355.5\" y2=\"69\" stroke-width=\"1.2\" />\r\n" +
|
|
"<line x1=\"4\" y1=\"93\" x2=\"355.5\" y2=\"93\" stroke-width=\"1.2\" />\r\n" +
|
|
"<line x1=\"263\" y1=\"-3\" x2=\"263\" y2=\"118\" stroke-width=\"1.2\" />\r\n" +
|
|
"</g></svg>");
|
|
myDoc.DocumentElement.AppendChild(myDoc.ImportNode(xd.DocumentElement.ChildNodes[0], true));
|
|
}
|
|
}
|
|
}
|