diff --git a/CobXmlSupport/App.config b/CobXmlSupport/App.config
index b158d81..d6d7e20 100644
--- a/CobXmlSupport/App.config
+++ b/CobXmlSupport/App.config
@@ -67,6 +67,9 @@
False
+
+ True
+
diff --git a/CobXmlSupport/GenCobCode.Designer.cs b/CobXmlSupport/GenCobCode.Designer.cs
index 499fe36..58f818c 100644
--- a/CobXmlSupport/GenCobCode.Designer.cs
+++ b/CobXmlSupport/GenCobCode.Designer.cs
@@ -65,6 +65,7 @@
this.btnTestThings = new System.Windows.Forms.Button();
this.btnFrXMLTo = new System.Windows.Forms.Button();
this.btnCrossref = new System.Windows.Forms.Button();
+ this.chkBackupVars = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// button1
@@ -454,11 +455,23 @@
this.btnCrossref.UseVisualStyleBackColor = true;
this.btnCrossref.Click += new System.EventHandler(this.btnCrossref_Click);
//
+ // chkBackupVars
+ //
+ 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(109, 664);
+ this.chkBackupVars.Name = "chkBackupVars";
+ 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(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(951, 693);
+ this.Controls.Add(this.chkBackupVars);
this.Controls.Add(this.btnCrossref);
this.Controls.Add(this.btnFrXMLTo);
this.Controls.Add(this.btnTestThings);
@@ -542,6 +555,7 @@
private System.Windows.Forms.Button btnTestThings;
private System.Windows.Forms.Button btnFrXMLTo;
private System.Windows.Forms.Button btnCrossref;
+ private System.Windows.Forms.CheckBox chkBackupVars;
}
}
diff --git a/CobXmlSupport/GenCobCode.cs b/CobXmlSupport/GenCobCode.cs
index cc62c81..ea01e87 100644
--- a/CobXmlSupport/GenCobCode.cs
+++ b/CobXmlSupport/GenCobCode.cs
@@ -1049,6 +1049,7 @@ namespace CobXmlSupport
setWindow.LogPost = S.ettingLogVarName;
setWindow.LogSection = S.ettingLogSectName;
setWindow.ChkShowTestbtns = S.ettingSpecials;
+ setWindow.ChkBackupOwnCode = S.ettingUserCodeBcup;
setWindow.ShowDialog();
S.ettingUserName = setWindow.UserName;
@@ -1068,6 +1069,7 @@ namespace CobXmlSupport
S.ettingLogVarName = setWindow.LogPost;
S.ettingLogSectName = setWindow.LogSection;
S.ettingSpecials = setWindow.ChkShowTestbtns;
+ S.ettingUserCodeBcup = setWindow.ChkBackupOwnCode;
chkAnaTag.Checked = S.ettingAnaTag;
chkCountVars.Checked = S.ettingCountVars;
@@ -1082,6 +1084,8 @@ namespace CobXmlSupport
txtPrefix.Text = S.ettingPrefix;
txtExpPrefix.Text = S.ettingExpPrefix;
btnTestThings.Visible = S.ettingSpecials;
+ chkBackupVars.Checked = S.ettingUserCodeBcup;
+
eventRun = false;
runXMLgen();
@@ -1185,7 +1189,15 @@ namespace CobXmlSupport
// Until here---
- genExtMoves.CodeShower.Text += "\r\n MOVE 0 TO " + cr.CountIn;
+ genExtMoves.CodeShower.Text += "\r\n MOVE ";
+
+ if (cr.MoveCode.Trim().Length != 0)
+ genExtMoves.CodeShower.Text += "1";
+ else
+ genExtMoves.CodeShower.Text += "0";
+
+ genExtMoves.CodeShower.Text += " TO " + cr.CountIn;
+
if (occParRows.Length > 0)
{
genExtMoves.CodeShower.Text += " (" + occParRows + " )";
@@ -1203,17 +1215,27 @@ namespace CobXmlSupport
CobRow crTmp = cr;
struktMove += "\r\n " + "".PadLeft(prfNiv) + " <" + cr.TagName.Replace("\"", "") + "> (" + cr.FieldName + ")";
- genExtMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "MOVE ";
+ genExtMoves.CodeShower.Text += "\r\n " + adjustIf(adj);
//------------- move from --------------
- if (cr.FieldDef.ToUpper().IndexOf("X") > -1)
+ if (cr.MoveCode.Length > 1 && cr.MoveCode != " ")
{
- genExtMoves.CodeShower.Text += "MoveToStringVar ";
+ if (cr.MoveCode.ToUpper().Contains("MOVE")) {}
+ else genExtMoves.CodeShower.Text += "MOVE ";
+ genExtMoves.CodeShower.Text += cr.MoveCode;
}
else
{
- genExtMoves.CodeShower.Text += "MoveToNumVar ";
+ if (cr.FieldDef.ToUpper().IndexOf("X") > -1)
+ {
+ genExtMoves.CodeShower.Text += "MOVE MoveToStringVar ";
+ }
+ else
+ {
+ genExtMoves.CodeShower.Text += "MOVE MoveToNumVar ";
+ }
}
- genExtMoves.CodeShower.Text += " *> #" + cr.FieldName + "#";
+ genExtMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + " *> #" + cr.FieldName + "#";
+
//------------- move to ---------------
genExtMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "TO " + cr.FieldName;
genExtMoves.CodeShower.Text = checkForOccurs(indexNames, cr, genExtMoves.CodeShower.Text, ref occParRows, ref slask, false, adj);
diff --git a/CobXmlSupport/Properties/Settings.Designer.cs b/CobXmlSupport/Properties/Settings.Designer.cs
index 27485f8..a1fa6ca 100644
--- a/CobXmlSupport/Properties/Settings.Designer.cs
+++ b/CobXmlSupport/Properties/Settings.Designer.cs
@@ -229,5 +229,17 @@ namespace CobXmlSupport.Properties {
this["ShowTestbtns"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool BackupOwnCode {
+ get {
+ return ((bool)(this["BackupOwnCode"]));
+ }
+ set {
+ this["BackupOwnCode"] = value;
+ }
+ }
}
}
diff --git a/CobXmlSupport/Properties/Settings.settings b/CobXmlSupport/Properties/Settings.settings
index a5d3aff..ab654ab 100644
--- a/CobXmlSupport/Properties/Settings.settings
+++ b/CobXmlSupport/Properties/Settings.settings
@@ -56,5 +56,8 @@
False
+
+ True
+
\ No newline at end of file
diff --git a/CobXmlSupport/S.cs b/CobXmlSupport/S.cs
index e49bcd1..cea8f6f 100644
--- a/CobXmlSupport/S.cs
+++ b/CobXmlSupport/S.cs
@@ -24,6 +24,7 @@ namespace CobXmlSupport
public static string ettingLogVarName;
public static string ettingLogSectName;
public static bool ettingSpecials;
+ public static bool ettingUserCodeBcup;
//-------------------------
}
}
diff --git a/CobXmlSupport/ShowCode.cs b/CobXmlSupport/ShowCode.cs
index 0765f06..c10e286 100644
--- a/CobXmlSupport/ShowCode.cs
+++ b/CobXmlSupport/ShowCode.cs
@@ -106,13 +106,23 @@ namespace CobXmlSupport
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";
+
+ string backupfile;
+ if (S.ettingUserCodeBcup)
+ {
+ 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";
+ }
+ else {
+ backupfile = inPath + inFile.Substring(0, inFile.LastIndexOf(".")) + ".backup.cvs";
+ File.Delete(backupfile);
+ }
+
File.Move(inPath + codeFile, backupfile );//+ DateTime.Now.ToString());
File.WriteAllText(inPath + codeFile, codeComplInit);
diff --git a/CobXmlSupport/frmSettings.Designer.cs b/CobXmlSupport/frmSettings.Designer.cs
index 4eaff8f..71eda9d 100644
--- a/CobXmlSupport/frmSettings.Designer.cs
+++ b/CobXmlSupport/frmSettings.Designer.cs
@@ -58,6 +58,7 @@
this.label7 = new System.Windows.Forms.Label();
this.specials = new System.Windows.Forms.GroupBox();
this.chkShowTestbtns = new System.Windows.Forms.CheckBox();
+ this.chkBackupOwnCode = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.specials.SuspendLayout();
@@ -339,6 +340,7 @@
//
// specials
//
+ this.specials.Controls.Add(this.chkBackupOwnCode);
this.specials.Controls.Add(this.chkShowTestbtns);
this.specials.Location = new System.Drawing.Point(325, 216);
this.specials.Name = "specials";
@@ -357,6 +359,16 @@
this.chkShowTestbtns.Text = "visa testknapp";
this.chkShowTestbtns.UseVisualStyleBackColor = true;
//
+ // chkBackupOwnCode
+ //
+ this.chkBackupOwnCode.AutoSize = true;
+ this.chkBackupOwnCode.Location = new System.Drawing.Point(7, 44);
+ this.chkBackupOwnCode.Name = "chkBackupOwnCode";
+ this.chkBackupOwnCode.Size = new System.Drawing.Size(129, 17);
+ this.chkBackupOwnCode.TabIndex = 1;
+ this.chkBackupOwnCode.Text = "Backup av Egna vars";
+ this.chkBackupOwnCode.UseVisualStyleBackColor = true;
+ //
// frmSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -419,5 +431,6 @@
private System.Windows.Forms.Label label8;
private System.Windows.Forms.GroupBox specials;
private System.Windows.Forms.CheckBox chkShowTestbtns;
+ private System.Windows.Forms.CheckBox chkBackupOwnCode;
}
}
\ No newline at end of file
diff --git a/CobXmlSupport/frmSettings.cs b/CobXmlSupport/frmSettings.cs
index 34f25fe..71c34e7 100644
--- a/CobXmlSupport/frmSettings.cs
+++ b/CobXmlSupport/frmSettings.cs
@@ -22,6 +22,7 @@ namespace CobXmlSupport
private bool tmpChkAnaTag;
private bool tmpChkCountVars;
private bool tmpShowTestBtns;
+ private bool tmpBackupOwnCode;
private string tmpTxtPrefix;
private string tmpTxtExpPrefix;
private string tmpTxtMaxOcc;
@@ -184,6 +185,18 @@ namespace CobXmlSupport
}
}
+ public bool ChkBackupOwnCode
+ {
+ get
+ {
+ return chkBackupOwnCode.Checked;
+ }
+ set
+ {
+ chkBackupOwnCode.Checked = value;
+ }
+ }
+
public string TxtMaxOcc
{
get
@@ -234,6 +247,7 @@ namespace CobXmlSupport
Properties.Settings.Default.Values = chkValues.Checked;
Properties.Settings.Default.Wrap = chkWrap.Checked;
Properties.Settings.Default.ShowTestbtns= chkShowTestbtns.Checked;
+ Properties.Settings.Default.BackupOwnCode = chkBackupOwnCode.Checked;
Properties.Settings.Default.LogVarName = txtLogPost.Text;
Properties.Settings.Default.LogSectName = txtLogSection.Text;
Properties.Settings.Default.Save();
@@ -253,6 +267,7 @@ namespace CobXmlSupport
tmpChkValues = chkValues.Checked;
tmpChkAnaTag = chkAnaTag.Checked;
tmpShowTestBtns = chkShowTestbtns.Checked;
+ tmpBackupOwnCode = chkBackupOwnCode.Checked;
tmpTxtPrefix = txtPrefix.Text;
tmpTxtExpPrefix = txtExpPrefix.Text;
tmpTxtMaxOcc = txtMaxOcc.Text;
@@ -274,7 +289,8 @@ namespace CobXmlSupport
chkValues.Checked= tmpChkValues;
chkAnaTag.Checked= tmpChkAnaTag;
chkShowTestbtns.Checked = tmpShowTestBtns;
- txtPrefix.Text= tmpTxtPrefix;
+ chkBackupOwnCode.Checked = tmpBackupOwnCode;
+ txtPrefix.Text = tmpTxtPrefix;
txtExpPrefix.Text = tmpTxtExpPrefix;
txtMaxOcc.Text = tmpTxtMaxOcc;
txtLogPost.Text= txtLogVarNameTmp;