This commit is contained in:
Kathy Ruffing 2011-07-14 15:52:42 +00:00
parent bf631f4021
commit 981ae7a333

View File

@ -22,7 +22,7 @@ namespace fmtxml
string str = removeComment.Replace(inStr, "");
str = removeComment1.Replace(str, "");
str = removeComment2.Replace(str, "");
return str;
return str.Trim();
}
public void PsiIniToXml(ref FormatData fmtdata, string path)
{
@ -45,17 +45,35 @@ namespace fmtxml
while(sLine.StartsWith(";")) sLine = myReader.ReadLine(); // Skip Comments
int indx = sLine.IndexOf("=");
string tmp = sLine.Substring(indx + 1, sLine.Length - indx - 1);
NumBoxes = Convert.ToInt32(RemoveComments(tmp));
if (sLine.Contains("BOXES"))
NumBoxes = tmp == "" ? 1 : Convert.ToInt32(RemoveComments(tmp)) + 1;
else if (sLine.Contains("TEXT"))
NumTexts = tmp == "" ? 1 : Convert.ToInt32(RemoveComments(tmp)) + 1;
else if (sLine.Contains("FIELDS"))
NumFields = tmp == "" ? 1 : Convert.ToInt32(RemoveComments(tmp)) + 1;
sLine = myReader.ReadLine();
while (sLine.StartsWith(";")) sLine = myReader.ReadLine(); // Skip Comments
indx = sLine.IndexOf("=");
tmp = sLine.Substring(indx + 1, sLine.Length -indx - 1);
NumTexts = Convert.ToInt32(RemoveComments(tmp));
if (sLine.Contains("BOXES"))
NumBoxes = tmp == "" ? 1 : Convert.ToInt32(RemoveComments(tmp)) + 1;
else if (sLine.Contains("TEXT"))
NumTexts = tmp == "" ? 1 : Convert.ToInt32(RemoveComments(tmp)) + 1;
else if (sLine.Contains("FIELDS"))
NumFields = tmp == "" ? 1 : Convert.ToInt32(RemoveComments(tmp)) + 1;
sLine = myReader.ReadLine();
while (sLine.StartsWith(";")) sLine = myReader.ReadLine(); // Skip Comments
indx = sLine.IndexOf("=");
tmp = sLine.Substring(indx + 1, sLine.Length -indx - 1);
NumFields = Convert.ToInt32(RemoveComments(tmp));
if (sLine.Contains("BOXES"))
NumBoxes = tmp == "" ? 1 : Convert.ToInt32(RemoveComments(tmp)) + 1;
else if (sLine.Contains("TEXT"))
NumTexts = tmp == "" ? 1 : Convert.ToInt32(RemoveComments(tmp)) + 1;
else if (sLine.Contains("FIELDS"))
NumFields = tmp == "" ? 1 : Convert.ToInt32(RemoveComments(tmp)) + 1;
if (NumBoxes == 0) NumBoxes++;
if (NumTexts == 0) NumTexts++;
if (NumFields == 0) NumFields++;
fmtdata.ProcData.Psi.Boxes = new PsiBox[NumBoxes];
fmtdata.ProcData.Psi.Labels = new PsiLabel[NumTexts];
fmtdata.ProcData.Psi.Fields = new PsiField[NumFields];
@ -70,6 +88,13 @@ namespace fmtxml
break;
case ";":
break;
case "/":
if (sLine[1] == '*') break; // if it isn't a comment, fall thru to the default.
if (sLine.IndexOf("=") >= 0)
{
AddParam(ref fmtdata, RemoveComments(sLine));
}
break;
default:
if (sLine.IndexOf("=") >= 0)
{
@ -131,11 +156,14 @@ namespace fmtxml
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());
if (CountForLists <= NumBoxes - 1)
{
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;
}