Synch move-fields to cvs-file editable in excell...

This commit is contained in:
2015-01-14 16:13:12 +01:00
parent b935eb08f2
commit bc880ed2ed
6 changed files with 247 additions and 28 deletions

View File

@ -43,8 +43,10 @@ namespace CobXmlSupport
public string LocalKey { get; set; } public string LocalKey { get; set; }
public string SampleStr { get; set; } public string SampleStr { get; set; }
public string MoveCode { get; set; }
//Holding code-parts used when generating moves, to and from structure
//Could be a Variable, simple or qualified, could be retreival code.
//Will replace "MOVE " when generating move sequences
public string FieldName public string FieldName
{ {

View File

@ -64,6 +64,7 @@
this.chkAttribs = new System.Windows.Forms.CheckBox(); this.chkAttribs = new System.Windows.Forms.CheckBox();
this.btnTestThings = new System.Windows.Forms.Button(); this.btnTestThings = new System.Windows.Forms.Button();
this.btnFrXMLTo = new System.Windows.Forms.Button(); this.btnFrXMLTo = new System.Windows.Forms.Button();
this.btnCrossref = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// button1 // button1
@ -85,7 +86,7 @@
this.outText.Multiline = true; this.outText.Multiline = true;
this.outText.Name = "outText"; this.outText.Name = "outText";
this.outText.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.outText.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.outText.Size = new System.Drawing.Size(380, 496); this.outText.Size = new System.Drawing.Size(380, 480);
this.outText.TabIndex = 1; this.outText.TabIndex = 1;
this.outText.WordWrap = false; this.outText.WordWrap = false;
// //
@ -99,7 +100,7 @@
this.outCob.Multiline = true; this.outCob.Multiline = true;
this.outCob.Name = "outCob"; this.outCob.Name = "outCob";
this.outCob.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.outCob.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.outCob.Size = new System.Drawing.Size(533, 496); this.outCob.Size = new System.Drawing.Size(533, 480);
this.outCob.TabIndex = 2; this.outCob.TabIndex = 2;
this.outCob.WordWrap = false; this.outCob.WordWrap = false;
this.outCob.KeyDown += new System.Windows.Forms.KeyEventHandler(this.outCob_KeyDown); this.outCob.KeyDown += new System.Windows.Forms.KeyEventHandler(this.outCob_KeyDown);
@ -127,7 +128,7 @@
// btnClose // btnClose
// //
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.Location = new System.Drawing.Point(864, 632); this.btnClose.Location = new System.Drawing.Point(864, 639);
this.btnClose.Name = "btnClose"; this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(75, 23); this.btnClose.Size = new System.Drawing.Size(75, 23);
this.btnClose.TabIndex = 6; this.btnClose.TabIndex = 6;
@ -190,7 +191,7 @@
// //
this.btnGenICode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnGenICode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnGenICode.Enabled = false; this.btnGenICode.Enabled = false;
this.btnGenICode.Location = new System.Drawing.Point(411, 632); this.btnGenICode.Location = new System.Drawing.Point(410, 616);
this.btnGenICode.Margin = new System.Windows.Forms.Padding(2); this.btnGenICode.Margin = new System.Windows.Forms.Padding(2);
this.btnGenICode.Name = "btnGenICode"; this.btnGenICode.Name = "btnGenICode";
this.btnGenICode.Size = new System.Drawing.Size(81, 23); this.btnGenICode.Size = new System.Drawing.Size(81, 23);
@ -215,7 +216,7 @@
// //
this.btnMoves.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnMoves.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnMoves.Enabled = false; this.btnMoves.Enabled = false;
this.btnMoves.Location = new System.Drawing.Point(496, 632); this.btnMoves.Location = new System.Drawing.Point(495, 616);
this.btnMoves.Margin = new System.Windows.Forms.Padding(2); this.btnMoves.Margin = new System.Windows.Forms.Padding(2);
this.btnMoves.Name = "btnMoves"; this.btnMoves.Name = "btnMoves";
this.btnMoves.Size = new System.Drawing.Size(93, 23); this.btnMoves.Size = new System.Drawing.Size(93, 23);
@ -242,7 +243,7 @@
// //
this.btnMoveFrom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnMoveFrom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnMoveFrom.Enabled = false; this.btnMoveFrom.Enabled = false;
this.btnMoveFrom.Location = new System.Drawing.Point(673, 632); this.btnMoveFrom.Location = new System.Drawing.Point(672, 616);
this.btnMoveFrom.Name = "btnMoveFrom"; this.btnMoveFrom.Name = "btnMoveFrom";
this.btnMoveFrom.Size = new System.Drawing.Size(92, 23); this.btnMoveFrom.Size = new System.Drawing.Size(92, 23);
this.btnMoveFrom.TabIndex = 16; this.btnMoveFrom.TabIndex = 16;
@ -296,7 +297,7 @@
this.chkDisplays.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkDisplays.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkDisplays.AutoSize = true; this.chkDisplays.AutoSize = true;
this.chkDisplays.Enabled = false; this.chkDisplays.Enabled = false;
this.chkDisplays.Location = new System.Drawing.Point(771, 644); this.chkDisplays.Location = new System.Drawing.Point(770, 628);
this.chkDisplays.Name = "chkDisplays"; this.chkDisplays.Name = "chkDisplays";
this.chkDisplays.Size = new System.Drawing.Size(71, 17); this.chkDisplays.Size = new System.Drawing.Size(71, 17);
this.chkDisplays.TabIndex = 21; this.chkDisplays.TabIndex = 21;
@ -347,7 +348,7 @@
// btnSettings // btnSettings
// //
this.btnSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnSettings.Location = new System.Drawing.Point(20, 655); this.btnSettings.Location = new System.Drawing.Point(20, 616);
this.btnSettings.Margin = new System.Windows.Forms.Padding(2); this.btnSettings.Margin = new System.Windows.Forms.Padding(2);
this.btnSettings.Name = "btnSettings"; this.btnSettings.Name = "btnSettings";
this.btnSettings.Size = new System.Drawing.Size(81, 23); this.btnSettings.Size = new System.Drawing.Size(81, 23);
@ -360,7 +361,7 @@
// //
this.chkPerform.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkPerform.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkPerform.AutoSize = true; this.chkPerform.AutoSize = true;
this.chkPerform.Location = new System.Drawing.Point(594, 627); this.chkPerform.Location = new System.Drawing.Point(593, 611);
this.chkPerform.Name = "chkPerform"; this.chkPerform.Name = "chkPerform";
this.chkPerform.Size = new System.Drawing.Size(62, 17); this.chkPerform.Size = new System.Drawing.Size(62, 17);
this.chkPerform.TabIndex = 27; this.chkPerform.TabIndex = 27;
@ -371,7 +372,7 @@
// //
this.chkMvToDisp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkMvToDisp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkMvToDisp.AutoSize = true; this.chkMvToDisp.AutoSize = true;
this.chkMvToDisp.Location = new System.Drawing.Point(594, 644); this.chkMvToDisp.Location = new System.Drawing.Point(593, 628);
this.chkMvToDisp.Name = "chkMvToDisp"; this.chkMvToDisp.Name = "chkMvToDisp";
this.chkMvToDisp.Size = new System.Drawing.Size(71, 17); this.chkMvToDisp.Size = new System.Drawing.Size(71, 17);
this.chkMvToDisp.TabIndex = 28; this.chkMvToDisp.TabIndex = 28;
@ -382,7 +383,7 @@
// //
this.chkNewArea.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkNewArea.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkNewArea.AutoSize = true; this.chkNewArea.AutoSize = true;
this.chkNewArea.Location = new System.Drawing.Point(771, 627); this.chkNewArea.Location = new System.Drawing.Point(770, 611);
this.chkNewArea.Name = "chkNewArea"; this.chkNewArea.Name = "chkNewArea";
this.chkNewArea.Size = new System.Drawing.Size(64, 17); this.chkNewArea.Size = new System.Drawing.Size(64, 17);
this.chkNewArea.TabIndex = 29; this.chkNewArea.TabIndex = 29;
@ -412,7 +413,7 @@
// //
this.chkAttribs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkAttribs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkAttribs.AutoSize = true; this.chkAttribs.AutoSize = true;
this.chkAttribs.Location = new System.Drawing.Point(771, 660); this.chkAttribs.Location = new System.Drawing.Point(770, 644);
this.chkAttribs.Name = "chkAttribs"; this.chkAttribs.Name = "chkAttribs";
this.chkAttribs.Size = new System.Drawing.Size(85, 17); this.chkAttribs.Size = new System.Drawing.Size(85, 17);
this.chkAttribs.TabIndex = 32; this.chkAttribs.TabIndex = 32;
@ -423,7 +424,7 @@
// btnTestThings // btnTestThings
// //
this.btnTestThings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnTestThings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnTestThings.Location = new System.Drawing.Point(20, 632); this.btnTestThings.Location = new System.Drawing.Point(21, 639);
this.btnTestThings.Name = "btnTestThings"; this.btnTestThings.Name = "btnTestThings";
this.btnTestThings.Size = new System.Drawing.Size(81, 23); this.btnTestThings.Size = new System.Drawing.Size(81, 23);
this.btnTestThings.TabIndex = 33; this.btnTestThings.TabIndex = 33;
@ -434,7 +435,7 @@
// btnFrXMLTo // btnFrXMLTo
// //
this.btnFrXMLTo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnFrXMLTo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnFrXMLTo.Location = new System.Drawing.Point(673, 655); this.btnFrXMLTo.Location = new System.Drawing.Point(672, 639);
this.btnFrXMLTo.Name = "btnFrXMLTo"; this.btnFrXMLTo.Name = "btnFrXMLTo";
this.btnFrXMLTo.Size = new System.Drawing.Size(92, 22); this.btnFrXMLTo.Size = new System.Drawing.Size(92, 22);
this.btnFrXMLTo.TabIndex = 34; this.btnFrXMLTo.TabIndex = 34;
@ -442,11 +443,23 @@
this.btnFrXMLTo.UseVisualStyleBackColor = true; this.btnFrXMLTo.UseVisualStyleBackColor = true;
this.btnFrXMLTo.Click += new System.EventHandler(this.btnFrXMLTo_Click); this.btnFrXMLTo.Click += new System.EventHandler(this.btnFrXMLTo_Click);
// //
// btnCrossref
//
this.btnCrossref.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnCrossref.Location = new System.Drawing.Point(21, 662);
this.btnCrossref.Name = "btnCrossref";
this.btnCrossref.Size = new System.Drawing.Size(81, 23);
this.btnCrossref.TabIndex = 35;
this.btnCrossref.Text = "CrossRef";
this.btnCrossref.UseVisualStyleBackColor = true;
this.btnCrossref.Click += new System.EventHandler(this.btnCrossref_Click);
//
// GenCobCode // GenCobCode
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(951, 686); this.ClientSize = new System.Drawing.Size(951, 693);
this.Controls.Add(this.btnCrossref);
this.Controls.Add(this.btnFrXMLTo); this.Controls.Add(this.btnFrXMLTo);
this.Controls.Add(this.btnTestThings); this.Controls.Add(this.btnTestThings);
this.Controls.Add(this.chkAttribs); this.Controls.Add(this.chkAttribs);
@ -528,6 +541,7 @@
private System.Windows.Forms.CheckBox chkAttribs; private System.Windows.Forms.CheckBox chkAttribs;
private System.Windows.Forms.Button btnTestThings; private System.Windows.Forms.Button btnTestThings;
private System.Windows.Forms.Button btnFrXMLTo; private System.Windows.Forms.Button btnFrXMLTo;
private System.Windows.Forms.Button btnCrossref;
} }
} }

