diff --git a/CobXmlSupport/App.config b/CobXmlSupport/App.config index ceeb852..b158d81 100644 --- a/CobXmlSupport/App.config +++ b/CobXmlSupport/App.config @@ -2,6 +2,7 @@ +
@@ -9,6 +10,64 @@ + + + + + @"C:\testdata\Reengineering\FD_GetVehicleHistory.xml" + + + + + Tommy Öman + + + Fordonsdata Nordic AB + + + False + + + False + + + False + + + False + + + False + + + False + + + False + + + GWM_ + + + 25 + + + False + + + Logg-post + + + UpdateLogFile + + + GWX_ + + + False + + diff --git a/CobXmlSupport/CobXmlSupport.csproj b/CobXmlSupport/CobXmlSupport.csproj index 92fa566..4b447d3 100644 --- a/CobXmlSupport/CobXmlSupport.csproj +++ b/CobXmlSupport/CobXmlSupport.csproj @@ -88,6 +88,7 @@ ShowCode.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/CobXmlSupport/GenCobCode.Designer.cs b/CobXmlSupport/GenCobCode.Designer.cs index 275dfa1..12ff59c 100644 --- a/CobXmlSupport/GenCobCode.Designer.cs +++ b/CobXmlSupport/GenCobCode.Designer.cs @@ -63,6 +63,7 @@ this.txtExpPrefix = new System.Windows.Forms.TextBox(); this.chkAttribs = new System.Windows.Forms.CheckBox(); this.btnTestThings = new System.Windows.Forms.Button(); + this.btnFrXMLTo = new System.Windows.Forms.Button(); this.SuspendLayout(); // // button1 @@ -387,6 +388,7 @@ this.chkNewArea.TabIndex = 29; this.chkNewArea.Text = "Till Area"; this.chkNewArea.UseVisualStyleBackColor = true; + this.chkNewArea.Visible = false; this.chkNewArea.CheckedChanged += new System.EventHandler(this.chkNewArea_CheckedChanged); // // label5 @@ -429,11 +431,23 @@ this.btnTestThings.UseVisualStyleBackColor = true; this.btnTestThings.Click += new System.EventHandler(this.btnTestThings_Click); // + // btnFrXMLTo + // + 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.Name = "btnFrXMLTo"; + this.btnFrXMLTo.Size = new System.Drawing.Size(92, 22); + this.btnFrXMLTo.TabIndex = 34; + this.btnFrXMLTo.Text = "Kopiera XML"; + this.btnFrXMLTo.UseVisualStyleBackColor = true; + this.btnFrXMLTo.Click += new System.EventHandler(this.btnFrXMLTo_Click); + // // GenCobCode // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(951, 686); + this.Controls.Add(this.btnFrXMLTo); this.Controls.Add(this.btnTestThings); this.Controls.Add(this.chkAttribs); this.Controls.Add(this.txtExpPrefix); @@ -513,6 +527,7 @@ private System.Windows.Forms.TextBox txtExpPrefix; private System.Windows.Forms.CheckBox chkAttribs; private System.Windows.Forms.Button btnTestThings; + private System.Windows.Forms.Button btnFrXMLTo; } } diff --git a/CobXmlSupport/GenCobCode.cs b/CobXmlSupport/GenCobCode.cs index cbd25f7..8a97d19 100644 --- a/CobXmlSupport/GenCobCode.cs +++ b/CobXmlSupport/GenCobCode.cs @@ -68,6 +68,7 @@ namespace CobXmlSupport chkDisplays.Enabled = false; chkPerform.Enabled = false; chkMvToDisp.Enabled = false; + btnFrXMLTo.Enabled = false; if (cmbLastFile.Text.Length > 0) { @@ -181,6 +182,7 @@ namespace CobXmlSupport chkDisplays.Enabled = true; chkPerform.Enabled = true; chkMvToDisp.Enabled = true; + btnFrXMLTo.Enabled = true; } } @@ -649,6 +651,7 @@ namespace CobXmlSupport S.ettingWrap = Properties.Settings.Default.Wrap; S.ettingLogVarName = Properties.Settings.Default.LogVarName; S.ettingLogSectName = Properties.Settings.Default.LogSectName; + S.ettingSpecials = Properties.Settings.Default.ShowTestbtns; chkAnaTag.Checked = S.ettingAnaTag; chkCountVars.Checked = S.ettingCountVars; @@ -662,6 +665,7 @@ namespace CobXmlSupport chkUniqueVars.Checked = S.ettingUniqueVars; chkValues.Checked = S.ettingValues; chkWrap.Checked = S.ettingWrap; + btnTestThings.Visible = S.ettingSpecials; formLoading = false; cmbLastFile.Text = cmbLastFile.Items[0].ToString(); @@ -1020,6 +1024,7 @@ namespace CobXmlSupport setWindow.ChkCountVars = S.ettingCountVars; setWindow.LogPost = S.ettingLogVarName; setWindow.LogSection = S.ettingLogSectName; + setWindow.ChkShowTestbtns = S.ettingSpecials; setWindow.ShowDialog(); S.ettingUserName = setWindow.UserName; @@ -1038,6 +1043,7 @@ namespace CobXmlSupport S.ettingCountVars = setWindow.ChkCountVars; S.ettingLogVarName = setWindow.LogPost; S.ettingLogSectName = setWindow.LogSection; + S.ettingSpecials = setWindow.ChkShowTestbtns; chkAnaTag.Checked = S.ettingAnaTag; chkCountVars.Checked = S.ettingCountVars; @@ -1051,6 +1057,7 @@ namespace CobXmlSupport txtMaxOcc.Text = S.ettingMaxOcc; txtPrefix.Text = S.ettingPrefix; txtExpPrefix.Text = S.ettingExpPrefix; + btnTestThings.Visible = S.ettingSpecials; eventRun = false; runXMLgen(); @@ -1680,79 +1687,114 @@ namespace CobXmlSupport } } - private void btnTestThings_Click(object sender, EventArgs e) + + private void createXMLMoveCode() { bool loopTyp = false; + + //Create showing window fromToMoves = new ShowCode(); fromToMoves.Parent = this; - fromToMoves.Labeltext = "Testing to Creat \"move From \" Code"; - + fromToMoves.Labeltext = "Created \"move From \" Code"; + //Dictionary for indexes, init IndexState class and list for qualifiedHelper class Dictionary testIndexes = new Dictionary(); - IndexState lIs = new IndexState(testIndexes,rowList); - //if (qldList == null) - //{ - qldList = new List(); - //} + IndexState lIs = new IndexState(testIndexes, rowList); + qldList = new List(); + + //Build the qualified helper object for each xml-record fieal (eg XMLTag) foreach (CobRow zRow in rowList) { qualifieldhlp tmpQlh = new qualifieldhlp(zRow, lIs.Indexes); qldList.Add(tmpQlh); } + //Indstatus keep track on present changings concerning indexes qualifying each qualified XML-record-field IndStatus indSt = new IndStatus(); + + //here comes the central work-loop foreach (qualifieldhlp tmpQfh in qldList) { - //obs under development + //Create header information on created text + if (tmpQfh.qualCobRow.CobLevel < 2) + { + string inFile = cmbLastFile.Text.Substring(cmbLastFile.Text.LastIndexOf("\\") + 1); + CreateComment(fromToMoves.CodeShower, "Moves from " + tmpQfh.qualCobRow.FieldName, S.ettingUserName, S.ettingCompany, inFile); + fromToMoves.CodeShower.Text += "\r\n"; + } + + //IndStatus-object takes care of optionally occuring indexes indSt.handleStatus(tmpQfh.indexStrings); + + //If indexes get out of scope there will come an END-PERFORM for each for (int i = 0; i < indSt.Returns; i++) { fromToMoves.CodeShower.Text += " END-PERFORM" + "\r\n"; } + + //Each index comming into scope will start a new PERFORM VARYING loop if (indSt.NewInds != null) { foreach (string indTxt in indSt.NewInds) { - fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.qualCobRow.CountIn + "\r\n" + tmpQfh.indexRedText; + //Before perform varying, move the count-value from old structure to new + fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.qualCobRow.CountIn + "\r\n" + tmpQfh.indexRedText; fromToMoves.CodeShower.Text += " TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + tmpQfh.indexRedText; + //Perform fromToMoves.CodeShower.Text += " PERFORM VARYING " + indTxt + " FROM 1 BY 1\r\n UNTIL " + indTxt + "\r\n > " + tmpQfh.qualCobRow.CountIn.ToString() + "\r\n" + tmpQfh.indexRedText; } } - //obs under development - //if (tmpQfh.qualCobRow.FieldDef != "") - //{ - if (tmpQfh.qualCobRow.FieldName.ToUpper().Contains("_VALUE")) { } - else { - loopTyp = tmpQfh.qualCobRow.isOccurs ;//&& tmpQfh.qualCobRow.FieldDef == ""; - fromToMoves.CodeShower.Text += " IF " + tmpQfh.qualCobRow.CountIn.ToString() + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText) + " > 0 \r\n"; - } - fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.ToString(); - fromToMoves.CodeShower.Text += " TO " + tmpQfh.ToExpString(); - if (tmpQfh.qualCobRow.FieldName.ToUpper().Contains("_VALUE")) { } - else - { - fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.qualCobRow.CountIn + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); - fromToMoves.CodeShower.Text += " TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); - fromToMoves.CodeShower.Text += " ELSE\r\n"; - fromToMoves.CodeShower.Text += " MOVE 0 TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); - fromToMoves.CodeShower.Text += " END-IF\r\n"; - } - //} + //When count-variable is put on a "Value" XML-record-field the the count-value isnt correctly updated so better always move the value as is + if (tmpQfh.qualCobRow.FieldName.ToUpper().Contains("_VALUE")) { } + else + { + //when xml-record-field with occurs, the last index shall not be used (then use tmpQfh.indexRedText instead of tmpQfh.indexText + loopTyp = tmpQfh.qualCobRow.isOccurs; + fromToMoves.CodeShower.Text += " IF " + tmpQfh.qualCobRow.CountIn.ToString() + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText) + " > 0 \r\n"; + } + //The acutal move of present fields + fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.ToString(); + fromToMoves.CodeShower.Text += " TO " + tmpQfh.ToExpString(); + + if (tmpQfh.qualCobRow.FieldName.ToUpper().Contains("_VALUE")) { } + else + { + fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.qualCobRow.CountIn + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); + fromToMoves.CodeShower.Text += " TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); + fromToMoves.CodeShower.Text += " ELSE\r\n"; + fromToMoves.CodeShower.Text += " MOVE 0 TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); + fromToMoves.CodeShower.Text += " END-IF\r\n"; + } } + // get optionally occuring last END-PERFORMs... indSt.handleStatus(null); for (int i = 0; i < indSt.Returns; i++) { fromToMoves.CodeShower.Text += " END-PERFORM" + "\r\n"; } + //List all used indexes + string tempIndText = ""; + fromToMoves.CodeShower.Text = addOccursVars(testIndexes, fromToMoves.CodeShower.Text, tempIndText); fromToMoves.Show(); } + private void btnTestThings_Click(object sender, EventArgs e) + { + createXMLMoveCode(); + } + + private void btnFrXMLTo_Click(object sender, EventArgs e) + { + createXMLMoveCode(); + } + + } } diff --git a/CobXmlSupport/Properties/Settings.Designer.cs b/CobXmlSupport/Properties/Settings.Designer.cs index 2029b01..27485f8 100644 --- a/CobXmlSupport/Properties/Settings.Designer.cs +++ b/CobXmlSupport/Properties/Settings.Designer.cs @@ -8,27 +8,17 @@ // //------------------------------------------------------------------------------ -namespace CobXmlSupport.Properties -{ +namespace CobXmlSupport.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - public static Settings Default { get { - - - return defaultInstance; } } @@ -227,5 +217,17 @@ namespace CobXmlSupport.Properties this["ExpPrefix"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool ShowTestbtns { + get { + return ((bool)(this["ShowTestbtns"])); + } + set { + this["ShowTestbtns"] = value; + } + } } } diff --git a/CobXmlSupport/Properties/Settings.settings b/CobXmlSupport/Properties/Settings.settings index 902ecee..a5d3aff 100644 --- a/CobXmlSupport/Properties/Settings.settings +++ b/CobXmlSupport/Properties/Settings.settings @@ -1,7 +1,7 @@  - - - + + + <?xml version="1.0" encoding="utf-16"?> <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> @@ -53,5 +53,8 @@ GWX_ + + False + - + \ No newline at end of file diff --git a/CobXmlSupport/S.cs b/CobXmlSupport/S.cs index c805b46..e49bcd1 100644 --- a/CobXmlSupport/S.cs +++ b/CobXmlSupport/S.cs @@ -23,6 +23,7 @@ namespace CobXmlSupport public static bool ettingCountVars; public static string ettingLogVarName; public static string ettingLogSectName; + public static bool ettingSpecials; //------------------------- } } diff --git a/CobXmlSupport/frmSettings.Designer.cs b/CobXmlSupport/frmSettings.Designer.cs index 45e3baa..4eaff8f 100644 --- a/CobXmlSupport/frmSettings.Designer.cs +++ b/CobXmlSupport/frmSettings.Designer.cs @@ -49,21 +49,24 @@ this.chkValues = new System.Windows.Forms.CheckBox(); this.chkAnaTag = new System.Windows.Forms.CheckBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.txtExpPrefix = new System.Windows.Forms.TextBox(); + this.label8 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.label6 = new System.Windows.Forms.Label(); this.txtLogPost = new System.Windows.Forms.TextBox(); this.txtLogSection = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); - this.txtExpPrefix = new System.Windows.Forms.TextBox(); - this.label8 = new System.Windows.Forms.Label(); + this.specials = new System.Windows.Forms.GroupBox(); + this.chkShowTestbtns = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); + this.specials.SuspendLayout(); this.SuspendLayout(); // // btnCancel // this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnCancel.Location = new System.Drawing.Point(490, 366); + this.btnCancel.Location = new System.Drawing.Point(487, 370); this.btnCancel.Margin = new System.Windows.Forms.Padding(2); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(79, 24); @@ -75,7 +78,7 @@ // btnSave // this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnSave.Location = new System.Drawing.Point(406, 366); + this.btnSave.Location = new System.Drawing.Point(403, 370); this.btnSave.Margin = new System.Windows.Forms.Padding(2); this.btnSave.Name = "btnSave"; this.btnSave.Size = new System.Drawing.Size(79, 24); @@ -114,7 +117,7 @@ // // txtCompanyName // - this.txtCompanyName.Location = new System.Drawing.Point(101, 65); + this.txtCompanyName.Location = new System.Drawing.Point(101, 62); this.txtCompanyName.Margin = new System.Windows.Forms.Padding(2); this.txtCompanyName.Name = "txtCompanyName"; this.txtCompanyName.Size = new System.Drawing.Size(195, 20); @@ -271,6 +274,23 @@ this.groupBox1.TabStop = false; this.groupBox1.Text = "Utgångs inställningar"; // + // txtExpPrefix + // + this.txtExpPrefix.Location = new System.Drawing.Point(213, 51); + this.txtExpPrefix.Name = "txtExpPrefix"; + this.txtExpPrefix.Size = new System.Drawing.Size(57, 20); + this.txtExpPrefix.TabIndex = 40; + this.txtExpPrefix.Text = "GWX_"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(137, 52); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(70, 13); + this.label8.TabIndex = 39; + this.label8.Text = "export prefix :"; + // // groupBox2 // this.groupBox2.Controls.Add(this.label6); @@ -317,28 +337,32 @@ this.label7.TabIndex = 37; this.label7.Text = "Namn log section"; // - // txtExpPrefix + // specials // - this.txtExpPrefix.Location = new System.Drawing.Point(213, 51); - this.txtExpPrefix.Name = "txtExpPrefix"; - this.txtExpPrefix.Size = new System.Drawing.Size(57, 20); - this.txtExpPrefix.TabIndex = 40; - this.txtExpPrefix.Text = "GWX_"; + this.specials.Controls.Add(this.chkShowTestbtns); + this.specials.Location = new System.Drawing.Point(325, 216); + this.specials.Name = "specials"; + this.specials.Size = new System.Drawing.Size(240, 149); + this.specials.TabIndex = 41; + this.specials.TabStop = false; + this.specials.Text = "specialla inställningar"; // - // label8 + // chkShowTestbtns // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(137, 52); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(70, 13); - this.label8.TabIndex = 39; - this.label8.Text = "export prefix :"; + this.chkShowTestbtns.AutoSize = true; + this.chkShowTestbtns.Location = new System.Drawing.Point(7, 20); + this.chkShowTestbtns.Name = "chkShowTestbtns"; + this.chkShowTestbtns.Size = new System.Drawing.Size(95, 17); + this.chkShowTestbtns.TabIndex = 0; + this.chkShowTestbtns.Text = "visa testknapp"; + this.chkShowTestbtns.UseVisualStyleBackColor = true; // // frmSettings // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(577, 399); + this.Controls.Add(this.specials); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.txtCompanyName); @@ -357,6 +381,8 @@ this.groupBox1.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); + this.specials.ResumeLayout(false); + this.specials.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -391,5 +417,7 @@ private System.Windows.Forms.Label label7; private System.Windows.Forms.TextBox txtExpPrefix; private System.Windows.Forms.Label label8; + private System.Windows.Forms.GroupBox specials; + private System.Windows.Forms.CheckBox chkShowTestbtns; } } \ No newline at end of file diff --git a/CobXmlSupport/frmSettings.cs b/CobXmlSupport/frmSettings.cs index d85b88d..34f25fe 100644 --- a/CobXmlSupport/frmSettings.cs +++ b/CobXmlSupport/frmSettings.cs @@ -21,6 +21,7 @@ namespace CobXmlSupport private bool tmpChkValues; private bool tmpChkAnaTag; private bool tmpChkCountVars; + private bool tmpShowTestBtns; private string tmpTxtPrefix; private string tmpTxtExpPrefix; private string tmpTxtMaxOcc; @@ -170,6 +171,19 @@ namespace CobXmlSupport chkAnaTag.Checked = value; } } + + public bool ChkShowTestbtns + { + get + { + return chkShowTestbtns.Checked; + } + set + { + chkShowTestbtns.Checked = value; + } + } + public string TxtMaxOcc { get @@ -219,6 +233,7 @@ namespace CobXmlSupport Properties.Settings.Default.UniqueVars = chkUniqueVars.Checked; Properties.Settings.Default.Values = chkValues.Checked; Properties.Settings.Default.Wrap = chkWrap.Checked; + Properties.Settings.Default.ShowTestbtns= chkShowTestbtns.Checked; Properties.Settings.Default.LogVarName = txtLogPost.Text; Properties.Settings.Default.LogSectName = txtLogSection.Text; Properties.Settings.Default.Save(); @@ -237,6 +252,7 @@ namespace CobXmlSupport tmpChkWrap = chkWrap.Checked; tmpChkValues = chkValues.Checked; tmpChkAnaTag = chkAnaTag.Checked; + tmpShowTestBtns = chkShowTestbtns.Checked; tmpTxtPrefix = txtPrefix.Text; tmpTxtExpPrefix = txtExpPrefix.Text; tmpTxtMaxOcc = txtMaxOcc.Text; @@ -257,6 +273,7 @@ namespace CobXmlSupport chkWrap.Checked= tmpChkWrap; chkValues.Checked= tmpChkValues; chkAnaTag.Checked= tmpChkAnaTag; + chkShowTestbtns.Checked = tmpShowTestBtns; txtPrefix.Text= tmpTxtPrefix; txtExpPrefix.Text = tmpTxtExpPrefix; txtMaxOcc.Text = tmpTxtMaxOcc;