backup switch, adjustment codeintegration

This commit is contained in:
2015-01-15 12:11:08 +01:00
parent bc880ed2ed
commit ac8375e78c
9 changed files with 108 additions and 14 deletions

View File

@ -67,6 +67,9 @@
<setting name="ShowTestbtns" serializeAs="String">
<value>False</value>
</setting>
<setting name="BackupOwnCode" serializeAs="String">
<value>True</value>
</setting>
</CobXmlSupport.Properties.Settings>
<XMLPlayAround.Properties.Settings>
<setting name="LastFile" serializeAs="Xml">

View File

@ -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;
}
}

View File

@ -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 ";
}
genExtMoves.CodeShower.Text += " *> #" + cr.FieldName + "#";
else
{
genExtMoves.CodeShower.Text += "MOVE MoveToNumVar ";
}
}
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);

View File

@ -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;
}
}
}
}

View File

@ -56,5 +56,8 @@
<Setting Name="ShowTestbtns" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="BackupOwnCode" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -24,6 +24,7 @@ namespace CobXmlSupport
public static string ettingLogVarName;
public static string ettingLogSectName;
public static bool ettingSpecials;
public static bool ettingUserCodeBcup;
//-------------------------
}
}

View File

@ -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(".")) + "." +
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);

View File

@ -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;
}
}

View File

@ -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,6 +289,7 @@ namespace CobXmlSupport
chkValues.Checked= tmpChkValues;
chkAnaTag.Checked= tmpChkAnaTag;
chkShowTestbtns.Checked = tmpShowTestBtns;
chkBackupOwnCode.Checked = tmpBackupOwnCode;
txtPrefix.Text = tmpTxtPrefix;
txtExpPrefix.Text = tmpTxtExpPrefix;
txtMaxOcc.Text = tmpTxtMaxOcc;