View File

@ -48,9 +48,19 @@ namespace CobXmlSupport
//private string SettingLogSectName; //private string SettingLogSectName;
////------------------------- ////-------------------------
private readonly string NOMOVE = "NoMove"; public readonly string NOMOVE = "NoMove";
private readonly bool MOVEFROM = true; private readonly bool MOVEFROM = true;
public List<CobRow> RowList
{
get { return rowList; }
}
public System.Windows.Forms.ComboBox CmbLastFile
{
get { return cmbLastFile; }
}
public GenCobCode() public GenCobCode()
{ {
InitializeComponent(); InitializeComponent();
@ -841,7 +851,7 @@ namespace CobXmlSupport
/// <param name="typeComm"></param> /// <param name="typeComm"></param>
/// <param name="Author"></param> /// <param name="Author"></param>
/// <param name="Firm"></param> /// <param name="Firm"></param>
private void CreateComment(TextBox outView, string typeComm, string Author, string Firm, string sourceFile = "") public void CreateComment(TextBox outView, string typeComm, string Author, string Firm, string sourceFile = "")
{ {
outView.Text = " *----------------------------------------------------------------*"; outView.Text = " *----------------------------------------------------------------*";
centeredComment(outView, typeComm.ToUpper()); centeredComment(outView, typeComm.ToUpper());
@ -1852,5 +1862,42 @@ namespace CobXmlSupport
} }
} }
private void btnCrossref_Click(object sender, EventArgs e)
{
//Create showing window
fromToMoves = new ShowCode();
fromToMoves.Parent = this;
fromToMoves.Labeltext = "Cobol \"CrossRef\" List";
foreach (CobRow cr in rowList)
{
if (cr.CobLevel < 2)
{
string inFile = cmbLastFile.Text.Substring(cmbLastFile.Text.LastIndexOf("\\") + 1);
CreateComment(fromToMoves.CodeShower, "Moves reference (with loop) " + cr.FieldName, S.ettingUserName, S.ettingCompany, inFile);
}
// Header square created
if (!cr.isAttribute && !cr.SampleStr.Equals(NOMOVE))
{
if (fromToMoves.CodeShower.Text == "") { }
else fromToMoves.CodeShower.Text += "\r\n";
if (cr.MoveCode == null)
{
fromToMoves.CodeShower.Text += "".PadRight(30) + " " + cr.FieldName.PadRight(30);
}
else
{
fromToMoves.CodeShower.Text += cr.MoveCode.PadRight(30) + " " + cr.FieldName.PadRight(30);
}
}
}
fromToMoves.Show();
}
} }
} }

