This commit is contained in:
2014-12-10 20:57:42 +01:00
9 changed files with 232 additions and 64 deletions

View File

@ -2,6 +2,7 @@
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="CobXmlSupport.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="XMLPlayAround.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
@ -9,6 +10,64 @@
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<userSettings>
<CobXmlSupport.Properties.Settings>
<setting name="LastFile" serializeAs="Xml">
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>@"C:\testdata\Reengineering\FD_GetVehicleHistory.xml"</string>
</ArrayOfString>
</value>
</setting>
<setting name="UserName" serializeAs="String">
<value>Tommy Öman</value>
</setting>
<setting name="CompanyName" serializeAs="String">
<value>Fordonsdata Nordic AB</value>
</setting>
<setting name="NoNsRef" serializeAs="String">
<value>False</value>
</setting>
<setting name="UniqueVars" serializeAs="String">
<value>False</value>
</setting>
<setting name="UniqueAttrVars" serializeAs="String">
<value>False</value>
</setting>
<setting name="Unique" serializeAs="String">
<value>False</value>
</setting>
<setting name="Wrap" serializeAs="String">
<value>False</value>
</setting>
<setting name="Values" serializeAs="String">
<value>False</value>
</setting>
<setting name="AnaTag" serializeAs="String">
<value>False</value>
</setting>
<setting name="Prefix" serializeAs="String">
<value>GWM_</value>
</setting>
<setting name="MaxOcc" serializeAs="String">
<value>25</value>
</setting>
<setting name="CountVars" serializeAs="String">
<value>False</value>
</setting>
<setting name="LogVarName" serializeAs="String">
<value>Logg-post</value>
</setting>
<setting name="LogSectName" serializeAs="String">
<value>UpdateLogFile</value>
</setting>
<setting name="ExpPrefix" serializeAs="String">
<value>GWX_</value>
</setting>
<setting name="ShowTestbtns" serializeAs="String">
<value>False</value>
</setting>
</CobXmlSupport.Properties.Settings>
<XMLPlayAround.Properties.Settings>
<setting name="LastFile" serializeAs="Xml">
<value>

View File

@ -88,6 +88,7 @@
<EmbeddedResource Include="ShowCode.resx">
<DependentUpon>ShowCode.cs</DependentUpon>
</EmbeddedResource>
<None Include="App.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

View File

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

View File

@ -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,53 +1687,74 @@ 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<string, string> testIndexes = new Dictionary<string, string>();
IndexState lIs = new IndexState(testIndexes,rowList);
//if (qldList == null)
//{
IndexState lIs = new IndexState(testIndexes, rowList);
qldList = new List<qualifieldhlp>();
//}
//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)
{
//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 != "")
//{
//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 {
loopTyp = tmpQfh.qualCobRow.isOccurs ;//&& tmpQfh.qualCobRow.FieldDef == "";
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();
@ -1739,20 +1767,34 @@ namespace CobXmlSupport
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();
}
}
}

View File

@ -8,27 +8,17 @@
// </auto-generated>
//------------------------------------------------------------------------------
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;
}
}
}
}

View File

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="CobXmlSupport.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="LastFile" Type="System.Collections.Specialized.StringCollection" Scope="User">
@ -53,5 +53,8 @@
<Setting Name="ExpPrefix" Type="System.String" Scope="User">
<Value Profile="(Default)">GWX_</Value>
</Setting>
<Setting Name="ShowTestbtns" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

View File

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

View File

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

View File

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