diff --git a/CobXmlSupport/CobRow.cs b/CobXmlSupport/CobRow.cs index 96c6bd8..43f27d5 100644 --- a/CobXmlSupport/CobRow.cs +++ b/CobXmlSupport/CobRow.cs @@ -12,6 +12,7 @@ namespace CobXmlSupport private List __wordList; private string __rowSource; private int __startPos; + private int __occNum; public CobRow(string rowSource) { @@ -111,6 +112,18 @@ namespace CobXmlSupport } } + public int occNum + { + get + { + if (this.isOccurs) + { + return __occNum; + } + else return 1; + } + } + public static string checkLongNames(string inStr, int maxLngth=30) { string tmp = inStr; @@ -224,6 +237,11 @@ namespace CobXmlSupport if (__wordList[i].ToString().ToLower() == searchVal.ToLower()) { tmp = "true"; + if (__wordList[i + 1].NumVal().Length > 0) + { + __occNum = int.Parse(__wordList[i + 1].NumVal()); + } + i = __wordList.Count; } break; diff --git a/CobXmlSupport/GenCobCode.Designer.cs b/CobXmlSupport/GenCobCode.Designer.cs index cadf0db..677c2c3 100644 --- a/CobXmlSupport/GenCobCode.Designer.cs +++ b/CobXmlSupport/GenCobCode.Designer.cs @@ -70,10 +70,9 @@ // // button1 // - this.button1.Location = new System.Drawing.Point(27, 58); - this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.button1.Location = new System.Drawing.Point(20, 47); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(100, 28); + this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 0; this.button1.Text = "Start"; this.button1.UseVisualStyleBackColor = true; @@ -84,12 +83,11 @@ this.outText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.outText.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.outText.Location = new System.Drawing.Point(27, 149); - this.outText.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.outText.Location = new System.Drawing.Point(20, 121); this.outText.Multiline = true; this.outText.Name = "outText"; this.outText.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.outText.Size = new System.Drawing.Size(505, 590); + this.outText.Size = new System.Drawing.Size(380, 480); this.outText.TabIndex = 1; this.outText.WordWrap = false; // @@ -99,12 +97,11 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.outCob.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.outCob.Location = new System.Drawing.Point(541, 149); - this.outCob.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.outCob.Location = new System.Drawing.Point(406, 121); this.outCob.Multiline = true; this.outCob.Name = "outCob"; this.outCob.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.outCob.Size = new System.Drawing.Size(709, 590); + this.outCob.Size = new System.Drawing.Size(533, 480); this.outCob.TabIndex = 2; this.outCob.WordWrap = false; this.outCob.KeyDown += new System.Windows.Forms.KeyEventHandler(this.outCob_KeyDown); @@ -113,10 +110,9 @@ // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(23, 129); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(17, 105); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(106, 18); + this.label1.Size = new System.Drawing.Size(89, 15); this.label1.TabIndex = 4; this.label1.Text = "XML-struktur"; // @@ -124,20 +120,18 @@ // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.Location = new System.Drawing.Point(541, 129); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label2.Location = new System.Drawing.Point(406, 105); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(205, 18); + this.label2.Size = new System.Drawing.Size(167, 15); this.label2.TabIndex = 5; this.label2.Text = "Försök till COB-copybook"; // // btnClose // this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnClose.Location = new System.Drawing.Point(1152, 786); - this.btnClose.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnClose.Location = new System.Drawing.Point(864, 639); this.btnClose.Name = "btnClose"; - this.btnClose.Size = new System.Drawing.Size(100, 28); + this.btnClose.Size = new System.Drawing.Size(75, 23); this.btnClose.TabIndex = 6; this.btnClose.Text = "Close"; this.btnClose.UseVisualStyleBackColor = true; @@ -146,10 +140,9 @@ // chkAnaTag // this.chkAnaTag.AutoSize = true; - this.chkAnaTag.Location = new System.Drawing.Point(157, 63); - this.chkAnaTag.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.chkAnaTag.Location = new System.Drawing.Point(118, 51); this.chkAnaTag.Name = "chkAnaTag"; - this.chkAnaTag.Size = new System.Drawing.Size(155, 21); + this.chkAnaTag.Size = new System.Drawing.Size(118, 17); this.chkAnaTag.TabIndex = 7; this.chkAnaTag.Text = "analysera tag-value"; this.chkAnaTag.UseVisualStyleBackColor = true; @@ -158,10 +151,9 @@ // chkValues // this.chkValues.AutoSize = true; - this.chkValues.Location = new System.Drawing.Point(157, 92); - this.chkValues.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.chkValues.Location = new System.Drawing.Point(118, 75); this.chkValues.Name = "chkValues"; - this.chkValues.Size = new System.Drawing.Size(119, 21); + this.chkValues.Size = new System.Drawing.Size(92, 17); this.chkValues.TabIndex = 8; this.chkValues.Text = "lägg till values"; this.chkValues.UseVisualStyleBackColor = true; @@ -170,29 +162,27 @@ // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(364, 64); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Location = new System.Drawing.Point(273, 52); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(50, 17); + this.label3.Size = new System.Drawing.Size(38, 13); this.label3.TabIndex = 9; this.label3.Text = "prefix :"; // // txtPrefix // - this.txtPrefix.Location = new System.Drawing.Point(423, 60); - this.txtPrefix.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtPrefix.Location = new System.Drawing.Point(317, 49); this.txtPrefix.Name = "txtPrefix"; - this.txtPrefix.Size = new System.Drawing.Size(75, 22); + this.txtPrefix.Size = new System.Drawing.Size(57, 20); this.txtPrefix.TabIndex = 10; this.txtPrefix.Text = "GWM_"; // // chkWrap // this.chkWrap.AutoSize = true; - this.chkWrap.Location = new System.Drawing.Point(519, 90); - this.chkWrap.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.chkWrap.Location = new System.Drawing.Point(389, 73); + this.chkWrap.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.chkWrap.Name = "chkWrap"; - this.chkWrap.Size = new System.Drawing.Size(102, 21); + this.chkWrap.Size = new System.Drawing.Size(79, 17); this.chkWrap.TabIndex = 11; this.chkWrap.Text = "radbryt kod"; this.chkWrap.UseVisualStyleBackColor = true; @@ -202,22 +192,22 @@ // this.btnGenICode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnGenICode.Enabled = false; - this.btnGenICode.Location = new System.Drawing.Point(547, 758); - this.btnGenICode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.btnGenICode.Location = new System.Drawing.Point(410, 616); + this.btnGenICode.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnGenICode.Name = "btnGenICode"; - this.btnGenICode.Size = new System.Drawing.Size(108, 28); + this.btnGenICode.Size = new System.Drawing.Size(81, 23); this.btnGenICode.TabIndex = 12; this.btnGenICode.Text = "Gen Init kod"; this.btnGenICode.UseVisualStyleBackColor = true; - this.btnGenICode.Click += new System.EventHandler(this.btnGenICode_Click); + this.btnGenICode.Click += new System.EventHandler(this.btnGenICodeNew_Click); // // chkUnique // this.chkUnique.AutoSize = true; - this.chkUnique.Location = new System.Drawing.Point(671, 91); - this.chkUnique.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.chkUnique.Location = new System.Drawing.Point(503, 74); + this.chkUnique.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.chkUnique.Name = "chkUnique"; - this.chkUnique.Size = new System.Drawing.Size(123, 21); + this.chkUnique.Size = new System.Drawing.Size(95, 17); this.chkUnique.TabIndex = 13; this.chkUnique.Text = "unika X-pather"; this.chkUnique.UseVisualStyleBackColor = true; @@ -227,10 +217,10 @@ // this.btnMoves.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnMoves.Enabled = false; - this.btnMoves.Location = new System.Drawing.Point(660, 758); - this.btnMoves.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.btnMoves.Location = new System.Drawing.Point(495, 616); + this.btnMoves.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnMoves.Name = "btnMoves"; - this.btnMoves.Size = new System.Drawing.Size(124, 28); + this.btnMoves.Size = new System.Drawing.Size(93, 23); this.btnMoves.TabIndex = 14; this.btnMoves.Text = "Gen Move kod"; this.btnMoves.UseVisualStyleBackColor = true; @@ -238,10 +228,9 @@ // // btnChooseFile // - this.btnChooseFile.Location = new System.Drawing.Point(27, 21); - this.btnChooseFile.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnChooseFile.Location = new System.Drawing.Point(20, 17); this.btnChooseFile.Name = "btnChooseFile"; - this.btnChooseFile.Size = new System.Drawing.Size(100, 28); + this.btnChooseFile.Size = new System.Drawing.Size(75, 23); this.btnChooseFile.TabIndex = 15; this.btnChooseFile.Text = "Välj fil"; this.btnChooseFile.UseVisualStyleBackColor = true; @@ -255,10 +244,9 @@ // this.btnMoveFrom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnMoveFrom.Enabled = false; - this.btnMoveFrom.Location = new System.Drawing.Point(896, 758); - this.btnMoveFrom.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnMoveFrom.Location = new System.Drawing.Point(672, 616); this.btnMoveFrom.Name = "btnMoveFrom"; - this.btnMoveFrom.Size = new System.Drawing.Size(123, 28); + this.btnMoveFrom.Size = new System.Drawing.Size(92, 23); this.btnMoveFrom.TabIndex = 16; this.btnMoveFrom.Text = "Gen Move från"; this.btnMoveFrom.UseVisualStyleBackColor = true; @@ -267,20 +255,18 @@ // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(819, 90); - this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label4.Location = new System.Drawing.Point(614, 73); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(66, 17); + this.label4.Size = new System.Drawing.Size(51, 13); this.label4.TabIndex = 17; this.label4.Text = "max OCC"; // // txtMaxOcc // - this.txtMaxOcc.Location = new System.Drawing.Point(896, 89); - this.txtMaxOcc.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtMaxOcc.Location = new System.Drawing.Point(672, 72); this.txtMaxOcc.Name = "txtMaxOcc"; this.txtMaxOcc.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.txtMaxOcc.Size = new System.Drawing.Size(48, 22); + this.txtMaxOcc.Size = new System.Drawing.Size(37, 20); this.txtMaxOcc.TabIndex = 18; this.txtMaxOcc.Text = "25"; this.txtMaxOcc.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; @@ -288,10 +274,9 @@ // chkUniqueAttrVars // this.chkUniqueAttrVars.AutoSize = true; - this.chkUniqueAttrVars.Location = new System.Drawing.Point(519, 63); - this.chkUniqueAttrVars.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.chkUniqueAttrVars.Location = new System.Drawing.Point(389, 51); this.chkUniqueAttrVars.Name = "chkUniqueAttrVars"; - this.chkUniqueAttrVars.Size = new System.Drawing.Size(120, 21); + this.chkUniqueAttrVars.Size = new System.Drawing.Size(93, 17); this.chkUniqueAttrVars.TabIndex = 19; this.chkUniqueAttrVars.Text = "unika attr.vars"; this.chkUniqueAttrVars.UseVisualStyleBackColor = true; @@ -300,10 +285,9 @@ // chkUniqueVars // this.chkUniqueVars.AutoSize = true; - this.chkUniqueVars.Location = new System.Drawing.Point(671, 64); - this.chkUniqueVars.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.chkUniqueVars.Location = new System.Drawing.Point(503, 52); this.chkUniqueVars.Name = "chkUniqueVars"; - this.chkUniqueVars.Size = new System.Drawing.Size(133, 21); + this.chkUniqueVars.Size = new System.Drawing.Size(104, 17); this.chkUniqueVars.TabIndex = 20; this.chkUniqueVars.Text = "unika cobol vars"; this.chkUniqueVars.UseVisualStyleBackColor = true; @@ -314,10 +298,9 @@ this.chkDisplays.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkDisplays.AutoSize = true; this.chkDisplays.Enabled = false; - this.chkDisplays.Location = new System.Drawing.Point(1029, 773); - this.chkDisplays.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.chkDisplays.Location = new System.Drawing.Point(771, 628); this.chkDisplays.Name = "chkDisplays"; - this.chkDisplays.Size = new System.Drawing.Size(93, 21); + this.chkDisplays.Size = new System.Drawing.Size(71, 17); this.chkDisplays.TabIndex = 21; this.chkDisplays.Text = "(Displays)"; this.chkDisplays.UseVisualStyleBackColor = true; @@ -325,10 +308,9 @@ // chkNoNsRef // this.chkNoNsRef.AutoSize = true; - this.chkNoNsRef.Location = new System.Drawing.Point(983, 63); - this.chkNoNsRef.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.chkNoNsRef.Location = new System.Drawing.Point(737, 51); this.chkNoNsRef.Name = "chkNoNsRef"; - this.chkNoNsRef.Size = new System.Drawing.Size(167, 21); + this.chkNoNsRef.Size = new System.Drawing.Size(129, 17); this.chkNoNsRef.TabIndex = 22; this.chkNoNsRef.Text = "utan NameSpace refs"; this.chkNoNsRef.UseVisualStyleBackColor = true; @@ -337,19 +319,17 @@ // cmbLastFile // this.cmbLastFile.FormattingEnabled = true; - this.cmbLastFile.Location = new System.Drawing.Point(160, 23); - this.cmbLastFile.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cmbLastFile.Location = new System.Drawing.Point(120, 19); this.cmbLastFile.Name = "cmbLastFile"; - this.cmbLastFile.Size = new System.Drawing.Size(979, 24); + this.cmbLastFile.Size = new System.Drawing.Size(735, 21); this.cmbLastFile.TabIndex = 23; this.cmbLastFile.SelectedIndexChanged += new System.EventHandler(this.cmbLastFile_SelectedIndexChanged); // // btnClearSettings // - this.btnClearSettings.Location = new System.Drawing.Point(1148, 23); - this.btnClearSettings.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnClearSettings.Location = new System.Drawing.Point(861, 19); this.btnClearSettings.Name = "btnClearSettings"; - this.btnClearSettings.Size = new System.Drawing.Size(100, 28); + this.btnClearSettings.Size = new System.Drawing.Size(75, 23); this.btnClearSettings.TabIndex = 24; this.btnClearSettings.Text = "Rensa"; this.btnClearSettings.UseVisualStyleBackColor = true; @@ -358,10 +338,9 @@ // chkCountVars // this.chkCountVars.AutoSize = true; - this.chkCountVars.Location = new System.Drawing.Point(983, 91); - this.chkCountVars.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.chkCountVars.Location = new System.Drawing.Point(737, 74); this.chkCountVars.Name = "chkCountVars"; - this.chkCountVars.Size = new System.Drawing.Size(134, 21); + this.chkCountVars.Size = new System.Drawing.Size(106, 17); this.chkCountVars.TabIndex = 25; this.chkCountVars.Text = "\"count\" variabler"; this.chkCountVars.UseVisualStyleBackColor = true; @@ -370,10 +349,10 @@ // btnSettings // this.btnSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnSettings.Location = new System.Drawing.Point(27, 758); - this.btnSettings.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.btnSettings.Location = new System.Drawing.Point(20, 616); + this.btnSettings.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnSettings.Name = "btnSettings"; - this.btnSettings.Size = new System.Drawing.Size(108, 28); + this.btnSettings.Size = new System.Drawing.Size(81, 23); this.btnSettings.TabIndex = 26; this.btnSettings.Text = "Inställningar"; this.btnSettings.UseVisualStyleBackColor = true; @@ -383,10 +362,9 @@ // this.chkPerform.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkPerform.AutoSize = true; - this.chkPerform.Location = new System.Drawing.Point(794, 752); - this.chkPerform.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.chkPerform.Location = new System.Drawing.Point(594, 611); this.chkPerform.Name = "chkPerform"; - this.chkPerform.Size = new System.Drawing.Size(80, 21); + this.chkPerform.Size = new System.Drawing.Size(62, 17); this.chkPerform.TabIndex = 27; this.chkPerform.Text = "Perform"; this.chkPerform.UseVisualStyleBackColor = true; @@ -395,10 +373,9 @@ // this.chkMvToDisp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkMvToDisp.AutoSize = true; - this.chkMvToDisp.Location = new System.Drawing.Point(793, 773); - this.chkMvToDisp.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.chkMvToDisp.Location = new System.Drawing.Point(594, 628); this.chkMvToDisp.Name = "chkMvToDisp"; - this.chkMvToDisp.Size = new System.Drawing.Size(93, 21); + this.chkMvToDisp.Size = new System.Drawing.Size(71, 17); this.chkMvToDisp.TabIndex = 28; this.chkMvToDisp.Text = "(Displays)"; this.chkMvToDisp.UseVisualStyleBackColor = true; @@ -407,10 +384,9 @@ // this.chkNewArea.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkNewArea.AutoSize = true; - this.chkNewArea.Location = new System.Drawing.Point(1029, 752); - this.chkNewArea.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.chkNewArea.Location = new System.Drawing.Point(770, 611); this.chkNewArea.Name = "chkNewArea"; - this.chkNewArea.Size = new System.Drawing.Size(82, 21); + this.chkNewArea.Size = new System.Drawing.Size(64, 17); this.chkNewArea.TabIndex = 29; this.chkNewArea.Text = "Till Area"; this.chkNewArea.UseVisualStyleBackColor = true; @@ -420,19 +396,17 @@ // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(321, 94); - this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label5.Location = new System.Drawing.Point(241, 76); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(93, 17); + this.label5.Size = new System.Drawing.Size(70, 13); this.label5.TabIndex = 30; this.label5.Text = "export prefix :"; // // txtExpPrefix // - this.txtExpPrefix.Location = new System.Drawing.Point(423, 92); - this.txtExpPrefix.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtExpPrefix.Location = new System.Drawing.Point(317, 75); this.txtExpPrefix.Name = "txtExpPrefix"; - this.txtExpPrefix.Size = new System.Drawing.Size(75, 22); + this.txtExpPrefix.Size = new System.Drawing.Size(57, 20); this.txtExpPrefix.TabIndex = 31; this.txtExpPrefix.Text = "GWX_"; // @@ -440,10 +414,9 @@ // this.chkAttribs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkAttribs.AutoSize = true; - this.chkAttribs.Location = new System.Drawing.Point(1029, 793); - this.chkAttribs.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.chkAttribs.Location = new System.Drawing.Point(768, 644); this.chkAttribs.Name = "chkAttribs"; - this.chkAttribs.Size = new System.Drawing.Size(108, 21); + this.chkAttribs.Size = new System.Drawing.Size(85, 17); this.chkAttribs.TabIndex = 32; this.chkAttribs.Text = "Move Attribs"; this.chkAttribs.UseVisualStyleBackColor = true; @@ -452,10 +425,9 @@ // btnTestThings // this.btnTestThings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnTestThings.Location = new System.Drawing.Point(28, 786); - this.btnTestThings.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnTestThings.Location = new System.Drawing.Point(21, 639); this.btnTestThings.Name = "btnTestThings"; - this.btnTestThings.Size = new System.Drawing.Size(108, 28); + this.btnTestThings.Size = new System.Drawing.Size(81, 23); this.btnTestThings.TabIndex = 33; this.btnTestThings.Text = "run test"; this.btnTestThings.UseVisualStyleBackColor = true; @@ -464,10 +436,9 @@ // 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(896, 786); - this.btnFrXMLTo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnFrXMLTo.Location = new System.Drawing.Point(672, 639); this.btnFrXMLTo.Name = "btnFrXMLTo"; - this.btnFrXMLTo.Size = new System.Drawing.Size(123, 27); + this.btnFrXMLTo.Size = new System.Drawing.Size(92, 22); this.btnFrXMLTo.TabIndex = 34; this.btnFrXMLTo.Text = "Kopiera XML"; this.btnFrXMLTo.UseVisualStyleBackColor = true; @@ -476,10 +447,9 @@ // 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(255, 758); - this.btnCrossref.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnCrossref.Location = new System.Drawing.Point(191, 616); this.btnCrossref.Name = "btnCrossref"; - this.btnCrossref.Size = new System.Drawing.Size(108, 28); + this.btnCrossref.Size = new System.Drawing.Size(81, 23); this.btnCrossref.TabIndex = 35; this.btnCrossref.Text = "CrossRef"; this.btnCrossref.UseVisualStyleBackColor = true; @@ -489,19 +459,18 @@ // this.chkBackupVars.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.chkBackupVars.AutoSize = true; - this.chkBackupVars.Location = new System.Drawing.Point(371, 763); - this.chkBackupVars.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.chkBackupVars.Location = new System.Drawing.Point(278, 620); this.chkBackupVars.Name = "chkBackupVars"; - this.chkBackupVars.Size = new System.Drawing.Size(110, 21); + this.chkBackupVars.Size = new System.Drawing.Size(87, 17); this.chkBackupVars.TabIndex = 36; this.chkBackupVars.Text = "Backup Vars"; this.chkBackupVars.UseVisualStyleBackColor = true; // // GenCobCode // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1268, 853); + this.ClientSize = new System.Drawing.Size(951, 693); this.Controls.Add(this.chkBackupVars); this.Controls.Add(this.btnCrossref); this.Controls.Add(this.btnFrXMLTo); @@ -539,7 +508,6 @@ this.Controls.Add(this.outText); this.Controls.Add(this.button1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "GenCobCode"; this.Text = "X M L to C O B"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GenCobCode_FormClosing); diff --git a/CobXmlSupport/GenCobCode.cs b/CobXmlSupport/GenCobCode.cs index 8c4c47e..435ec3b 100644 --- a/CobXmlSupport/GenCobCode.cs +++ b/CobXmlSupport/GenCobCode.cs @@ -15,6 +15,12 @@ using System.Reflection; using System.IO; using System.Resources; +//---------------------------förändrings krav--------------------------- +// 1.) Indexerande mellannivåer där count-måste sättas får inte hoppas över ! +// +// +// +//---------------------------------------------------------------------- namespace CobXmlSupport { @@ -791,6 +797,113 @@ namespace CobXmlSupport genCode.ShowDialog(); } + + private void btnGenICodeNew_Click(object sender, EventArgs e) + { + bool justOut = true; + bool loopTyp = false; + + Dictionary indexNames = new Dictionary(); + string IndVarText = " *--------------------------------------------------*\r\n * Extra indexvariabler för occurs-taggar --------*\r\n *--------------------------------------------------*"; + string slask = ""; + genCode = new ShowCode(); + genCode.Parent = this; + genCode.Labeltext = "Creating Initialization Code"; + string inFile = cmbLastFile.Text.Substring(cmbLastFile.Text.LastIndexOf("\\") + 1); + CreateComment(genCode.CodeShower, "Initializer", S.ettingUserName, S.ettingCompany, inFile); + genCode.CodeShower.Text += "\r\n"; + + //Dictionary for indexes, init IndexState class and list for qualifiedHelper class + Dictionary testIndexes = new Dictionary(); + IndexState lIs = new IndexState(testIndexes, rowList); + qldList = new List(); + + foreach (CobRow cr in rowList) + { +// if (cr.isAttribute) +// { + qualifieldhlp tmpQlh = new qualifieldhlp(cr, lIs.Indexes); + qldList.Add(tmpQlh); + //string occParRows = ""; + //CobRow crTmp = cr; + //genCode.CodeShower.Text += "\r\n " + "MOVE " + cr.Value + "\r\n TO " + cr.FieldName; + //while (crTmp.LevelParent != null) + //{ + // crTmp = crTmp.LevelParent; + // genCode.CodeShower.Text += "\r\n OF " + crTmp.FieldName; + // genCode.CodeShower.Text = checkForOccurs(indexNames, crTmp, genCode.CodeShower.Text, ref occParRows, ref slask); + //} + //if (occParRows.Length > 0) + //{ + // genCode.CodeShower.Text += " (" + occParRows + " )\r\n"; + //} +// } + } + + //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) + { + //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++) + { + genCode.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) + { + //Perform + + //genCode.CodeShower.Text += " PERFORM VARYING " + indTxt + " FROM 1 BY 1\r\n UNTIL " + + //indTxt + "\r\n > " + tmpQfh.qualCobRow.CountIn.ToString() + "\r\n" + tmpQfh.indexRedText; + + genCode.CodeShower.Text += " PERFORM VARYING " + indTxt + " FROM 1 BY 1\r\n UNTIL " + + indTxt + "\r\n > " + tmpQfh.qualCobRow.occNum.ToString() + "\r\n"; // +tmpQfh.indexRedText; + + if (tmpQfh.qualCobRow.isOccurs) slask = ""; + } + } + + if (tmpQfh.qualCobRow.isAttribute) + { + //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; + //genCode.CodeShower.Text += " IF " + tmpQfh.qualCobRow.CountIn.ToString() + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText) + " > 0 \r\n"; + + //The acutal move of present fields + genCode.CodeShower.Text += " MOVE " + tmpQfh.qualCobRow.Value; + + genCode.CodeShower.Text += "\r\n TO " + tmpQfh.ToString() + "\r\n"; + } + + } + + + // get optionally occuring last END-PERFORMs... + + indSt.handleStatus(null); + for (int i = 0; i < indSt.Returns; i++) + { + genCode.CodeShower.Text += " END-PERFORM" + "\r\n"; + } + + + //List all used indexes + string tempIndText = ""; + genCode.CodeShower.Text = addOccursVars(testIndexes, genCode.CodeShower.Text, tempIndText); + + genCode.ShowDialog(); + } + /// /// creates declaration for generated index-variables (in checkForOccurs()) /// @@ -1103,7 +1216,6 @@ namespace CobXmlSupport setWindow.ShowDialog(); S.ettingUserName = setWindow.UserName; S.ettingCompany = setWindow.CompanyName; - S.ettingNoNsRef = setWindow.ChkNoNsRef; S.ettingUniqueVars = setWindow.ChkUniqueVars; S.ettingUniqueAttrVars = setWindow.ChkUniqueAttrVars; @@ -1511,7 +1623,7 @@ namespace CobXmlSupport if (cr.MoveFromCode.Trim().Length > 0) { - fromMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + cr.MoveFromCode +" delimited by \" \" "; + fromMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + cr.MoveFromCode + " delimited by \" \" "; } else { @@ -1878,61 +1990,80 @@ namespace CobXmlSupport 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++) + if (!tmpQfh.qualCobRow.isAttribute && !tmpQfh.qualCobRow.SampleStr.Equals(NOMOVE)) { - 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) + //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++) { - if (!justOut) - { - //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; + fromToMoves.CodeShower.Text += " END-PERFORM" + "\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(); - if (!justOut) - { - fromToMoves.CodeShower.Text += " TO " + tmpQfh.ToExpString(); - } - else - { - fromToMoves.CodeShower.Text += " TO " + (string)(tmpQfh.qualCobRow.FieldDef.ToUpper().Contains("X") ? "MoveToStringVar" : "MoveToNumVar") + "\r\n"; - } + //Each index comming into scope will start a new PERFORM VARYING loop + if (indSt.NewInds != null) + { + foreach (string indTxt in indSt.NewInds) + { + if (!justOut) + { + //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; + } + } - if (!justOut) - { + //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 { - 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 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(); + if (!justOut) + { + fromToMoves.CodeShower.Text += " TO " + tmpQfh.ToExpString(); + } + else + { + if (tmpQfh.qualCobRow.MoveFromCode != null && tmpQfh.qualCobRow.MoveFromCode.Trim().Length > 0) + { + if (tmpQfh.qualCobRow.MoveFromCode.IndexOf("") > -1 || tmpQfh.qualCobRow.MoveFromCode.IndexOf("") > -1) + { + fromToMoves.CodeShower.Text += " *>" + tmpQfh.qualCobRow.MoveFromCode + "\r\n"; + fromToMoves.CodeShower.Text += " TO " + (string)(tmpQfh.qualCobRow.FieldDef.ToUpper().Contains("X") ? "MoveToStringVar" : "MoveToNumVar") + "\r\n"; + } + else + { + fromToMoves.CodeShower.Text += tmpQfh.qualCobRow.MoveFromCode + "\r\n"; + } + } + else + { + fromToMoves.CodeShower.Text += " TO " + (string)(tmpQfh.qualCobRow.FieldDef.ToUpper().Contains("X") ? "MoveToStringVar" : "MoveToNumVar") + "\r\n"; + } + } + + if (!justOut) + { + 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"; + } } } } diff --git a/CobXmlSupport/RowWord.cs b/CobXmlSupport/RowWord.cs index cd5127f..8a989a8 100644 --- a/CobXmlSupport/RowWord.cs +++ b/CobXmlSupport/RowWord.cs @@ -56,7 +56,17 @@ namespace CobXmlSupport { return __wordSource; } - + + public string NumVal() + { + string numChars = "0123456789"; + string tmpStr = ""; + for (int i = 0; i < __wordSource.Length; i++) + { + tmpStr += numChars.IndexOf(__wordSource.Substring(i, 1))>-1?__wordSource.Substring(i, 1):""; + } + return tmpStr; + } } } diff --git a/CobXmlSupport/S.cs b/CobXmlSupport/S.cs index cea8f6f..e658e4b 100644 --- a/CobXmlSupport/S.cs +++ b/CobXmlSupport/S.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml.Serialization; namespace CobXmlSupport { - public static class S + public static class S { public static string ettingUserName; public static string ettingCompany;