This commit is contained in:
parent
35f45d2e0b
commit
4e94953f18
@ -23,7 +23,6 @@ public struct FormatData
|
|||||||
{
|
{
|
||||||
public string Name;
|
public string Name;
|
||||||
public string PurchaseOptions;
|
public string PurchaseOptions;
|
||||||
public string PSI;
|
|
||||||
public string TPL;
|
public string TPL;
|
||||||
//public XtraFlgs XtraFlags;
|
//public XtraFlgs XtraFlags;
|
||||||
public VE_Font FontData;
|
public VE_Font FontData;
|
||||||
@ -461,11 +460,54 @@ public struct Procedure
|
|||||||
public string CountFoldoutPages;
|
public string CountFoldoutPages;
|
||||||
/* End of Format flags */
|
/* End of Format flags */
|
||||||
public string[] ProcedureSuffix;
|
public string[] ProcedureSuffix;
|
||||||
public string PSInfFile;
|
public PSI Psi;
|
||||||
public ChangeBar ChangeBarData;
|
public ChangeBar ChangeBarData;
|
||||||
public CheckOffData CheckOffData;
|
public CheckOffData CheckOffData;
|
||||||
}
|
}
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
public struct PSI
|
||||||
|
{
|
||||||
|
public int x;
|
||||||
|
public int y;
|
||||||
|
public string Caption;
|
||||||
|
public string ButtonsOnBottom;
|
||||||
|
public string font;
|
||||||
|
public PsiBox[] Boxes;
|
||||||
|
public PsiLabel[] Labels;
|
||||||
|
public PsiField[] Fields;
|
||||||
|
}
|
||||||
|
[Serializable]
|
||||||
|
public struct PsiBox
|
||||||
|
{
|
||||||
|
public string style;
|
||||||
|
public int x;
|
||||||
|
public int y;
|
||||||
|
public int width;
|
||||||
|
public int height;
|
||||||
|
}
|
||||||
|
[Serializable]
|
||||||
|
public struct PsiLabel
|
||||||
|
{
|
||||||
|
public string text;
|
||||||
|
public string Justify;
|
||||||
|
public int x;
|
||||||
|
public int y;
|
||||||
|
public int width;
|
||||||
|
public int height;
|
||||||
|
}
|
||||||
|
[Serializable]
|
||||||
|
public struct PsiField
|
||||||
|
{
|
||||||
|
public string name;
|
||||||
|
public string type;
|
||||||
|
public string text;
|
||||||
|
public int Length;
|
||||||
|
public int x;
|
||||||
|
public int y;
|
||||||
|
public int width;
|
||||||
|
public int height;
|
||||||
|
}
|
||||||
|
[Serializable]
|
||||||
public struct CheckOffData
|
public struct CheckOffData
|
||||||
{
|
{
|
||||||
public string Menu;
|
public string Menu;
|
||||||
@ -1068,7 +1110,7 @@ public enum E_TransFormatXlate : uint
|
|||||||
///////////////////////////
|
///////////////////////////
|
||||||
namespace fmtxml
|
namespace fmtxml
|
||||||
{
|
{
|
||||||
public class FmtFileToXml
|
public partial class FmtFileToXml
|
||||||
{
|
{
|
||||||
#region localdata
|
#region localdata
|
||||||
public XtraFlgs BaseXtraFlags; // used to set up all flags for the Base format.
|
public XtraFlgs BaseXtraFlags; // used to set up all flags for the Base format.
|
||||||
@ -1499,7 +1541,7 @@ namespace fmtxml
|
|||||||
BuildDictionaryText();
|
BuildDictionaryText();
|
||||||
fmtName = alias;
|
fmtName = alias;
|
||||||
//if (fmtName.ToUpper() != "CPLS" && fmtName.ToUpper() != "BASE") return;
|
//if (fmtName.ToUpper() != "CPLS" && fmtName.ToUpper() != "BASE") return;
|
||||||
//if (fmtName.ToUpper() != "OHLP" && fmtName.ToUpper() != "BASE") return;
|
//if (fmtName.ToUpper() != "HLP" && fmtName.ToUpper() != "BASE") return;
|
||||||
//if (fmtName.ToUpper() != "AEP" && fmtName.ToUpper() != "BASE") return;
|
//if (fmtName.ToUpper() != "AEP" && fmtName.ToUpper() != "BASE") return;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -2095,9 +2137,7 @@ namespace fmtxml
|
|||||||
fmtdata.TPL = FixXmlString(File.ReadAllText(otherfile));
|
fmtdata.TPL = FixXmlString(File.ReadAllText(otherfile));
|
||||||
// http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char
|
// http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char
|
||||||
otherfile = MyPath + @"\" + fname.Substring(0, fname.LastIndexOf(".")) + @".ini";
|
otherfile = MyPath + @"\" + fname.Substring(0, fname.LastIndexOf(".")) + @".ini";
|
||||||
if (File.Exists(otherfile))
|
if (File.Exists(otherfile)) PsiIniToXml(ref fmtdata, otherfile);
|
||||||
fmtdata.PSI = File.ReadAllText(otherfile);
|
|
||||||
|
|
||||||
fmtdata.PurchaseOptions = ((E_PurchaseOptions)brFmt.ReadInt16()).ToString();
|
fmtdata.PurchaseOptions = ((E_PurchaseOptions)brFmt.ReadInt16()).ToString();
|
||||||
fmtdata.ProcData.ProcForeColor = "Black";
|
fmtdata.ProcData.ProcForeColor = "Black";
|
||||||
fmtdata.ProcData.ProcBackColor = "White";
|
fmtdata.ProcData.ProcBackColor = "White";
|
||||||
@ -2983,7 +3023,7 @@ namespace fmtxml
|
|||||||
|
|
||||||
indx = offset[arcnt];
|
indx = offset[arcnt];
|
||||||
arcnt++;
|
arcnt++;
|
||||||
if (indx > 0) fmtdata.ProcData.PSInfFile = GetStringFromByte(input, indx);
|
if (indx > 0) tmpstr = GetStringFromByte(input, indx);
|
||||||
|
|
||||||
// not used - RNOPreSeqTab[9][2]
|
// not used - RNOPreSeqTab[9][2]
|
||||||
arcnt = arcnt + 18;
|
arcnt = arcnt + 18;
|
||||||
@ -4571,7 +4611,6 @@ namespace fmtxml
|
|||||||
#region COMPAREACTIVE
|
#region COMPAREACTIVE
|
||||||
subFmt.FontData = FixInheritedFont(subFmt.FontData, mainFmt.FontData); // Phase 10
|
subFmt.FontData = FixInheritedFont(subFmt.FontData, mainFmt.FontData); // Phase 10
|
||||||
if (mainFmt.PurchaseOptions == subFmt.PurchaseOptions) subFmt.PurchaseOptions = null;
|
if (mainFmt.PurchaseOptions == subFmt.PurchaseOptions) subFmt.PurchaseOptions = null;
|
||||||
if (mainFmt.PSI == subFmt.PSI) subFmt.PSI = null;
|
|
||||||
if (mainFmt.TPL == subFmt.TPL) subFmt.TPL = null;
|
if (mainFmt.TPL == subFmt.TPL) subFmt.TPL = null;
|
||||||
if (mainFmt.EditData.EMode == subFmt.EditData.EMode) subFmt.EditData.EMode = null;
|
if (mainFmt.EditData.EMode == subFmt.EditData.EMode) subFmt.EditData.EMode = null;
|
||||||
if (mainFmt.EditData.PromptForCautionType != null && mainFmt.EditData.PromptForCautionType == subFmt.EditData.PromptForCautionType) subFmt.EditData.PromptForCautionType = "null";
|
if (mainFmt.EditData.PromptForCautionType != null && mainFmt.EditData.PromptForCautionType == subFmt.EditData.PromptForCautionType) subFmt.EditData.PromptForCautionType = "null";
|
||||||
@ -5002,7 +5041,6 @@ namespace fmtxml
|
|||||||
for (int i = 0; i < MAXCHKHEADINGS; i++)
|
for (int i = 0; i < MAXCHKHEADINGS; i++)
|
||||||
if (mco.CheckOffHeaderList[i].CheckOffHeading == sco.CheckOffHeaderList[i].CheckOffHeading) subFmt.ProcData.CheckOffData.CheckOffHeaderList[i].CheckOffHeading = null;
|
if (mco.CheckOffHeaderList[i].CheckOffHeading == sco.CheckOffHeaderList[i].CheckOffHeading) subFmt.ProcData.CheckOffData.CheckOffHeaderList[i].CheckOffHeading = null;
|
||||||
|
|
||||||
if (mainFmt.ProcData.PSInfFile == subFmt.ProcData.PSInfFile) subFmt.ProcData.PSInfFile = null;
|
|
||||||
if (msctpr.HLStpSeparatorString == ssctpr.HLStpSeparatorString) subFmt.SectData.StepSectionData.StpSectPrtData.HLStpSeparatorString = null;
|
if (msctpr.HLStpSeparatorString == ssctpr.HLStpSeparatorString) subFmt.SectData.StepSectionData.StpSectPrtData.HLStpSeparatorString = null;
|
||||||
if (msctpr.HLRNOStpSeparatorString == ssctpr.HLRNOStpSeparatorString) subFmt.SectData.StepSectionData.StpSectPrtData.HLRNOStpSeparatorString = null;
|
if (msctpr.HLRNOStpSeparatorString == ssctpr.HLRNOStpSeparatorString) subFmt.SectData.StepSectionData.StpSectPrtData.HLRNOStpSeparatorString = null;
|
||||||
if (msctpr.LowerCaseRevNum != null && msctpr.LowerCaseRevNum == ssctpr.LowerCaseRevNum) subFmt.SectData.StepSectionData.StpSectPrtData.LowerCaseRevNum = "null";
|
if (msctpr.LowerCaseRevNum != null && msctpr.LowerCaseRevNum == ssctpr.LowerCaseRevNum) subFmt.SectData.StepSectionData.StpSectPrtData.LowerCaseRevNum = "null";
|
||||||
|
162
PROMS/fmtxml/PSI.cs
Normal file
162
PROMS/fmtxml/PSI.cs
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
namespace fmtxml
|
||||||
|
{
|
||||||
|
public partial class FmtFileToXml
|
||||||
|
{
|
||||||
|
private bool _DoingFields = false;
|
||||||
|
private int NumBoxes = 0;
|
||||||
|
private int NumTexts = 0;
|
||||||
|
private int NumFields = 0;
|
||||||
|
private int CountForLists = 0;
|
||||||
|
public void PsiIniToXml(ref FormatData fmtdata, string path)
|
||||||
|
{
|
||||||
|
string sLine;
|
||||||
|
|
||||||
|
StreamReader myReader = new StreamReader(path);// Open file
|
||||||
|
while ((sLine = myReader.ReadLine()) != null)// read line-by-line
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (sLine.Length > 0)
|
||||||
|
{
|
||||||
|
switch (sLine.Substring(0, 1))
|
||||||
|
{
|
||||||
|
case "[":
|
||||||
|
if (sLine.Contains("[OBJECT COUNT]"))
|
||||||
|
{
|
||||||
|
// read in the count of objects - these may not be in order, fix this:
|
||||||
|
sLine = myReader.ReadLine();
|
||||||
|
int indx = sLine.IndexOf("=");
|
||||||
|
string tmp = sLine.Substring(indx + 1, sLine.Length - indx - 1);
|
||||||
|
NumBoxes = Convert.ToInt32(tmp);
|
||||||
|
sLine = myReader.ReadLine();
|
||||||
|
indx = sLine.IndexOf("=");
|
||||||
|
tmp = sLine.Substring(indx + 1, sLine.Length -indx - 1);
|
||||||
|
NumTexts = Convert.ToInt32(tmp);
|
||||||
|
sLine = myReader.ReadLine();
|
||||||
|
indx = sLine.IndexOf("=");
|
||||||
|
tmp = sLine.Substring(indx + 1, sLine.Length -indx - 1);
|
||||||
|
NumFields = Convert.ToInt32(tmp);
|
||||||
|
fmtdata.ProcData.Psi.Boxes = new PsiBox[NumBoxes];
|
||||||
|
fmtdata.ProcData.Psi.Labels = new PsiLabel[NumTexts];
|
||||||
|
fmtdata.ProcData.Psi.Fields = new PsiField[NumFields];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (sLine.Contains("[DIALOG]") || sLine.Contains("[BOXES]") || sLine.Contains("[TEXT]") || sLine.Contains("[FIELDS]"))
|
||||||
|
{
|
||||||
|
_DoingFields = sLine.Contains("[FIELDS]");
|
||||||
|
CountForLists = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ";":
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (sLine.IndexOf("=") >= 0)
|
||||||
|
{
|
||||||
|
AddParam(ref fmtdata, sLine);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(string.Format("error parsing .INI file: {0}, message: {1}", path, ex.Message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myReader.Close();
|
||||||
|
}
|
||||||
|
private void AddParam(ref FormatData fmtdata, string sParam)
|
||||||
|
{
|
||||||
|
int i = sParam.IndexOf("=");
|
||||||
|
string attrname = sParam.Substring(0, i);
|
||||||
|
if (attrname.Contains("SIZE"))
|
||||||
|
{
|
||||||
|
int end = (sParam.IndexOf(";") > -1) ? sParam.IndexOf(";") : sParam.Length;
|
||||||
|
string sb = sParam.Substring(i + 1, end - i - 1);
|
||||||
|
string[] split = sb.Split(new char[] { ',' });
|
||||||
|
fmtdata.ProcData.Psi.x = Convert.ToInt32(split[0].Trim());
|
||||||
|
fmtdata.ProcData.Psi.y = Convert.ToInt32(split[1].Trim());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (attrname.Contains("FONT"))
|
||||||
|
{
|
||||||
|
int end = (sParam.IndexOf(";") > -1) ? sParam.IndexOf(";") : sParam.Length;
|
||||||
|
string sb = sParam.Substring(i + 1, end - i - 1);
|
||||||
|
string[] split = sb.Split(new char[] { ',' });
|
||||||
|
fmtdata.ProcData.Psi.font = split[0].Trim();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (attrname.Contains("CAPTION"))
|
||||||
|
{
|
||||||
|
int end = (sParam.IndexOf(";") > -1) ? sParam.IndexOf(";") : sParam.Length;
|
||||||
|
fmtdata.ProcData.Psi.Caption = sParam.Substring(i + 1, end-i-1).Replace("\"","");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (attrname.Contains("BUTTONSONBOTTOM"))
|
||||||
|
{
|
||||||
|
int end = (sParam.IndexOf(";") > -1) ? sParam.IndexOf(";") : sParam.Length;
|
||||||
|
fmtdata.ProcData.Psi.ButtonsOnBottom = sParam.Substring(i + 1, end - i - 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (attrname.Contains("BOX"))
|
||||||
|
{
|
||||||
|
//<Box style="BLACKFRAME" x="4" y="4" width="192" height="112"/>
|
||||||
|
int end = (sParam.IndexOf(";") > -1) ? sParam.IndexOf(";") : sParam.Length;
|
||||||
|
string sb = sParam.Substring(i + 1, end - i - 1);
|
||||||
|
string[] split = sb.Split(new char[] { ',' });
|
||||||
|
fmtdata.ProcData.Psi.Boxes[CountForLists].style = split[0].Trim();
|
||||||
|
fmtdata.ProcData.Psi.Boxes[CountForLists].x = Convert.ToInt32(split[1].Trim());
|
||||||
|
fmtdata.ProcData.Psi.Boxes[CountForLists].y = Convert.ToInt32(split[2].Trim());
|
||||||
|
fmtdata.ProcData.Psi.Boxes[CountForLists].width = Convert.ToInt32(split[3].Trim());
|
||||||
|
fmtdata.ProcData.Psi.Boxes[CountForLists].height = Convert.ToInt32(split[4].Trim());
|
||||||
|
CountForLists++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (attrname.Contains("TEXT"))
|
||||||
|
{
|
||||||
|
//<Label text="Responsible Manager's Title:" Justify="LEFT" x="12" y="11" width="100" height="8" />
|
||||||
|
int end = (sParam.IndexOf(";") > -1) ? sParam.IndexOf(";") : sParam.Length;
|
||||||
|
string sb = sParam.Substring(i + 1, end - i - 1);
|
||||||
|
string[] split = sb.Split(new char[] { ',' });
|
||||||
|
fmtdata.ProcData.Psi.Labels[CountForLists].text = split[0].Trim();
|
||||||
|
fmtdata.ProcData.Psi.Labels[CountForLists].Justify = split[1].Trim();
|
||||||
|
fmtdata.ProcData.Psi.Labels[CountForLists].x = Convert.ToInt32(split[2].Trim());
|
||||||
|
fmtdata.ProcData.Psi.Labels[CountForLists].y = Convert.ToInt32(split[3].Trim());
|
||||||
|
fmtdata.ProcData.Psi.Labels[CountForLists].width = Convert.ToInt32(split[4].Trim());
|
||||||
|
fmtdata.ProcData.Psi.Labels[CountForLists].height = Convert.ToInt32(split[5].Trim());
|
||||||
|
CountForLists++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_DoingFields)
|
||||||
|
{
|
||||||
|
//<Field type="TEXT" name="CLASSIFICATION" length="51" x="12" y="20" width="180" height="12" />
|
||||||
|
//<Field type ="LOGICAL" name="USESETID" text="Some optional text" x="12" y="20" />
|
||||||
|
|
||||||
|
int end = (sParam.IndexOf(";") > -1) ? sParam.IndexOf(";") : sParam.Length;
|
||||||
|
string sb = sParam.Substring(i + 1, end - i - 1);
|
||||||
|
string[] split = sb.Split(new char[] { ',' });
|
||||||
|
// first check whether it is a text field or a logical (checkbox) field:
|
||||||
|
fmtdata.ProcData.Psi.Fields[CountForLists].name = attrname;
|
||||||
|
fmtdata.ProcData.Psi.Fields[CountForLists].type = split[0].Trim();
|
||||||
|
string typ = fmtdata.ProcData.Psi.Fields[CountForLists].type;
|
||||||
|
fmtdata.ProcData.Psi.Fields[CountForLists].text = split[1] == null ? null : split[1].Trim();
|
||||||
|
if (typ.ToUpper() == "TEXT")
|
||||||
|
fmtdata.ProcData.Psi.Fields[CountForLists].Length = Convert.ToInt32(split[2].Trim());
|
||||||
|
else
|
||||||
|
fmtdata.ProcData.Psi.Fields[CountForLists].Length = 0;
|
||||||
|
fmtdata.ProcData.Psi.Fields[CountForLists].x = Convert.ToInt32(split[3].Trim());
|
||||||
|
fmtdata.ProcData.Psi.Fields[CountForLists].y = Convert.ToInt32(split[4].Trim());
|
||||||
|
fmtdata.ProcData.Psi.Fields[CountForLists].width = Convert.ToInt32(split[5].Trim());
|
||||||
|
fmtdata.ProcData.Psi.Fields[CountForLists].height = Convert.ToInt32(split[6].Trim());
|
||||||
|
CountForLists++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user