View File

@ -120,6 +120,9 @@
<metadata name="openFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="openFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>78</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>

View File

@ -32,6 +32,7 @@
this.btnClose = new System.Windows.Forms.Button(); this.btnClose = new System.Windows.Forms.Button();
this.txtCode = new System.Windows.Forms.TextBox(); this.txtCode = new System.Windows.Forms.TextBox();
this.lblCodeType = new System.Windows.Forms.Label(); this.lblCodeType = new System.Windows.Forms.Label();
this.btnSynch = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// btnClose // btnClose
@ -73,11 +74,23 @@
this.lblCodeType.TabIndex = 2; this.lblCodeType.TabIndex = 2;
this.lblCodeType.Text = "<codeType>"; this.lblCodeType.Text = "<codeType>";
// //
// btnSynch
//
this.btnSynch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSynch.Location = new System.Drawing.Point(504, 642);
this.btnSynch.Name = "btnSynch";
this.btnSynch.Size = new System.Drawing.Size(95, 23);
this.btnSynch.TabIndex = 3;
this.btnSynch.Text = "Synch Moves";
this.btnSynch.UseVisualStyleBackColor = true;
this.btnSynch.Click += new System.EventHandler(this.btnSynch_Click);
//
// ShowCode // ShowCode
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(670, 674); this.ClientSize = new System.Drawing.Size(670, 674);
this.Controls.Add(this.btnSynch);
this.Controls.Add(this.lblCodeType); this.Controls.Add(this.lblCodeType);
this.Controls.Add(this.txtCode); this.Controls.Add(this.txtCode);
this.Controls.Add(this.btnClose); this.Controls.Add(this.btnClose);
@ -95,5 +108,6 @@
private System.Windows.Forms.Button btnClose; private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.TextBox txtCode; private System.Windows.Forms.TextBox txtCode;
private System.Windows.Forms.Label lblCodeType; private System.Windows.Forms.Label lblCodeType;
private System.Windows.Forms.Button btnSynch;
} }
} }

