From ddca2f7929b8dec53c3713a93bfc3d66198feeba Mon Sep 17 00:00:00 2001 From: tfoman Date: Mon, 19 Jan 2015 15:24:38 +0100 Subject: [PATCH] Changed to .csv files for saving --- CobXmlSupport/GenCobCode.cs | 78 ++++++++++++++++++++++-------- CobXmlSupport/ShowCode.Designer.cs | 1 + CobXmlSupport/ShowCode.cs | 27 +++++++++-- 3 files changed, 80 insertions(+), 26 deletions(-) diff --git a/CobXmlSupport/GenCobCode.cs b/CobXmlSupport/GenCobCode.cs index 3f98732..92b48e1 100644 --- a/CobXmlSupport/GenCobCode.cs +++ b/CobXmlSupport/GenCobCode.cs @@ -1191,10 +1191,10 @@ namespace CobXmlSupport genExtMoves.CodeShower.Text += "\r\n MOVE "; - if (cr.MoveCode.Trim().Length != 0) - genExtMoves.CodeShower.Text += "1"; - else + if (cr.MoveCode == null || cr.MoveCode.Trim().Length < 1) genExtMoves.CodeShower.Text += "0"; + else + genExtMoves.CodeShower.Text += "1"; genExtMoves.CodeShower.Text += " TO " + cr.CountIn; @@ -1215,31 +1215,60 @@ namespace CobXmlSupport CobRow crTmp = cr; struktMove += "\r\n " + "".PadLeft(prfNiv) + " <" + cr.TagName.Replace("\"", "") + "> (" + cr.FieldName + ")"; - genExtMoves.CodeShower.Text += "\r\n " + adjustIf(adj); + genExtMoves.CodeShower.Text += "\r\n"; //" " + adjustIf(adj); //------------- move from -------------- - if (cr.MoveCode.Length > 1 && cr.MoveCode != " ") + + //---------------- Changed + //if (cr.MoveCode.Length > 1 && cr.MoveCode != " ") + if (cr.MoveCode==null || cr.MoveCode.Trim() == "") + { + if (cr.FieldDef.ToUpper().IndexOf("X") > -1) + { + genExtMoves.CodeShower.Text += " " + adjustIf(adj) + "MOVE MoveToStringVar "; + } + else + { + genExtMoves.CodeShower.Text += " " + adjustIf(adj) + "MOVE MoveToNumVar "; + } + genExtMoves.CodeShower.Text += " *> #" + cr.FieldName + "#"; + } + else { if (cr.MoveCode.ToUpper().Contains("MOVE") || (cr.MoveCode.ToUpper().Contains("STRING") && cr.MoveCode.ToUpper().Contains("INTO"))) { } else genExtMoves.CodeShower.Text += "MOVE "; genExtMoves.CodeShower.Text += cr.MoveCode; } - else - { - if (cr.FieldDef.ToUpper().IndexOf("X") > -1) - { - genExtMoves.CodeShower.Text += "MOVE MoveToStringVar "; - } - else - { - genExtMoves.CodeShower.Text += "MOVE MoveToNumVar "; - } - } - genExtMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + " *> #" + cr.FieldName + "#"; + + //---------------- Changed + //if (cr.MoveCode.Length > 1 && cr.MoveCode != " ") + //{ + // if (cr.MoveCode.ToUpper().Contains("MOVE") || (cr.MoveCode.ToUpper().Contains("STRING") && cr.MoveCode.ToUpper().Contains("INTO"))) { } + // else genExtMoves.CodeShower.Text += "MOVE "; + // genExtMoves.CodeShower.Text += cr.MoveCode; + //} + //else + //{ + // if (cr.FieldDef.ToUpper().IndexOf("X") > -1) + // { + // genExtMoves.CodeShower.Text += " " + adjustIf(adj)+"MOVE MoveToStringVar "; + // } + // else + // { + // genExtMoves.CodeShower.Text += " " + adjustIf(adj)+ "MOVE MoveToNumVar "; + // } + // genExtMoves.CodeShower.Text += " *> #" + cr.FieldName + "#"; + //} //------------- move to --------------- genExtMoves.CodeShower.Text += "\r\n " + adjustIf(adj); - if (cr.MoveCode.ToUpper().Contains("STRING") && cr.MoveCode.ToUpper().Contains("INTO")) {} - else genExtMoves.CodeShower.Text += "TO "; + + if (cr.MoveCode == null) + genExtMoves.CodeShower.Text += "TO "; + else + { + if (cr.MoveCode.ToUpper().Contains("STRING") && cr.MoveCode.ToUpper().Contains("INTO")) { } + else genExtMoves.CodeShower.Text += "TO "; + } genExtMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + cr.FieldName; genExtMoves.CodeShower.Text = checkForOccurs(indexNames, cr, genExtMoves.CodeShower.Text, ref occParRows, ref slask, false, adj); while (crTmp.LevelParent != null) @@ -1252,8 +1281,14 @@ namespace CobXmlSupport { genExtMoves.CodeShower.Text += " (" + occParRows + " )"; } - if (cr.MoveCode.ToUpper().Contains("STRING") && cr.MoveCode.ToUpper().Contains("INTO")) { - genExtMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "END-STRING " ; + + if (cr.MoveCode == null) { } + else + { + if (cr.MoveCode.ToUpper().Contains("STRING") && cr.MoveCode.ToUpper().Contains("INTO")) + { + genExtMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "END-STRING "; + } } if (chkMvToDisp.Checked) @@ -1896,6 +1931,7 @@ namespace CobXmlSupport //Create showing window fromToMoves = new ShowCode(); fromToMoves.Parent = this; + fromToMoves.BSynch = true; fromToMoves.Labeltext = "Cobol \"CrossRef\" List"; foreach (CobRow cr in rowList) diff --git a/CobXmlSupport/ShowCode.Designer.cs b/CobXmlSupport/ShowCode.Designer.cs index 95dec67..e8617f7 100644 --- a/CobXmlSupport/ShowCode.Designer.cs +++ b/CobXmlSupport/ShowCode.Designer.cs @@ -83,6 +83,7 @@ this.btnSynch.TabIndex = 3; this.btnSynch.Text = "Synch Moves"; this.btnSynch.UseVisualStyleBackColor = true; + this.btnSynch.Visible = false; this.btnSynch.Click += new System.EventHandler(this.btnSynch_Click); // // ShowCode diff --git a/CobXmlSupport/ShowCode.cs b/CobXmlSupport/ShowCode.cs index d5531aa..fb62999 100644 --- a/CobXmlSupport/ShowCode.cs +++ b/CobXmlSupport/ShowCode.cs @@ -15,11 +15,30 @@ namespace CobXmlSupport { public partial class ShowCode : Form { + + public readonly string CSV = ".csv"; + string oldTxt; + bool bSynch; + public ShowCode() { InitializeComponent(); oldTxt = ""; + bSynch = false; + } + + public bool BSynch + { + get + { + return bSynch; + } + set + { + bSynch = value; + btnSynch.Visible = bSynch; + } } public TextBox CodeShower @@ -74,7 +93,7 @@ namespace CobXmlSupport string inFile = parentWindow.CmbLastFile.Text.Substring(parentWindow.CmbLastFile.Text.LastIndexOf("\\") + 1); string inPath = parentWindow.CmbLastFile.Text.Substring(0, parentWindow.CmbLastFile.Text.LastIndexOf("\\") + 1); - string codeFile = inFile.Substring(0, inFile.LastIndexOf(".")) + ".cvs"; + string codeFile = inFile.Substring(0, inFile.LastIndexOf(".")) + CSV; this.CodeShower.Text = " InPath = " + inPath + "\r\n InFile = " + inFile + "\r\n codeFile = " + codeFile + "\r\n codePath = " +inPath+ codeFile + "\r\n -------------- \r\n" + this.CodeShower.Text; if (File.Exists(inPath + codeFile)) @@ -116,10 +135,10 @@ namespace CobXmlSupport DateTime.Now.Day.ToString("00") + "T" + DateTime.Now.Hour.ToString("00") + DateTime.Now.Minute.ToString("00") + - DateTime.Now.Second.ToString("00") + ".cvs"; + DateTime.Now.Second.ToString("00") + CSV; } else { - backupfile = inPath + inFile.Substring(0, inFile.LastIndexOf(".")) + ".backup.cvs"; + backupfile = inPath + inFile.Substring(0, inFile.LastIndexOf(".")) + ".backup"+CSV; File.Delete(backupfile); } @@ -220,7 +239,5 @@ namespace CobXmlSupport } - - } }