View File

@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
namespace CobXmlSupport namespace CobXmlSupport
@ -66,7 +67,145 @@ namespace CobXmlSupport
} }
} }
private void btnSynch_Click(object sender, EventArgs e)
{
Dictionary<string, string> wrkDic = null;
string codeComplement = "", fieldCompl = "", codeComplInit = "";
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";
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))
{
codeComplement = File.ReadAllText(inPath + codeFile);
}
if (codeComplement.Length > 0)
{
wrkDic = moveFieldDictionary(codeComplement);
}
foreach (CobRow cr in parentWindow.RowList)
{
if (!cr.isAttribute && !cr.SampleStr.Equals(parentWindow.NOMOVE))
{
if (wrkDic != null && wrkDic.Count > 0)
{
if (wrkDic.TryGetValue(cr.FieldName, out fieldCompl))
{
cr.MoveCode = deQuote( fieldCompl);
}
}
if (cr.MoveCode == null)
codeComplInit += cr.FieldName + "\t" + " \r\n";
else
codeComplInit += cr.FieldName + "\t" + enQuote( cr.MoveCode.Replace("\r\n", "\n")) + "\r\n";
}
}
string backupfile = inPath + inFile.Substring(0, inFile.LastIndexOf(".")) + "." +
(DateTime.Now.Year-2000).ToString("00") +
DateTime.Now.Month.ToString("00") +
DateTime.Now.Day.ToString("00") + "T"+
DateTime.Now.Hour.ToString("00") +
DateTime.Now.Minute.ToString("00") +
DateTime.Now.Second.ToString("00") + ".cvs";
File.Move(inPath + codeFile, backupfile );//+ DateTime.Now.ToString());
File.WriteAllText(inPath + codeFile, codeComplInit);
refreshWindow();
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;
}
private string deQuote(string inString)
{
string tmpStr = "";
char[] x = inString.ToArray<char>();
for (int i = 0; i < x.Length; i++)
{
if (x[i] == '\"')
{
if (i < x.Length - 1)
{
if (x[i + 1] == '\"')
{
i++;
tmpStr += "\"";
}
}
}
else tmpStr += x[i];
}
return tmpStr;
}
private string enQuote(string inString)
{
string tmpStr = "";
char[] x = inString.ToArray<char>();
for (int i = 0; i < x.Length; i++)
{
if (x[i] == '\"')
{
{
tmpStr += "\"\"";
}
}
else tmpStr += x[i];
}
return "\""+tmpStr+"\"";
}
private Dictionary<string, string> moveFieldDictionary(string inFil)
{
Dictionary<string, string> tmpDic = new Dictionary<string, string>();
string[] splits = { "\r\n" };
string[] itemPairs = inFil.Split(splits, StringSplitOptions.RemoveEmptyEntries);
char[] newSplits = { '\t' };
foreach (string itemPair in itemPairs)
{
string[] items = itemPair.Split(newSplits);
tmpDic.Add(items[0], items[1].Replace("\n", "\r\n"));
}
return tmpDic;
}
private void refreshWindow()
{
this.CodeShower.Text = "";
foreach (CobRow cr in parentWindow.RowList)
{
if (cr.CobLevel < 2)
{
string inFile = parentWindow.CmbLastFile.Text.Substring(parentWindow.CmbLastFile.Text.LastIndexOf("\\") + 1);
parentWindow.CreateComment(this.CodeShower, "Moves reference (with loop) " + cr.FieldName, S.ettingUserName, S.ettingCompany, inFile);
}
// Header square created
if (!cr.isAttribute && !cr.SampleStr.Equals(parentWindow.NOMOVE))
{
if (this.CodeShower.Text == "") { }
else this.CodeShower.Text += "\r\n";
if (cr.MoveCode == null)
{
this.CodeShower.Text += "".PadRight(30) + " " + cr.FieldName.PadRight(30);
}
else
{
this.CodeShower.Text += cr.MoveCode.PadRight(30) + " " + cr.FieldName.PadRight(30);
}
}
}
}