Compare commits

...

10 Commits

41 changed files with 60509 additions and 402 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,8 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012 # Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CobXmlSupport", "CobXmlSupport\CobXmlSupport.csproj", "{847B8069-1ED4-41A8-B17D-EA6F596895D5}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CobXmlSupport", "CobXmlSupport\CobXmlSupport.csproj", "{847B8069-1ED4-41A8-B17D-EA6F596895D5}"
EndProject EndProject
Global Global

View File

@ -15,7 +15,7 @@
<value> <value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>@"C:\testdata\Reengineering\FD_GetVehicleHistory.xml"</string> <string>C:\testdata\Reengineering\FD_GetVehicleHistory.xml</string>
</ArrayOfString> </ArrayOfString>
</value> </value>
</setting> </setting>

View File

@ -91,7 +91,7 @@ namespace CobXmlSupport
try try
{ {
ShowCode FileWin = new ShowCode(); ShowCode FileWin = new ShowCode();
FileWin.Parent = null; FileWin.FormParent = null;
//FileWin.Labeltext = usageName; //FileWin.Labeltext = usageName;
FileWin.Labeltext = fname; FileWin.Labeltext = fname;
FileWin.CodeShower.Text = File.ReadAllText(fname); FileWin.CodeShower.Text = File.ReadAllText(fname);

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Diagnostics; using System.Diagnostics;
using System.Reflection;
namespace CobXmlSupport namespace CobXmlSupport
{ {
@ -59,7 +60,6 @@ namespace CobXmlSupport
return " *" + S.strX(' ', 72 - 15 - this.FieldName.Length) + "------" + this.FieldName + "\r\n" + return " *" + S.strX(' ', 72 - 15 - this.FieldName.Length) + "------" + this.FieldName + "\r\n" +
moveCode + moveCode +
"\r\n *" + S.strX(' ', 72 - 15 - this.FieldName.Length) + "------" + this.FieldName + "\r\n"; "\r\n *" + S.strX(' ', 72 - 15 - this.FieldName.Length) + "------" + this.FieldName + "\r\n";
} }
set{ set{
moveCode = value; moveCode = value;
@ -86,6 +86,11 @@ namespace CobXmlSupport
} }
set{ set{
moveFromCode = value; moveFromCode = value;
// Debug för att se var datat fyll på
//StackTrace stackTrace = new StackTrace();
//MethodBase methBase = stackTrace.GetFrame(1).GetMethod();
//Debug.WriteLine("MoveFromCode -> "+ methBase.Name.ToString() + " calls MoveFromCode saving " + value);
// Debug för att se var datat fyll på
} }
} }
//Holding code-parts used when generating moves, from structure //Holding code-parts used when generating moves, from structure

View File

@ -84,6 +84,7 @@
<DependentUpon>SaveRegCopyFile.cs</DependentUpon> <DependentUpon>SaveRegCopyFile.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="SaverListener.cs" /> <Compile Include="SaverListener.cs" />
<Compile Include="Settings.cs" />
<Compile Include="ShowCode.cs"> <Compile Include="ShowCode.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>

View File

@ -28,6 +28,7 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GenCobCode)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GenCobCode));
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.outText = new System.Windows.Forms.TextBox(); this.outText = new System.Windows.Forms.TextBox();
@ -59,6 +60,9 @@
this.chkBackupVars = new System.Windows.Forms.CheckBox(); this.chkBackupVars = new System.Windows.Forms.CheckBox();
this.btnRerun = new System.Windows.Forms.Button(); this.btnRerun = new System.Windows.Forms.Button();
this.grpProduce = new System.Windows.Forms.GroupBox(); this.grpProduce = new System.Windows.Forms.GroupBox();
this.chkEvents = new System.Windows.Forms.CheckBox();
this.btnMoveFromAttr = new System.Windows.Forms.Button();
this.btnXmlKopAttr = new System.Windows.Forms.Button();
this.btnFrXMLTo = new System.Windows.Forms.Button(); this.btnFrXMLTo = new System.Windows.Forms.Button();
this.chkAttribs = new System.Windows.Forms.CheckBox(); this.chkAttribs = new System.Windows.Forms.CheckBox();
this.chkNewArea = new System.Windows.Forms.CheckBox(); this.chkNewArea = new System.Windows.Forms.CheckBox();
@ -71,6 +75,7 @@
this.grpSettings = new System.Windows.Forms.GroupBox(); this.grpSettings = new System.Windows.Forms.GroupBox();
this.btnSaveArea = new System.Windows.Forms.Button(); this.btnSaveArea = new System.Windows.Forms.Button();
this.btnShowWorkFiles = new System.Windows.Forms.Button(); this.btnShowWorkFiles = new System.Windows.Forms.Button();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.grpProduce.SuspendLayout(); this.grpProduce.SuspendLayout();
this.grpSettings.SuspendLayout(); this.grpSettings.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -94,7 +99,7 @@
this.outText.Multiline = true; this.outText.Multiline = true;
this.outText.Name = "outText"; this.outText.Name = "outText";
this.outText.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.outText.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.outText.Size = new System.Drawing.Size(380, 418); this.outText.Size = new System.Drawing.Size(380, 445);
this.outText.TabIndex = 1; this.outText.TabIndex = 1;
this.outText.WordWrap = false; this.outText.WordWrap = false;
// //
@ -108,7 +113,7 @@
this.outCob.Multiline = true; this.outCob.Multiline = true;
this.outCob.Name = "outCob"; this.outCob.Name = "outCob";
this.outCob.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.outCob.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.outCob.Size = new System.Drawing.Size(545, 416); this.outCob.Size = new System.Drawing.Size(545, 443);
this.outCob.TabIndex = 2; this.outCob.TabIndex = 2;
this.outCob.WordWrap = false; this.outCob.WordWrap = false;
this.outCob.KeyDown += new System.Windows.Forms.KeyEventHandler(this.outCob_KeyDown); this.outCob.KeyDown += new System.Windows.Forms.KeyEventHandler(this.outCob_KeyDown);
@ -136,7 +141,7 @@
// btnClose // btnClose
// //
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.Location = new System.Drawing.Point(880, 628); this.btnClose.Location = new System.Drawing.Point(880, 688);
this.btnClose.Name = "btnClose"; this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(72, 23); this.btnClose.Size = new System.Drawing.Size(72, 23);
this.btnClose.TabIndex = 6; this.btnClose.TabIndex = 6;
@ -308,12 +313,13 @@
// btnSettings // btnSettings
// //
this.btnSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnSettings.Location = new System.Drawing.Point(9, 17); this.btnSettings.Location = new System.Drawing.Point(9, 37);
this.btnSettings.Margin = new System.Windows.Forms.Padding(2); this.btnSettings.Margin = new System.Windows.Forms.Padding(2);
this.btnSettings.Name = "btnSettings"; this.btnSettings.Name = "btnSettings";
this.btnSettings.Size = new System.Drawing.Size(81, 23); this.btnSettings.Size = new System.Drawing.Size(81, 23);
this.btnSettings.TabIndex = 26; this.btnSettings.TabIndex = 26;
this.btnSettings.Text = "Inställningar"; this.btnSettings.Text = "Inställningar";
this.toolTip1.SetToolTip(this.btnSettings, "Välj bestående inställningar för vissa funktioner.");
this.btnSettings.UseVisualStyleBackColor = true; this.btnSettings.UseVisualStyleBackColor = true;
this.btnSettings.Click += new System.EventHandler(this.btnSettings_Click); this.btnSettings.Click += new System.EventHandler(this.btnSettings_Click);
// //
@ -338,7 +344,7 @@
// btnTestThings // btnTestThings
// //
this.btnTestThings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnTestThings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnTestThings.Location = new System.Drawing.Point(9, 41); this.btnTestThings.Location = new System.Drawing.Point(9, 74);
this.btnTestThings.Name = "btnTestThings"; this.btnTestThings.Name = "btnTestThings";
this.btnTestThings.Size = new System.Drawing.Size(81, 23); this.btnTestThings.Size = new System.Drawing.Size(81, 23);
this.btnTestThings.TabIndex = 33; this.btnTestThings.TabIndex = 33;
@ -349,7 +355,7 @@
// btnCrossref // btnCrossref
// //
this.btnCrossref.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnCrossref.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnCrossref.Location = new System.Drawing.Point(93, 17); this.btnCrossref.Location = new System.Drawing.Point(95, 37);
this.btnCrossref.Name = "btnCrossref"; this.btnCrossref.Name = "btnCrossref";
this.btnCrossref.Size = new System.Drawing.Size(81, 23); this.btnCrossref.Size = new System.Drawing.Size(81, 23);
this.btnCrossref.TabIndex = 35; this.btnCrossref.TabIndex = 35;
@ -361,11 +367,12 @@
// //
this.chkBackupVars.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.chkBackupVars.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.chkBackupVars.AutoSize = true; this.chkBackupVars.AutoSize = true;
this.chkBackupVars.Location = new System.Drawing.Point(96, 45); this.chkBackupVars.Location = new System.Drawing.Point(96, 78);
this.chkBackupVars.Name = "chkBackupVars"; this.chkBackupVars.Name = "chkBackupVars";
this.chkBackupVars.Size = new System.Drawing.Size(87, 17); this.chkBackupVars.Size = new System.Drawing.Size(87, 17);
this.chkBackupVars.TabIndex = 36; this.chkBackupVars.TabIndex = 36;
this.chkBackupVars.Text = "Backup Vars"; this.chkBackupVars.Text = "Backup Vars";
this.toolTip1.SetToolTip(this.chkBackupVars, "Få en ny backup för varje tillfälle för editering av kodkomplettering (json)");
this.chkBackupVars.UseVisualStyleBackColor = true; this.chkBackupVars.UseVisualStyleBackColor = true;
this.chkBackupVars.CheckedChanged += new System.EventHandler(this.chkBackupVars_CheckedChanged); this.chkBackupVars.CheckedChanged += new System.EventHandler(this.chkBackupVars_CheckedChanged);
// //
@ -383,6 +390,9 @@
// //
this.grpProduce.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) this.grpProduce.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.grpProduce.Controls.Add(this.chkEvents);
this.grpProduce.Controls.Add(this.btnMoveFromAttr);
this.grpProduce.Controls.Add(this.btnXmlKopAttr);
this.grpProduce.Controls.Add(this.btnFrXMLTo); this.grpProduce.Controls.Add(this.btnFrXMLTo);
this.grpProduce.Controls.Add(this.chkAttribs); this.grpProduce.Controls.Add(this.chkAttribs);
this.grpProduce.Controls.Add(this.chkNewArea); this.grpProduce.Controls.Add(this.chkNewArea);
@ -392,21 +402,60 @@
this.grpProduce.Controls.Add(this.btnMoveFrom); this.grpProduce.Controls.Add(this.btnMoveFrom);
this.grpProduce.Controls.Add(this.btnMoves); this.grpProduce.Controls.Add(this.btnMoves);
this.grpProduce.Controls.Add(this.btnGenICode); this.grpProduce.Controls.Add(this.btnGenICode);
this.grpProduce.Location = new System.Drawing.Point(406, 545); this.grpProduce.Location = new System.Drawing.Point(407, 572);
this.grpProduce.Name = "grpProduce"; this.grpProduce.Name = "grpProduce";
this.grpProduce.Size = new System.Drawing.Size(545, 77); this.grpProduce.Size = new System.Drawing.Size(545, 110);
this.grpProduce.TabIndex = 38; this.grpProduce.TabIndex = 38;
this.grpProduce.TabStop = false; this.grpProduce.TabStop = false;
this.grpProduce.Text = "Producera"; this.grpProduce.Text = "Producera";
// //
// chkEvents
//
this.chkEvents.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkEvents.AutoSize = true;
this.chkEvents.Location = new System.Drawing.Point(389, 86);
this.chkEvents.Name = "chkEvents";
this.chkEvents.Size = new System.Drawing.Size(90, 17);
this.chkEvents.TabIndex = 46;
this.chkEvents.Text = "skapa events";
this.toolTip1.SetToolTip(this.chkEvents, resources.GetString("chkEvents.ToolTip"));
this.chkEvents.UseVisualStyleBackColor = true;
//
// btnMoveFromAttr
//
this.btnMoveFromAttr.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnMoveFromAttr.Location = new System.Drawing.Point(290, 36);
this.btnMoveFromAttr.Name = "btnMoveFromAttr";
this.btnMoveFromAttr.Size = new System.Drawing.Size(92, 22);
this.btnMoveFromAttr.TabIndex = 45;
this.btnMoveFromAttr.Text = "G. Mov. Fr.+Attr";
this.toolTip1.SetToolTip(this.btnMoveFromAttr, "Generera kod för att insamla kod från inläst xml enligt \r\naktuell xml-copy (även " +
"variabler som refererar till attribut \r\ni xml-taggar skapas)");
this.btnMoveFromAttr.UseVisualStyleBackColor = true;
this.btnMoveFromAttr.Click += new System.EventHandler(this.btnMoveFromAttr_Click);
//
// btnXmlKopAttr
//
this.btnXmlKopAttr.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnXmlKopAttr.Location = new System.Drawing.Point(290, 82);
this.btnXmlKopAttr.Name = "btnXmlKopAttr";
this.btnXmlKopAttr.Size = new System.Drawing.Size(92, 22);
this.btnXmlKopAttr.TabIndex = 44;
this.btnXmlKopAttr.Text = "Kop XML+Attr";
this.toolTip1.SetToolTip(this.btnXmlKopAttr, "Samma som för knappen \'Kopiera XML\' men med tillägget att \r\nhär kopieras alla fäl" +
"t , även attribut ...");
this.btnXmlKopAttr.UseVisualStyleBackColor = true;
this.btnXmlKopAttr.Click += new System.EventHandler(this.btnXmlKopAttr_Click);
//
// btnFrXMLTo // btnFrXMLTo
// //
this.btnFrXMLTo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnFrXMLTo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnFrXMLTo.Location = new System.Drawing.Point(297, 49); this.btnFrXMLTo.Location = new System.Drawing.Point(290, 60);
this.btnFrXMLTo.Name = "btnFrXMLTo"; this.btnFrXMLTo.Name = "btnFrXMLTo";
this.btnFrXMLTo.Size = new System.Drawing.Size(92, 22); this.btnFrXMLTo.Size = new System.Drawing.Size(92, 22);
this.btnFrXMLTo.TabIndex = 43; this.btnFrXMLTo.TabIndex = 43;
this.btnFrXMLTo.Text = "Kopiera XML"; this.btnFrXMLTo.Text = "Kopiera XML";
this.toolTip1.SetToolTip(this.btnFrXMLTo, resources.GetString("btnFrXMLTo.ToolTip"));
this.btnFrXMLTo.UseVisualStyleBackColor = true; this.btnFrXMLTo.UseVisualStyleBackColor = true;
this.btnFrXMLTo.Click += new System.EventHandler(this.btnFrXMLTo_Click); this.btnFrXMLTo.Click += new System.EventHandler(this.btnFrXMLTo_Click);
// //
@ -414,7 +463,7 @@
// //
this.chkAttribs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkAttribs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkAttribs.AutoSize = true; this.chkAttribs.AutoSize = true;
this.chkAttribs.Location = new System.Drawing.Point(396, 54); this.chkAttribs.Location = new System.Drawing.Point(389, 65);
this.chkAttribs.Name = "chkAttribs"; this.chkAttribs.Name = "chkAttribs";
this.chkAttribs.Size = new System.Drawing.Size(85, 17); this.chkAttribs.Size = new System.Drawing.Size(85, 17);
this.chkAttribs.TabIndex = 42; this.chkAttribs.TabIndex = 42;
@ -426,24 +475,26 @@
// //
this.chkNewArea.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkNewArea.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkNewArea.AutoSize = true; this.chkNewArea.AutoSize = true;
this.chkNewArea.Location = new System.Drawing.Point(395, 21); this.chkNewArea.Location = new System.Drawing.Point(388, 32);
this.chkNewArea.Name = "chkNewArea"; this.chkNewArea.Name = "chkNewArea";
this.chkNewArea.Size = new System.Drawing.Size(64, 17); this.chkNewArea.Size = new System.Drawing.Size(64, 17);
this.chkNewArea.TabIndex = 41; this.chkNewArea.TabIndex = 41;
this.chkNewArea.Text = "Till Area"; this.chkNewArea.Text = "Till Area";
this.chkNewArea.UseVisualStyleBackColor = true; this.chkNewArea.UseVisualStyleBackColor = true;
this.chkNewArea.Visible = false; this.chkNewArea.Visible = false;
this.chkNewArea.CheckedChanged += new System.EventHandler(this.chkNewArea_CheckedChanged);
// //
// chkMvToDisp // chkMvToDisp
// //
this.chkMvToDisp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkMvToDisp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkMvToDisp.AutoSize = true; this.chkMvToDisp.AutoSize = true;
this.chkMvToDisp.Location = new System.Drawing.Point(219, 38); this.chkMvToDisp.Location = new System.Drawing.Point(212, 49);
this.chkMvToDisp.Name = "chkMvToDisp"; this.chkMvToDisp.Name = "chkMvToDisp";
this.chkMvToDisp.Size = new System.Drawing.Size(71, 17); this.chkMvToDisp.Size = new System.Drawing.Size(71, 17);
this.chkMvToDisp.TabIndex = 40; this.chkMvToDisp.TabIndex = 40;
this.chkMvToDisp.Text = "(Displays)"; this.chkMvToDisp.Text = "(Displays)";
this.toolTip1.SetToolTip(this.chkMvToDisp, "Om både Checkboxen Perform och (Displays) är markerade fås \r\ndisplayer av aktuell" +
" sökväg (kvalificering) till varje variabel.\r\n(planen är att resultatet av inför" +
"d kod också skall visas då)");
this.chkMvToDisp.UseVisualStyleBackColor = true; this.chkMvToDisp.UseVisualStyleBackColor = true;
this.chkMvToDisp.CheckedChanged += new System.EventHandler(this.chkMvToDisp_CheckedChanged); this.chkMvToDisp.CheckedChanged += new System.EventHandler(this.chkMvToDisp_CheckedChanged);
// //
@ -451,11 +502,14 @@
// //
this.chkPerform.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkPerform.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkPerform.AutoSize = true; this.chkPerform.AutoSize = true;
this.chkPerform.Location = new System.Drawing.Point(219, 21); this.chkPerform.Location = new System.Drawing.Point(212, 32);
this.chkPerform.Name = "chkPerform"; this.chkPerform.Name = "chkPerform";
this.chkPerform.Size = new System.Drawing.Size(62, 17); this.chkPerform.Size = new System.Drawing.Size(62, 17);
this.chkPerform.TabIndex = 39; this.chkPerform.TabIndex = 39;
this.chkPerform.Text = "Perform"; this.chkPerform.Text = "Perform";
this.toolTip1.SetToolTip(this.chkPerform, "Om ikryssad; generera koden så att varje möjlig tag \r\ni xml-en genomlöps via \"per" +
"form varying ...\" för varje\r\nmultipel förekomst . (jmf. 1-*, 0-*, 0-15... i xml-" +
"instruktionerna)");
this.chkPerform.UseVisualStyleBackColor = true; this.chkPerform.UseVisualStyleBackColor = true;
this.chkPerform.CheckedChanged += new System.EventHandler(this.chkPerform_CheckedChanged); this.chkPerform.CheckedChanged += new System.EventHandler(this.chkPerform_CheckedChanged);
// //
@ -464,11 +518,13 @@
this.chkDisplays.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.chkDisplays.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkDisplays.AutoSize = true; this.chkDisplays.AutoSize = true;
this.chkDisplays.Enabled = false; this.chkDisplays.Enabled = false;
this.chkDisplays.Location = new System.Drawing.Point(396, 38); this.chkDisplays.Location = new System.Drawing.Point(389, 49);
this.chkDisplays.Name = "chkDisplays"; this.chkDisplays.Name = "chkDisplays";
this.chkDisplays.Size = new System.Drawing.Size(71, 17); this.chkDisplays.Size = new System.Drawing.Size(71, 17);
this.chkDisplays.TabIndex = 38; this.chkDisplays.TabIndex = 38;
this.chkDisplays.Text = "(Displays)"; this.chkDisplays.Text = "(Displays)";
this.toolTip1.SetToolTip(this.chkDisplays, "Gäller vid generering kod för tömning av responsareor.\r\nInnebär att alla värden i" +
" filen displayas ut kvalificerat i \r\nloggen ");
this.chkDisplays.UseVisualStyleBackColor = true; this.chkDisplays.UseVisualStyleBackColor = true;
this.chkDisplays.CheckedChanged += new System.EventHandler(this.chkDisplays_CheckedChanged); this.chkDisplays.CheckedChanged += new System.EventHandler(this.chkDisplays_CheckedChanged);
// //
@ -476,11 +532,12 @@
// //
this.btnMoveFrom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnMoveFrom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnMoveFrom.Enabled = false; this.btnMoveFrom.Enabled = false;
this.btnMoveFrom.Location = new System.Drawing.Point(297, 26); this.btnMoveFrom.Location = new System.Drawing.Point(290, 10);
this.btnMoveFrom.Name = "btnMoveFrom"; this.btnMoveFrom.Name = "btnMoveFrom";
this.btnMoveFrom.Size = new System.Drawing.Size(92, 23); this.btnMoveFrom.Size = new System.Drawing.Size(92, 23);
this.btnMoveFrom.TabIndex = 37; this.btnMoveFrom.TabIndex = 37;
this.btnMoveFrom.Text = "Gen Move från"; this.btnMoveFrom.Text = "Gen Move från";
this.toolTip1.SetToolTip(this.btnMoveFrom, "Generera kod för att insamla kod från inläst xml enligt \r\naktuell xml-copy");
this.btnMoveFrom.UseVisualStyleBackColor = true; this.btnMoveFrom.UseVisualStyleBackColor = true;
this.btnMoveFrom.Click += new System.EventHandler(this.btnMoveFrom_Click); this.btnMoveFrom.Click += new System.EventHandler(this.btnMoveFrom_Click);
// //
@ -488,12 +545,13 @@
// //
this.btnMoves.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnMoves.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnMoves.Enabled = false; this.btnMoves.Enabled = false;
this.btnMoves.Location = new System.Drawing.Point(120, 26); this.btnMoves.Location = new System.Drawing.Point(113, 37);
this.btnMoves.Margin = new System.Windows.Forms.Padding(2); this.btnMoves.Margin = new System.Windows.Forms.Padding(2);
this.btnMoves.Name = "btnMoves"; this.btnMoves.Name = "btnMoves";
this.btnMoves.Size = new System.Drawing.Size(93, 23); this.btnMoves.Size = new System.Drawing.Size(93, 23);
this.btnMoves.TabIndex = 36; this.btnMoves.TabIndex = 36;
this.btnMoves.Text = "Gen Move kod"; this.btnMoves.Text = "Gen Move kod";
this.toolTip1.SetToolTip(this.btnMoves, "Skapa kod för ifyllnad av aktuell xml-copy-area\r\n\r\n");
this.btnMoves.UseVisualStyleBackColor = true; this.btnMoves.UseVisualStyleBackColor = true;
this.btnMoves.Click += new System.EventHandler(this.btnMoves_Click); this.btnMoves.Click += new System.EventHandler(this.btnMoves_Click);
// //
@ -501,12 +559,13 @@
// //
this.btnGenICode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnGenICode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnGenICode.Enabled = false; this.btnGenICode.Enabled = false;
this.btnGenICode.Location = new System.Drawing.Point(35, 26); this.btnGenICode.Location = new System.Drawing.Point(28, 37);
this.btnGenICode.Margin = new System.Windows.Forms.Padding(2); this.btnGenICode.Margin = new System.Windows.Forms.Padding(2);
this.btnGenICode.Name = "btnGenICode"; this.btnGenICode.Name = "btnGenICode";
this.btnGenICode.Size = new System.Drawing.Size(81, 23); this.btnGenICode.Size = new System.Drawing.Size(81, 23);
this.btnGenICode.TabIndex = 35; this.btnGenICode.TabIndex = 35;
this.btnGenICode.Text = "Gen Init kod"; this.btnGenICode.Text = "Gen Init kod";
this.toolTip1.SetToolTip(this.btnGenICode, "Generera ett kod-extrakt som fyller attribut i xmlen med defaultvärden");
this.btnGenICode.UseVisualStyleBackColor = true; this.btnGenICode.UseVisualStyleBackColor = true;
this.btnGenICode.Click += new System.EventHandler(this.btnGenICodeNew_Click); this.btnGenICode.Click += new System.EventHandler(this.btnGenICodeNew_Click);
// //
@ -519,9 +578,9 @@
this.grpSettings.Controls.Add(this.btnSettings); this.grpSettings.Controls.Add(this.btnSettings);
this.grpSettings.Controls.Add(this.btnTestThings); this.grpSettings.Controls.Add(this.btnTestThings);
this.grpSettings.Controls.Add(this.btnCrossref); this.grpSettings.Controls.Add(this.btnCrossref);
this.grpSettings.Location = new System.Drawing.Point(21, 545); this.grpSettings.Location = new System.Drawing.Point(21, 572);
this.grpSettings.Name = "grpSettings"; this.grpSettings.Name = "grpSettings";
this.grpSettings.Size = new System.Drawing.Size(379, 77); this.grpSettings.Size = new System.Drawing.Size(379, 110);
this.grpSettings.TabIndex = 39; this.grpSettings.TabIndex = 39;
this.grpSettings.TabStop = false; this.grpSettings.TabStop = false;
this.grpSettings.Text = "Ställ in, testa"; this.grpSettings.Text = "Ställ in, testa";
@ -529,21 +588,23 @@
// btnSaveArea // btnSaveArea
// //
this.btnSaveArea.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnSaveArea.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSaveArea.Location = new System.Drawing.Point(255, 12); this.btnSaveArea.Location = new System.Drawing.Point(255, 37);
this.btnSaveArea.Name = "btnSaveArea"; this.btnSaveArea.Name = "btnSaveArea";
this.btnSaveArea.Size = new System.Drawing.Size(99, 23); this.btnSaveArea.Size = new System.Drawing.Size(99, 23);
this.btnSaveArea.TabIndex = 40; this.btnSaveArea.TabIndex = 40;
this.btnSaveArea.Text = "Spara COB-copy"; this.btnSaveArea.Text = "Spara COB-copy";
this.toolTip1.SetToolTip(this.btnSaveArea, "Spara och registrera den aktuella xml-cob-arean");
this.btnSaveArea.UseVisualStyleBackColor = true; this.btnSaveArea.UseVisualStyleBackColor = true;
this.btnSaveArea.Click += new System.EventHandler(this.btnSaveArea_Click); this.btnSaveArea.Click += new System.EventHandler(this.btnSaveArea_Click);
// //
// btnShowWorkFiles // btnShowWorkFiles
// //
this.btnShowWorkFiles.Location = new System.Drawing.Point(255, 41); this.btnShowWorkFiles.Location = new System.Drawing.Point(255, 63);
this.btnShowWorkFiles.Name = "btnShowWorkFiles"; this.btnShowWorkFiles.Name = "btnShowWorkFiles";
this.btnShowWorkFiles.Size = new System.Drawing.Size(99, 23); this.btnShowWorkFiles.Size = new System.Drawing.Size(99, 23);
this.btnShowWorkFiles.TabIndex = 41; this.btnShowWorkFiles.TabIndex = 41;
this.btnShowWorkFiles.Text = "Arbetsfiler"; this.btnShowWorkFiles.Text = "Arbetsfiler";
this.toolTip1.SetToolTip(this.btnShowWorkFiles, "Se aktuella sparade copy areor, jämför med prodsatta, prodsätt !!");
this.btnShowWorkFiles.UseVisualStyleBackColor = true; this.btnShowWorkFiles.UseVisualStyleBackColor = true;
this.btnShowWorkFiles.Click += new System.EventHandler(this.btnShowWorkFiles_Click); this.btnShowWorkFiles.Click += new System.EventHandler(this.btnShowWorkFiles_Click);
// //
@ -551,7 +612,7 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(963, 659); this.ClientSize = new System.Drawing.Size(963, 719);
this.Controls.Add(this.grpSettings); this.Controls.Add(this.grpSettings);
this.Controls.Add(this.grpProduce); this.Controls.Add(this.grpProduce);
this.Controls.Add(this.btnRerun); this.Controls.Add(this.btnRerun);
@ -637,6 +698,10 @@
private System.Windows.Forms.GroupBox grpSettings; private System.Windows.Forms.GroupBox grpSettings;
private System.Windows.Forms.Button btnSaveArea; private System.Windows.Forms.Button btnSaveArea;
private System.Windows.Forms.Button btnShowWorkFiles; private System.Windows.Forms.Button btnShowWorkFiles;
private System.Windows.Forms.Button btnXmlKopAttr;
private System.Windows.Forms.Button btnMoveFromAttr;
private System.Windows.Forms.CheckBox chkEvents;
private System.Windows.Forms.ToolTip toolTip1;
} }
} }

View File

@ -62,7 +62,7 @@ namespace CobXmlSupport
////------------------------- ////-------------------------
public readonly string NOMOVE = "NoMove"; public readonly string NOMOVE = "NoMove";
private readonly bool MOVEFROM = true; //private readonly bool MOVEFROM = true;
public string FldPref public string FldPref
{ {
@ -109,6 +109,7 @@ namespace CobXmlSupport
private void runXMLgen() private void runXMLgen()
{ {
chkEvents.Checked = false;
if (!formLoading) if (!formLoading)
{ {
btnGenICode.Enabled = false; btnGenICode.Enabled = false;
@ -130,6 +131,12 @@ namespace CobXmlSupport
// setLocalValues(); // setLocalValues();
//} //}
if(!File.Exists(cmbLastFile.Text))
{
runSetWindow(true);
cmbLastFile.Text = S.ettingFilePath + "\\" + S.ettingActualFile;
}
S.ettingFilePath = cmbLastFile.Text.Substring(0, cmbLastFile.Text.LastIndexOf("\\")); S.ettingFilePath = cmbLastFile.Text.Substring(0, cmbLastFile.Text.LastIndexOf("\\"));
uniqueTags = new Dictionary<string, string>(); uniqueTags = new Dictionary<string, string>();
uniqueAttr = new Dictionary<string, string>(); uniqueAttr = new Dictionary<string, string>();
@ -252,14 +259,17 @@ namespace CobXmlSupport
if (Cc.WorkDicOut.TryGetValue(rw.FieldName, out fieldOutCompl)) if (Cc.WorkDicOut.TryGetValue(rw.FieldName, out fieldOutCompl))
{ {
rw.MoveFromCode = fieldOutCompl; rw.MoveFromCode = fieldOutCompl;
//Debug.WriteLine("Existerarnde fält: " + rw.FieldName + " Kod : " + fieldOutCompl);
} }
else else
{ {
Cc.WorkDicOut.Add(rw.FieldName, ""); Cc.WorkDicOut.Add(rw.FieldName, "");
//Debug.WriteLine("Upplagt fält: " + rw.FieldName);
} }
} }
if (rw.Move_FromCode == null) { rw.MoveFromCode = " "; } if (rw.Move_FromCode == null) { rw.MoveFromCode = " "; }
Cc.WorkDicOut[rw.FieldName] = rw.Move_FromCode; Cc.WorkDicOut[rw.FieldName] = rw.Move_FromCode;
FieldList.Add(rw.FieldName, objNr++); FieldList.Add(rw.FieldName, objNr++);
} }
// Prefill with possibly filled out code // Prefill with possibly filled out code
@ -784,6 +794,7 @@ namespace CobXmlSupport
chkWrap.Checked = true; chkWrap.Checked = true;
chkNewArea.Checked = false; chkNewArea.Checked = false;
//chkNewArea.Checked = true; //chkNewArea.Checked = true;
chkEvents.Checked = false;
ClientSizeMinWidth = this.ClientSize.Width; ClientSizeMinWidth = this.ClientSize.Width;
@ -834,6 +845,7 @@ namespace CobXmlSupport
chkValues.Checked = S.ettingValues; chkValues.Checked = S.ettingValues;
chkWrap.Checked = S.ettingWrap; chkWrap.Checked = S.ettingWrap;
btnTestThings.Visible = S.ettingShowTestbtns; btnTestThings.Visible = S.ettingShowTestbtns;
btnCrossref.Visible = S.ettingShowTestbtns;
formLoading = false; formLoading = false;
// cmbLastFile.Text = cmbLastFile.Items[0].ToString(); // cmbLastFile.Text = cmbLastFile.Items[0].ToString();
@ -860,7 +872,7 @@ namespace CobXmlSupport
string IndVarText = " *--------------------------------------------------*\r\n * Extra indexvariabler för occurs-taggar --------*\r\n *--------------------------------------------------*"; string IndVarText = " *--------------------------------------------------*\r\n * Extra indexvariabler för occurs-taggar --------*\r\n *--------------------------------------------------*";
string slask = ""; string slask = "";
genCode = new ShowCode(); genCode = new ShowCode();
genCode.Parent = this; genCode.FormParent = this;
genCode.Labeltext = "Creating Initialization Code"; genCode.Labeltext = "Creating Initialization Code";
savedFile SF = new savedFile(); savedFile SF = new savedFile();
@ -915,9 +927,9 @@ namespace CobXmlSupport
Dictionary<string, string> indexNames = new Dictionary<string, string>(); Dictionary<string, string> indexNames = new Dictionary<string, string>();
//string IndVarText = " *--------------------------------------------------*\r\n * Extra indexvariabler för occurs-taggar --------*\r\n *--------------------------------------------------*"; //string IndVarText = " *--------------------------------------------------*\r\n * Extra indexvariabler för occurs-taggar --------*\r\n *--------------------------------------------------*";
string slask = ""; //string slask = "";
genCode = new ShowCode(); genCode = new ShowCode();
genCode.Parent = this; genCode.FormParent = this;
genCode.Labeltext = "Creating Initialization Code"; genCode.Labeltext = "Creating Initialization Code";
savedFile SF = new savedFile(); savedFile SF = new savedFile();
@ -986,7 +998,7 @@ namespace CobXmlSupport
genCode.CodeShower.Text += " PERFORM VARYING " + indTxt + " FROM 1 BY 1\r\n UNTIL " + genCode.CodeShower.Text += " PERFORM VARYING " + indTxt + " FROM 1 BY 1\r\n UNTIL " +
indTxt + "\r\n > " + tmpQfh.qualCobRow.occNum.ToString() + "\r\n"; // +tmpQfh.indexRedText; indTxt + "\r\n > " + tmpQfh.qualCobRow.occNum.ToString() + "\r\n"; // +tmpQfh.indexRedText;
if (tmpQfh.qualCobRow.isOccurs) slask = ""; //if (tmpQfh.qualCobRow.isOccurs) slask = "";
} }
} }
@ -1222,20 +1234,25 @@ namespace CobXmlSupport
/// <param name="e"></param> /// <param name="e"></param>
private void btnMoveFrom_Click(object sender, EventArgs e) private void btnMoveFrom_Click(object sender, EventArgs e)
{ {
if (chkNewArea.Checked) GenerateFromCode(false);
{ }
CreateMoveDataFromTo();
fromToMoves.Show(); private void GenerateFromCode(bool inclAttr)
} {
else //if (chkNewArea.Checked)
{ //{
// CreateMoveDataFromTo();
// fromToMoves.Show();
//}
//else
//{
if (!chkDisplays.Checked) if (!chkDisplays.Checked)
{ {
savedFile SF = new savedFile(); savedFile SF = new savedFile();
SF.idConnect = "598A5F20-9A8A-415D-81B2-BBFE04465381"; SF.idConnect = "313728E2-F78E-46CC-A448-F6A6F54319AB";
SF.usageName = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Unload"; SF.usageName = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Unload";
SF.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Unload.cbl"; SF.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Unload.cbl";
createXMLMoveCode(SF, true); createXMLMoveCode(SF, true, inclAttr);
} }
else else
{ {
@ -1243,7 +1260,7 @@ namespace CobXmlSupport
CreateMoveFromData(); CreateMoveFromData();
fromMoves.Show(); fromMoves.Show();
} }
} //}
} }
private string adjustIf(bool ifTrue) private string adjustIf(bool ifTrue)
@ -1330,7 +1347,15 @@ namespace CobXmlSupport
if (lNewSize > 0 && lNewSize >= lOldSize) if (lNewSize > 0 && lNewSize >= lOldSize)
{ {
File.Replace(SavePath + "\\FilnamnsDict.new", SavePath + "\\FilnamnsDict.xml", SavePath + "\\FilnamnsDict.old"); try
{
File.Replace(SavePath + "\\FilnamnsDict.new", SavePath + "\\FilnamnsDict.xml", SavePath + "\\FilnamnsDict.old");
}
catch (FileNotFoundException)
{
File.Move(SavePath + "\\FilnamnsDict.new", SavePath + "\\FilnamnsDict.xml");
File.Move(SavePath + "\\FilnamnsDict.xml", SavePath + "\\FilnamnsDict.old");
}
// File.Move(SavePath + "\\FilnamnsDict.xml", SavePath + "\\FilnamnsDict.old"); // File.Move(SavePath + "\\FilnamnsDict.xml", SavePath + "\\FilnamnsDict.old");
// File.Move(SavePath + "\\FilnamnsDict.new", SavePath + "\\FilnamnsDict.xml"); // File.Move(SavePath + "\\FilnamnsDict.new", SavePath + "\\FilnamnsDict.xml");
} }
@ -1413,12 +1438,22 @@ namespace CobXmlSupport
} }
private void btnSettings_Click(object sender, EventArgs e) private void btnSettings_Click(object sender, EventArgs e)
{
runSetWindow();
runXMLgen();
}
private void runSetWindow(bool chooseFile=false)
{ {
if (setWindow == null) if (setWindow == null)
{ {
setWindow = new frmSettings(); setWindow = new frmSettings();
setWindow.SL = this.sl; setWindow.SL = this.sl;
setWindow.SettingObj = new GenSetting(); setWindow.SettingObj = new GenSetting();
if (chooseFile)
{
setWindow.VisaFilVal = chooseFile;
}
} }
eventRun = true; eventRun = true;
@ -1428,7 +1463,6 @@ namespace CobXmlSupport
setLocalValues(); setLocalValues();
eventRun = false; eventRun = false;
runXMLgen();
} }
private void setLocalValues() private void setLocalValues()
@ -1458,6 +1492,8 @@ namespace CobXmlSupport
txtExpPrefix.Refresh(); txtExpPrefix.Refresh();
btnTestThings.Visible = S.ettingShowTestbtns; btnTestThings.Visible = S.ettingShowTestbtns;
btnTestThings.Refresh(); btnTestThings.Refresh();
btnCrossref.Visible = S.ettingShowTestbtns;
btnCrossref.Refresh();
chkBackupVars.Checked = S.ettingUserCodeBcup; chkBackupVars.Checked = S.ettingUserCodeBcup;
chkBackupVars.Refresh(); chkBackupVars.Refresh();
eventRun = false; eventRun = false;
@ -1471,7 +1507,7 @@ namespace CobXmlSupport
string IndVarText = " *--------------------------------------------------*\r\n * Extra indexvariabler för occurs-taggar --------*\r\n *--------------------------------------------------*"; string IndVarText = " *--------------------------------------------------*\r\n * Extra indexvariabler för occurs-taggar --------*\r\n *--------------------------------------------------*";
string slask = ""; string slask = "";
genMoves = new ShowCode(); genMoves = new ShowCode();
genMoves.Parent = this; genMoves.FormParent = this;
genMoves.Labeltext = "Creating \"move to\" Code"; genMoves.Labeltext = "Creating \"move to\" Code";
// CreateComment(genMoves.CodeShower, "Moves to", "Tommy Öman", "Fordonsdata Nordic AB"); // CreateComment(genMoves.CodeShower, "Moves to", "Tommy Öman", "Fordonsdata Nordic AB");
@ -1521,11 +1557,11 @@ namespace CobXmlSupport
string aktIndList = "", slask = "", slask2 = "", struktMove = ""; ; string aktIndList = "", slask = "", slask2 = "", struktMove = ""; ;
IndexState Is = new IndexState(indexNames, rowList); IndexState Is = new IndexState(indexNames, rowList);
genExtMoves = new ShowCode(); genExtMoves = new ShowCode();
genExtMoves.Parent = this; genExtMoves.FormParent = this;
genExtMoves.Labeltext = "Creating \"move to (with loop)\" Code"; genExtMoves.Labeltext = "Creating \"move to (with loop)\" Code";
savedFile SF = new savedFile(); savedFile SF = new savedFile();
SF.idConnect = "6EFF8B31-7F88-4A81-B94E-41D54A3D3197"; SF.idConnect = "5DC1D9E6-DD38-4DD7-9DCB-203ABCE96B47";
SF.usageName = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Load"; SF.usageName = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Load";
SF.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Load.cbl"; SF.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Load.cbl";
genExtMoves.SavedFile = SF; genExtMoves.SavedFile = SF;
@ -1766,7 +1802,7 @@ namespace CobXmlSupport
string aktIndList = "", slask = "", slask2 = ""; string aktIndList = "", slask = "", slask2 = "";
IndexState Is = new IndexState(indexNames, rowList, false); IndexState Is = new IndexState(indexNames, rowList, false);
fromMoves = new ShowCode(); fromMoves = new ShowCode();
fromMoves.Parent = this; fromMoves.FormParent = this;
fromMoves.Labeltext = "Creating \"move from\" Code"; fromMoves.Labeltext = "Creating \"move from\" Code";
savedFile SF = new savedFile(); savedFile SF = new savedFile();
@ -1932,258 +1968,6 @@ namespace CobXmlSupport
return resStr; return resStr;
} }
//******************************************************************************************
// Ny branch newXmlMove created ****************************
//******************************************************************************************
private void CreateMoveDataFromTo()
{
Dictionary<string, string> indexNames = new Dictionary<string, string>();
string IndVarText = " *------------------- From - To --------------------*\r\n * Extra indexvariabler för occurs-taggar --------*\r\n *--------------------------------------------------*";
string aktIndList = "", slask = "", slask2 = "", slask3 = "", slask4 = "";
string occParIndRows = "";
IndexState Is = new IndexState(indexNames, rowList, false);
fromToMoves = new ShowCode();
fromToMoves.Parent = this;
fromToMoves.Labeltext = "Creating \"move From - To\" Code";
savedFile SF = new savedFile();
SF.idConnect = "0A975654-75C6-4A8C-8534-AA16F46BC740";
SF.usageName = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer";
SF.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer.cbl";
fromToMoves.SavedFile = SF;
bool adj = false;
bool valueSwitch = false;
foreach (CobRow cr in rowList)
{
string occParRows = "";
if (cr.CobLevel < 2)
{
string inFile = cmbLastFile.Text.Substring(cmbLastFile.Text.LastIndexOf("\\") + 1);
CreateComment(fromToMoves.CodeShower, "Moves from " + cr.FieldName, S.ettingUserName, S.ettingCompany, inFile);
}
if (okToCode(cr))
{
if (cr.CountIn.Length > 0 || chkAttribs.Checked && cr.isAttribute)
{
adj = true;
string fejkRow = "";
CobRow crChk = cr;
indTemp = "";
aktIndList = "";
//Debug.WriteLine(cr.FieldName);
while (crChk.LevelParent != null)
{
fejkRow += "\r\n OF " + crChk.FieldName;
fejkRow = checkForOccurs(indexNames, crChk, fromToMoves.CodeShower.Text, ref occParRows, ref aktIndList);
crChk = crChk.LevelParent;
}
// Here a test giving header for new iter-group would be created
slask4 = Is.PresentStrings(aktIndList);
if (slask4.Contains("END-P") && slask4.Contains("VARYING"))
{
fromToMoves.CodeShower.Text += slask4.Substring(0, slask4.IndexOf("\r\n", 2));
slask4 = slask4.Substring(slask4.IndexOf("\r\n", 2));
}
if ((slask4.Length > 0) && (slask4.Contains("VARYING")))
{
// Is.ExtraParam innehåller här aktuell count-variabel med correcta index variabler
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "MOVE " + Is.ExtraParam;
slask3 = Is.ExtraParam;
int prefixPos = slask3.IndexOf(S.ettingPrefix);
slask3 = slask3.Substring(0, prefixPos) + S.ettingExpPrefix + slask3.Substring(prefixPos + S.ettingPrefix.Length);
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "TO " + slask3;
}
fromToMoves.CodeShower.Text += slask4;
// aktIndList = reduceIndList(aktIndList, indTemp); nödvändig ?
// Until here---
valueSwitch = cr.FieldName.Contains("_Valu") || cr.isOccurs;
if (!valueSwitch)
{
fromToMoves.CodeShower.Text += "\r\n IF " + cr.CountIn;
occParIndRows = cr.isOccurs && occParRows.Contains(",") ? occParRows.Substring(0, occParRows.LastIndexOf(",")) : occParRows;
if (occParIndRows.Length > 0)
{
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParIndRows + " )";
}
fromToMoves.CodeShower.Text += "\r\n > 0";
}
occParRows = "";
}
//
// Start move <from> -----------------------------------------------------------
//
CobRow crTmp = cr;
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "MOVE " + cr.FieldName;
fromToMoves.CodeShower.Text = checkForOccurs(
indexNames,
cr,
fromToMoves.CodeShower.Text,
ref occParRows,
ref slask,
false,
adj);
while (crTmp.LevelParent != null)
{
crTmp = crTmp.LevelParent;
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + " OF " + crTmp.FieldName;
fromToMoves.CodeShower.Text = checkForOccurs(
indexNames,
crTmp,
fromToMoves.CodeShower.Text,
ref occParRows,
ref slask,
false,
adj);
}
if (occParRows.Length > 0)
{
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParRows + " )";
}
//
// Start <to> section-----------------------------------------------------------
//
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "TO ";
occParRows = "";
CobRow crTmpx = cr;
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) +
crTmpx.FieldName.Replace(S.ettingPrefix, S.ettingExpPrefix);
fromToMoves.CodeShower.Text = checkForOccurs(
indexNames,
crTmpx,
fromToMoves.CodeShower.Text,
ref occParRows,
ref slask2,
false,
adj);
while (crTmpx.LevelParent != null)
{
crTmpx = crTmpx.LevelParent;
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "OF " +
crTmpx.FieldName.Replace(S.ettingPrefix, S.ettingExpPrefix);
fromToMoves.CodeShower.Text = checkForOccurs(
indexNames,
crTmpx,
fromToMoves.CodeShower.Text,
ref occParRows,
ref slask2,
false,
adj);
}
if (occParRows.Length > 0)
{
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParRows;
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + ")";
}
if (cr.CountIn.Length > 0)
{
if (!valueSwitch)
{
if (chkDisplays.Checked)
{
//
// Move count indicators from in-area to out-area
//
fromToMoves.CodeShower.Text += "\r\n MOVE ";
fromToMoves.CodeShower.Text += cr.CountIn;
if (occParIndRows.Length > 0)
{
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParIndRows + " )";
}
fromToMoves.CodeShower.Text += "\r\n " + " TO "
+ cr.CountIn.Replace(S.ettingPrefix, S.ettingExpPrefix);
if (occParIndRows.Length > 0)
{
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParIndRows + " )";
}
}
CobRow crtmp = cr;
while (crtmp.LevelParent != null)
{
crtmp = crtmp.LevelParent;
}
fromToMoves.CodeShower.Text += "\r\n ELSE ";
fromToMoves.CodeShower.Text += "\r\n MOVE 0 TO ";
fromToMoves.CodeShower.Text += cr.CountIn.Replace(S.ettingPrefix, S.ettingExpPrefix);
if (occParIndRows.Length > 0)
{
fromToMoves.CodeShower.Text += " (" + occParIndRows + " )";
}
fromToMoves.CodeShower.Text += "\r\n END-IF ";
}
}
}
//ändring
fromToMoves.CodeShower.Text += Is.PresentStrings(aktIndList);
//ändring
}
fromToMoves.CodeShower.Text += Is.PresentStrings("");
fromToMoves.CodeShower.Text = " 01 MoveToNumVar PIC 9(12).\r\n" + fromToMoves.CodeShower.Text;
fromToMoves.CodeShower.Text = "\r\n 01 MoveToStringVar PIC X(500).\r\n" + fromToMoves.CodeShower.Text;
fromToMoves.CodeShower.Text = addOccursVars(indexNames, fromToMoves.CodeShower.Text, IndVarText);
tmpRowList = new List<CobRow>();
foreach (string frmRow in fromToMoves.CodeShower.Lines)
{
tmpRowList.Add(new CobRow(frmRow, false));
}
fromToMoves.CodeShower.Text = "";
tmpRowList.ForEach(delegate(CobRow crtmp)
{
fromToMoves.CodeShower.Text += crtmp.wrapped() + "\r\n";
});
}
private bool okToCode(CobRow cr)
{
bool lOk = false;
if (chkAttribs.Checked)
lOk = !cr.SampleStr.Equals(NOMOVE);
else
lOk = !cr.isAttribute && !cr.SampleStr.Equals(NOMOVE);
return lOk;
}
private void chkNewArea_CheckedChanged(object sender, EventArgs e)
{
Point locTemp = chkDisplays.Location;
if (chkNewArea.Checked)
{
chkDisplays.Text = "Move counts";
chkAttribs.Visible = true;
}
else
{
chkDisplays.Text = "(Displays)";
chkAttribs.Visible = false;
}
chkDisplays.Location = locTemp;
}
private void outCob_KeyDown(object sender, KeyEventArgs e) private void outCob_KeyDown(object sender, KeyEventArgs e)
{ {
@ -2194,16 +1978,16 @@ namespace CobXmlSupport
} }
private void createXMLMoveCode(savedFile SF, bool justOut = false) private void createXMLMoveCode(savedFile SF, bool justOut = false, bool inclAttribs = false)
{ {
bool loopTyp = false; bool loopTyp = false;
string SectionNames="",BoolVars=""; string SectionNames = "", BoolVars = "";
qualifieldhlp locTmpQfh = null; qualifieldhlp locTmpQfh = null;
Stack<string> indexStack = new Stack<string>(); Stack<string> indexStack = new Stack<string>();
//Create showing window //Create showing window
fromToMoves = new ShowCode(); fromToMoves = new ShowCode();
fromToMoves.Parent = this; fromToMoves.FormParent = this;
if (!justOut) if (!justOut)
{ {
fromToMoves.Labeltext = "Created \"move From To\" Code"; fromToMoves.Labeltext = "Created \"move From To\" Code";
@ -2244,7 +2028,9 @@ namespace CobXmlSupport
fromToMoves.CodeShower.Text += "\r\n"; fromToMoves.CodeShower.Text += "\r\n";
} }
if (!tmpQfh.qualCobRow.isAttribute && !tmpQfh.qualCobRow.SampleStr.Equals(NOMOVE)) // inclAttribs)
//if (!tmpQfh.qualCobRow.isAttribute && !tmpQfh.qualCobRow.SampleStr.Equals(NOMOVE))
if (bringAttrs(tmpQfh,inclAttribs))
{ {
//IndStatus-object takes care of optionally occuring indexes //IndStatus-object takes care of optionally occuring indexes
@ -2254,11 +2040,14 @@ namespace CobXmlSupport
for (int i = 0; i < indSt.Returns; i++) for (int i = 0; i < indSt.Returns; i++)
{ {
string xtIndex = indexStack.Pop(); string xtIndex = indexStack.Pop();
string chosenKey = testIndexes.FirstOrDefault(x => x.Value == xtIndex ).Key; // indexes = <FieldName , FieldIndex> search FieldName from present FieldIndex string chosenKey = testIndexes.FirstOrDefault(x => x.Value == xtIndex).Key; // indexes = <FieldName , FieldIndex> search FieldName from present FieldIndex
locTmpQfh = qldList.First(x => x.qualCobRow.FieldName == chosenKey); // Find QualifiedHelp-object for right field locTmpQfh = qldList.First(x => x.qualCobRow.FieldName == chosenKey); // Find QualifiedHelp-object for right field
fromToMoves.CodeShower.Text += " PERFORM " + createAftReferenceSections(locTmpQfh.qualCobRow.TagName, "LAST-in-", if (chkEvents.Checked)
xtIndex, ref SectionNames) + "\r\n"; {
fromToMoves.CodeShower.Text += " PERFORM " + createAftReferenceSections(locTmpQfh.qualCobRow.TagName, "LAST-in-",
xtIndex, ref SectionNames) + "\r\n";
}
fromToMoves.CodeShower.Text += " END-PERFORM" + "\r\n"; fromToMoves.CodeShower.Text += " END-PERFORM" + "\r\n";
} }
@ -2284,8 +2073,12 @@ namespace CobXmlSupport
//string tmpCheckVar = ""; //string tmpCheckVar = "";
indexStack.Push(indTxt); indexStack.Push(indTxt);
fromToMoves.CodeShower.Text += " PERFORM " + createAftReferenceSections(locTmpQfh.qualCobRow.TagName, "FIRST-in-", if (chkEvents.Checked)
indTxt, ref SectionNames) + "\r\n"; {
fromToMoves.CodeShower.Text += " PERFORM " + createAftReferenceSections(locTmpQfh.qualCobRow.TagName, "FIRST-in-",
indTxt, ref SectionNames) + "\r\n";
}
} }
} }
@ -2304,14 +2097,14 @@ namespace CobXmlSupport
if (!justOut) if (!justOut)
{ {
fromToMoves.CodeShower.Text += " TO " + tmpQfh.ToExpString(); fromToMoves.CodeShower.Text += " TO " + tmpQfh.ToExpString();
if (tmpQfh.qualCobRow.MoveFromCode != null && tmpQfh.qualCobRow.Move_FromCode.Trim().Length > 0) if (tmpQfh.qualCobRow.Move_FromCode != null && tmpQfh.qualCobRow.Move_FromCode.Trim().Length > 0)
{ {
fromToMoves.CodeShower.Text += tmpQfh.qualCobRow.MoveFromCode + "\r\n"; fromToMoves.CodeShower.Text += tmpQfh.qualCobRow.MoveFromCode + "\r\n";
} }
} }
else else
{ {
if (tmpQfh.qualCobRow.MoveFromCode != null && tmpQfh.qualCobRow.Move_FromCode.Trim().Length > 0) if (tmpQfh.qualCobRow.Move_FromCode != null && tmpQfh.qualCobRow.Move_FromCode.Trim().Length > 0)
{ {
//if (tmpQfh.qualCobRow.MoveFromCode.IndexOf("<?>") > -1 || tmpQfh.qualCobRow.MoveFromCode.IndexOf("<NYPOST>") > -1) //if (tmpQfh.qualCobRow.MoveFromCode.IndexOf("<?>") > -1 || tmpQfh.qualCobRow.MoveFromCode.IndexOf("<NYPOST>") > -1)
//{ //{
@ -2376,10 +2169,18 @@ namespace CobXmlSupport
} }
private bool bringAttrs(qualifieldhlp qfh, bool yes)
{
if (yes)
return (!qfh.qualCobRow.SampleStr.Equals(NOMOVE));
else
return (!qfh.qualCobRow.isAttribute && !qfh.qualCobRow.SampleStr.Equals(NOMOVE));
}
private string createAftReferenceSections(string tagName, string procPrefix, string indexVar, ref string wrkSectStr) private string createAftReferenceSections(string tagName, string procPrefix, string indexVar, ref string wrkSectStr)
{ {
string tmpProcName = procPrefix + tagName.Replace("\"", "").Replace(":", "")+"-x"; string tmpProcName = procPrefix + tagName.Replace("\"", "").Replace(":", "") + "-x";
if (!wrkSectStr.Contains(tmpProcName+"-x")) if (!wrkSectStr.Contains(tmpProcName + "-x"))
{ {
wrkSectStr += "\r\n *>------------------- HANDLE SECTION --------------*" + tmpProcName; wrkSectStr += "\r\n *>------------------- HANDLE SECTION --------------*" + tmpProcName;
wrkSectStr += "\r\n * Den här sektionen används för att positionera "; wrkSectStr += "\r\n * Den här sektionen används för att positionera ";
@ -2399,7 +2200,7 @@ namespace CobXmlSupport
private void btnFrXMLTo_Click(object sender, EventArgs e) private void btnFrXMLTo_Click(object sender, EventArgs e)
{ {
savedFile SF = new savedFile(); savedFile SF = new savedFile();
SF.idConnect = "598A5F20-9A8A-415D-81B2-BBFE04465381"; SF.idConnect = "ECCF8A4D-64A6-4674-84F0-C62CEAD19632";
SF.usageName = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer"; SF.usageName = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer";
SF.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer.cbl"; SF.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer.cbl";
createXMLMoveCode(SF); createXMLMoveCode(SF);
@ -2410,7 +2211,7 @@ namespace CobXmlSupport
//Create showing window //Create showing window
loadResWords(); loadResWords();
fromToMoves = new ShowCode(); fromToMoves = new ShowCode();
fromToMoves.Parent = this; fromToMoves.FormParent = this;
fromToMoves.Labeltext = "Cobol \"reserved\" Words"; fromToMoves.Labeltext = "Cobol \"reserved\" Words";
savedFile SF = new savedFile(); savedFile SF = new savedFile();
@ -2471,7 +2272,7 @@ namespace CobXmlSupport
{ {
//Create showing window //Create showing window
fromToMoves = new ShowCode(); fromToMoves = new ShowCode();
fromToMoves.Parent = this; fromToMoves.FormParent = this;
fromToMoves.BSynch = true; fromToMoves.BSynch = true;
fromToMoves.Labeltext = "Cobol \"CrossRef\" List"; fromToMoves.Labeltext = "Cobol \"CrossRef\" List";
@ -2559,5 +2360,20 @@ namespace CobXmlSupport
cwi.ShowDialog(); cwi.ShowDialog();
} }
private void btnXmlKopAttr_Click(object sender, EventArgs e)
{
// kopiera xml inclusive Attribut
savedFile SF = new savedFile();
SF.idConnect = "598A5F20-9A8A-415D-81B2-BBFE04465381";
SF.usageName = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer";
SF.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer.cbl";
createXMLMoveCode(SF, inclAttribs: true);
}
private void btnMoveFromAttr_Click(object sender, EventArgs e)
{
GenerateFromCode(true);
}
} }
} }

View File

@ -120,6 +120,26 @@
<metadata name="openFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="openFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>115, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>115, 17</value>
</metadata>
<data name="chkEvents.ToolTip" xml:space="preserve">
<value>Mallprocedurer för event-hantering vid start och slut av
varje 'perform varying' varv genereras och anropas i
genererad kod kan vara bra om ny post behöver läsas in
och uppdateras i slutet av varvet.</value>
</data>
<data name="btnFrXMLTo.ToolTip" xml:space="preserve">
<value>Läser ut från en respond-xml och fyller samtidigt en
likadan area med annat prefix (jmf. prefix och 'export prefix')
ovan. Copyn för att skriva den kopierade xml-en fås genom
att kopiera original-arean för respond-xml och rename all från
prefix till 'export prefix' (enligt vad som valts ovan.
</value>
</data>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>78</value> <value>78</value>
</metadata> </metadata>

View File

@ -2,20 +2,48 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Threading;
namespace CobXmlSupport namespace CobXmlSupport
{ {
static class Program static class Program
{ {
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetForegroundWindow(IntPtr hWnd);
/// <summary> /// <summary>
/// The main entry point for the application. /// The main entry point for the application.
/// </summary> /// </summary>
[STAThread] [STAThread]
static void Main() static void Main()
{ {
Application.EnableVisualStyles(); bool createdNew = true;
Application.SetCompatibleTextRenderingDefault(false); using (Mutex mutex = new Mutex(true, "GenCobCode", out createdNew))
Application.Run(new GenCobCode()); {
if (createdNew)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new GenCobCode());
}
else
{
Process current = Process.GetCurrentProcess();
foreach (Process process in Process.GetProcessesByName(current.ProcessName))
{
if (process.Id != current.Id)
{
SetForegroundWindow(process.MainWindowHandle);
break;
}
}
}
}
} }
} }
} }

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.34014 // Runtime Version:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@ -12,7 +12,7 @@ namespace CobXmlSupport.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -27,8 +27,8 @@ namespace CobXmlSupport.Properties {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<ArrayOfString xmlns:xsi=\"http://www.w3." + [global::System.Configuration.DefaultSettingValueAttribute("<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<ArrayOfString xmlns:xsi=\"http://www.w3." +
"org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <s" + "org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <s" +
"tring>@\"C:\\testdata\\Reengineering\\FD_GetVehicleHistory.xml\"</string>\r\n</ArrayOfS" + "tring>C:\\testdata\\Reengineering\\FD_GetVehicleHistory.xml</string>\r\n</ArrayOfStri" +
"tring>")] "ng>")]
public global::System.Collections.Specialized.StringCollection LastFile { public global::System.Collections.Specialized.StringCollection LastFile {
get { get {
return ((global::System.Collections.Specialized.StringCollection)(this["LastFile"])); return ((global::System.Collections.Specialized.StringCollection)(this["LastFile"]));

View File

@ -5,7 +5,7 @@
<Setting Name="LastFile" Type="System.Collections.Specialized.StringCollection" Scope="User"> <Setting Name="LastFile" Type="System.Collections.Specialized.StringCollection" Scope="User">
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt; <Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;string&gt;@"C:\testdata\Reengineering\FD_GetVehicleHistory.xml"&lt;/string&gt; &lt;string&gt;C:\testdata\Reengineering\FD_GetVehicleHistory.xml&lt;/string&gt;
&lt;/ArrayOfString&gt;</Value> &lt;/ArrayOfString&gt;</Value>
</Setting> </Setting>
<Setting Name="UserName" Type="System.String" Scope="User"> <Setting Name="UserName" Type="System.String" Scope="User">

28
CobXmlSupport/Settings.cs Normal file
View File

@ -0,0 +1,28 @@
namespace CobXmlSupport.Properties {
// This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings {
public Settings() {
// // To add event handlers for saving and changing settings, uncomment the lines below:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
}
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Add code to handle the SettingChangingEvent event here.
}
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Add code to handle the SettingsSaving event here.
}
}
}

View File

@ -42,10 +42,10 @@
// btnClose // btnClose
// //
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.Location = new System.Drawing.Point(805, 790); this.btnClose.Location = new System.Drawing.Point(604, 642);
this.btnClose.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnClose.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnClose.Name = "btnClose"; this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(75, 28); this.btnClose.Size = new System.Drawing.Size(56, 23);
this.btnClose.TabIndex = 0; this.btnClose.TabIndex = 0;
this.btnClose.Text = "Close"; this.btnClose.Text = "Close";
this.btnClose.UseVisualStyleBackColor = true; this.btnClose.UseVisualStyleBackColor = true;
@ -57,12 +57,12 @@
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.txtCode.Font = new System.Drawing.Font("Courier New", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtCode.Font = new System.Drawing.Font("Courier New", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtCode.Location = new System.Drawing.Point(15, 66); this.txtCode.Location = new System.Drawing.Point(11, 54);
this.txtCode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txtCode.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtCode.Multiline = true; this.txtCode.Multiline = true;
this.txtCode.Name = "txtCode"; this.txtCode.Name = "txtCode";
this.txtCode.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.txtCode.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.txtCode.Size = new System.Drawing.Size(865, 710); this.txtCode.Size = new System.Drawing.Size(650, 578);
this.txtCode.TabIndex = 1; this.txtCode.TabIndex = 1;
this.txtCode.TextChanged += new System.EventHandler(this.txtCode_TextChanged); this.txtCode.TextChanged += new System.EventHandler(this.txtCode_TextChanged);
this.txtCode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtCode_KeyDown); this.txtCode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtCode_KeyDown);
@ -70,10 +70,9 @@
// btnSynch // btnSynch
// //
this.btnSynch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnSynch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSynch.Location = new System.Drawing.Point(659, 790); this.btnSynch.Location = new System.Drawing.Point(494, 642);
this.btnSynch.Margin = new System.Windows.Forms.Padding(4);
this.btnSynch.Name = "btnSynch"; this.btnSynch.Name = "btnSynch";
this.btnSynch.Size = new System.Drawing.Size(140, 28); this.btnSynch.Size = new System.Drawing.Size(105, 23);
this.btnSynch.TabIndex = 3; this.btnSynch.TabIndex = 3;
this.btnSynch.Text = "Synch Moves To"; this.btnSynch.Text = "Synch Moves To";
this.btnSynch.UseVisualStyleBackColor = true; this.btnSynch.UseVisualStyleBackColor = true;
@ -83,10 +82,9 @@
// btnSynchOut // btnSynchOut
// //
this.btnSynchOut.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnSynchOut.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSynchOut.Location = new System.Drawing.Point(504, 790); this.btnSynchOut.Location = new System.Drawing.Point(378, 642);
this.btnSynchOut.Margin = new System.Windows.Forms.Padding(4);
this.btnSynchOut.Name = "btnSynchOut"; this.btnSynchOut.Name = "btnSynchOut";
this.btnSynchOut.Size = new System.Drawing.Size(147, 28); this.btnSynchOut.Size = new System.Drawing.Size(110, 23);
this.btnSynchOut.TabIndex = 4; this.btnSynchOut.TabIndex = 4;
this.btnSynchOut.Text = "Synch Moves From"; this.btnSynchOut.Text = "Synch Moves From";
this.btnSynchOut.UseVisualStyleBackColor = true; this.btnSynchOut.UseVisualStyleBackColor = true;
@ -96,10 +94,9 @@
// btnSaveAktualText // btnSaveAktualText
// //
this.btnSaveAktualText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnSaveAktualText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnSaveAktualText.Location = new System.Drawing.Point(16, 790); this.btnSaveAktualText.Location = new System.Drawing.Point(12, 642);
this.btnSaveAktualText.Margin = new System.Windows.Forms.Padding(4);
this.btnSaveAktualText.Name = "btnSaveAktualText"; this.btnSaveAktualText.Name = "btnSaveAktualText";
this.btnSaveAktualText.Size = new System.Drawing.Size(111, 28); this.btnSaveAktualText.Size = new System.Drawing.Size(83, 23);
this.btnSaveAktualText.TabIndex = 5; this.btnSaveAktualText.TabIndex = 5;
this.btnSaveAktualText.Text = "Spara Copy"; this.btnSaveAktualText.Text = "Spara Copy";
this.btnSaveAktualText.UseVisualStyleBackColor = true; this.btnSaveAktualText.UseVisualStyleBackColor = true;
@ -107,10 +104,10 @@
// //
// btnCompare // btnCompare
// //
this.btnCompare.Location = new System.Drawing.Point(135, 790); this.btnCompare.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnCompare.Margin = new System.Windows.Forms.Padding(4); this.btnCompare.Location = new System.Drawing.Point(101, 642);
this.btnCompare.Name = "btnCompare"; this.btnCompare.Name = "btnCompare";
this.btnCompare.Size = new System.Drawing.Size(131, 28); this.btnCompare.Size = new System.Drawing.Size(98, 23);
this.btnCompare.TabIndex = 6; this.btnCompare.TabIndex = 6;
this.btnCompare.Text = "Compare Existing"; this.btnCompare.Text = "Compare Existing";
this.btnCompare.UseVisualStyleBackColor = true; this.btnCompare.UseVisualStyleBackColor = true;
@ -118,10 +115,12 @@
// //
// btnMoveToLib // btnMoveToLib
// //
this.btnMoveToLib.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnMoveToLib.Enabled = false; this.btnMoveToLib.Enabled = false;
this.btnMoveToLib.Location = new System.Drawing.Point(273, 790); this.btnMoveToLib.Location = new System.Drawing.Point(205, 642);
this.btnMoveToLib.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnMoveToLib.Name = "btnMoveToLib"; this.btnMoveToLib.Name = "btnMoveToLib";
this.btnMoveToLib.Size = new System.Drawing.Size(131, 28); this.btnMoveToLib.Size = new System.Drawing.Size(98, 23);
this.btnMoveToLib.TabIndex = 7; this.btnMoveToLib.TabIndex = 7;
this.btnMoveToLib.Text = "Flytta Till cpylib"; this.btnMoveToLib.Text = "Flytta Till cpylib";
this.btnMoveToLib.UseVisualStyleBackColor = true; this.btnMoveToLib.UseVisualStyleBackColor = true;
@ -132,17 +131,18 @@
this.txtCodeType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.txtCodeType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.txtCodeType.BorderStyle = System.Windows.Forms.BorderStyle.None; this.txtCodeType.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtCodeType.Location = new System.Drawing.Point(16, 34); this.txtCodeType.Location = new System.Drawing.Point(12, 28);
this.txtCodeType.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtCodeType.Name = "txtCodeType"; this.txtCodeType.Name = "txtCodeType";
this.txtCodeType.ReadOnly = true; this.txtCodeType.ReadOnly = true;
this.txtCodeType.Size = new System.Drawing.Size(864, 15); this.txtCodeType.Size = new System.Drawing.Size(648, 13);
this.txtCodeType.TabIndex = 8; this.txtCodeType.TabIndex = 8;
// //
// ShowCode // ShowCode
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(893, 830); this.ClientSize = new System.Drawing.Size(670, 674);
this.Controls.Add(this.txtCodeType); this.Controls.Add(this.txtCodeType);
this.Controls.Add(this.btnMoveToLib); this.Controls.Add(this.btnMoveToLib);
this.Controls.Add(this.btnCompare); this.Controls.Add(this.btnCompare);
@ -152,7 +152,7 @@
this.Controls.Add(this.txtCode); this.Controls.Add(this.txtCode);
this.Controls.Add(this.btnClose); this.Controls.Add(this.btnClose);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Name = "ShowCode"; this.Name = "ShowCode";
this.Text = "ShowCode"; this.Text = "ShowCode";
this.Load += new System.EventHandler(this.ShowCode_Load); this.Load += new System.EventHandler(this.ShowCode_Load);

View File

@ -17,6 +17,8 @@ namespace CobXmlSupport
public partial class ShowCode : Form public partial class ShowCode : Form
{ {
private GenCobCode parentWindow=null;
public readonly string CSV = ".csv"; public readonly string CSV = ".csv";
public readonly string DIF = ".dif"; public readonly string DIF = ".dif";
public readonly string JSON = ".json"; public readonly string JSON = ".json";
@ -67,9 +69,8 @@ namespace CobXmlSupport
} }
} }
private GenCobCode parentWindow;
public GenCobCode Parent public GenCobCode FormParent
{ {
get { return parentWindow; } get { return parentWindow; }
set { parentWindow = value; } set { parentWindow = value; }
@ -104,7 +105,14 @@ namespace CobXmlSupport
{ {
codeCompleter Cc = new codeCompleter(parentWindow.CmbLastFile.Text, parentWindow.FldPref); codeCompleter Cc = new codeCompleter(parentWindow.CmbLastFile.Text, parentWindow.FldPref);
string fieldCompl = ""; string fieldCompl = "";
this.CodeShower.Text = " InPath = " + Cc.PathId + "\r\n InFile = " + Cc.FileId + "\r\n codeFile = " + Cc.CcFileInId + "\r\n codePath = " + Cc.PathId + Cc.CcFileInId + "\r\n -------------- \r\n" + this.CodeShower.Text; this.CodeShower.Text = " InPath = " +
Cc.PathId + "\r\n InFile = " +
Cc.FileId + "\r\n codeFile = " +
Cc.CcFileInId + "\r\n codePath = " +
Cc.PathId +
Cc.CcFileInId + "\r\n -------------- \r\n" +
this.CodeShower.Text;
Cc.TryFill_In_Dic(); Cc.TryFill_In_Dic();
foreach (CobRow cr in parentWindow.RowList) foreach (CobRow cr in parentWindow.RowList)
@ -123,11 +131,19 @@ namespace CobXmlSupport
} }
} }
Cc.Save_In_Dic(); if (DialogResult.OK == MessageBox.Show("Vill du verkligen spara...?", "Spara kompletterad kod", MessageBoxButtons.OKCancel))
{
Cc.Save_In_Dic();
}
refreshWindow("IN"); refreshWindow("IN");
this.CodeShower.Text = " InPath = " + Cc.PathId + "\r\n InFile = " + Cc.FileId + "\r\n codeFile = " + Cc.CcFileInId + "\r\n codePath = " + Cc.PathId + Cc.CcFileInId + "\r\n -------------- \r\n" + this.CodeShower.Text; this.CodeShower.Text = " InPath = " +
Cc.PathId + "\r\n InFile = " +
Cc.FileId + "\r\n codeFile = " +
Cc.CcFileInId + "\r\n codePath = " +
Cc.PathId +
Cc.CcFileInId + "\r\n -------------- \r\n" + this.CodeShower.Text;
} }
@ -311,7 +327,13 @@ namespace CobXmlSupport
{ {
codeCompleter Cc = new codeCompleter(parentWindow.CmbLastFile.Text, parentWindow.FldPref); codeCompleter Cc = new codeCompleter(parentWindow.CmbLastFile.Text, parentWindow.FldPref);
string fieldCompl = ""; string fieldCompl = "";
this.CodeShower.Text = " InPath = " + Cc.PathId + "\r\n InFile = " + Cc.FileId + "\r\n codeFile = " + Cc.CcFileOutId + "\r\n codePath = " + Cc.PathId + Cc.CcFileOutId + "\r\n -------------- \r\n" + this.CodeShower.Text; this.CodeShower.Text = " InPath = " +
Cc.PathId + "\r\n InFile = " +
Cc.FileId + "\r\n codeFile = " +
Cc.CcFileOutId + "\r\n codePath = " +
Cc.PathId +
Cc.CcFileOutId + "\r\n -------------- \r\n" + this.CodeShower.Text;
Cc.TryFill_Out_Dic(); Cc.TryFill_Out_Dic();
// wrkDic = new Dictionary<string, string>(); // wrkDic = new Dictionary<string, string>();
@ -331,11 +353,19 @@ namespace CobXmlSupport
} }
} }
Cc.Save_Out_Dic(); if (DialogResult.OK == MessageBox.Show("Vill du verkligen spara...?", "Spara kompletterad kod", MessageBoxButtons.OKCancel))
{
Cc.Save_Out_Dic();
}
refreshWindow("OUT"); refreshWindow("OUT");
this.CodeShower.Text = " InPath = " + Cc.PathId + "\r\n InFile = " + Cc.FileId + "\r\n codeFile = " + Cc.CcFileOutId + "\r\n codePath = " + Cc.PathId + Cc.CcFileOutId + "\r\n -------------- \r\n" + this.CodeShower.Text; this.CodeShower.Text = " InPath = " +
Cc.PathId + "\r\n InFile = " +
Cc.FileId + "\r\n codeFile = " +
Cc.CcFileOutId + "\r\n codePath = " +
Cc.PathId +
Cc.CcFileOutId + "\r\n -------------- \r\n" + this.CodeShower.Text;
} }
private void btnSaveAktualText_Click(object sender, EventArgs e) private void btnSaveAktualText_Click(object sender, EventArgs e)

View File

@ -9,6 +9,8 @@ namespace CobXmlSupport
{ {
public class codeCompleter public class codeCompleter
{ {
private readonly string LocBackup = "C:\\CCBackup\\";
private Dictionary<string, string> __wrkDicIn = null; private Dictionary<string, string> __wrkDicIn = null;
private Dictionary<string, string> __wrkDicOut = null; private Dictionary<string, string> __wrkDicOut = null;
private string __FieldPrefix; private string __FieldPrefix;
@ -113,10 +115,10 @@ namespace CobXmlSupport
__ccFileOutIdNoSuff = __fileId.Substring(0, __fileId.LastIndexOf(".")) + ".Out" + gPrefix; __ccFileOutIdNoSuff = __fileId.Substring(0, __fileId.LastIndexOf(".")) + ".Out" + gPrefix;
} }
private string backupSuffix() private string backupSuffix(bool rideOver=false)
{ {
string tmpSuff = ""; string tmpSuff = "";
if (S.ettingUserCodeBcup) if (S.ettingUserCodeBcup||rideOver)
{ {
tmpSuff = "." + tmpSuff = "." +
(DateTime.Now.Year - 2000).ToString("00") + (DateTime.Now.Year - 2000).ToString("00") +
@ -133,6 +135,17 @@ namespace CobXmlSupport
return tmpSuff; return tmpSuff;
} }
private string SafeBackPath()
{
return LocBackup +
"BC"+
(DateTime.Now.Year - 2000).ToString("00") +
DateTime.Now.Month.ToString("00") +
DateTime.Now.Day.ToString("00") +
"\\";
}
public void TryFill_In_Dic() public void TryFill_In_Dic()
{ {
@ -173,18 +186,31 @@ namespace CobXmlSupport
public void Save_In_Dic() public void Save_In_Dic()
{ {
string ccFileInId = __jsonPathId + __ccFileInId; string ccFileInId = __jsonPathId + __ccFileInId;
if (Directory.Exists(__jsonPathId + @"\JsonBackup\")) { } if (Directory.Exists(__jsonPathId + @"JsonBackup\")) { }
else else
{ {
Directory.CreateDirectory(__jsonPathId + @"\JsonBackup\"); Directory.CreateDirectory(__jsonPathId + @"JsonBackup\");
} }
string ccFileInBackup = __jsonPathId + @"\JsonBackup\" + __ccFileInIdNoSuff + backupSuffix();
//Panik-backup
if (Directory.Exists(SafeBackPath())) { }
else
{
Directory.CreateDirectory(SafeBackPath());
}
string ccFileInPanikBackup = SafeBackPath() + __ccFileInIdNoSuff + backupSuffix(true);
//Panik-backup
string ccFileInBackup = __jsonPathId + @"JsonBackup\" + __ccFileInIdNoSuff + backupSuffix();
if (__filePathId.Trim() == "") { } if (__filePathId.Trim() == "") { }
else else
{ {
if (File.Exists(ccFileInId)) if (File.Exists(ccFileInId))
{ {
File.Copy(ccFileInId, ccFileInPanikBackup);
if (File.Exists(ccFileInBackup)) if (File.Exists(ccFileInBackup))
{ {
File.Delete(ccFileInBackup); File.Delete(ccFileInBackup);
@ -195,21 +221,36 @@ namespace CobXmlSupport
} }
} }
public void Save_Out_Dic() public void Save_Out_Dic()
{ {
string ccFileOutId = __jsonPathId + __ccFileOutId; string ccFileOutId = __jsonPathId + __ccFileOutId;
if (Directory.Exists(__jsonPathId + @"\JsonBackup\")) { } if (Directory.Exists(__jsonPathId + @"JsonBackup\")) { }
else else
{ {
Directory.CreateDirectory(__jsonPathId + @"\JsonBackup\"); Directory.CreateDirectory(__jsonPathId + @"JsonBackup\");
} }
string ccFileOutBackup = __jsonPathId + @"\JsonBackup\" + __ccFileOutIdNoSuff + backupSuffix();
//Panik-backup
if (Directory.Exists(SafeBackPath())) { }
else
{
Directory.CreateDirectory(SafeBackPath());
}
string ccFileOutPanikBackup = SafeBackPath() + __ccFileOutIdNoSuff + backupSuffix(true);
//Panik-backup
string ccFileOutBackup = __jsonPathId + @"JsonBackup\" + __ccFileOutIdNoSuff + backupSuffix();
if (__filePathId.Trim() == "") { } if (__filePathId.Trim() == "") { }
else else
{ {
if (File.Exists(ccFileOutId)) if (File.Exists(ccFileOutId))
{ {
File.Copy(ccFileOutId, ccFileOutPanikBackup);
if (File.Exists(ccFileOutBackup)) if (File.Exists(ccFileOutBackup))
{ {
File.Delete(ccFileOutBackup); File.Delete(ccFileOutBackup);

View File

@ -49,6 +49,9 @@
this.chkValues = new System.Windows.Forms.CheckBox(); this.chkValues = new System.Windows.Forms.CheckBox();
this.chkAnaTag = new System.Windows.Forms.CheckBox(); this.chkAnaTag = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.chkDisplays = new System.Windows.Forms.CheckBox();
this.chkMvToDisp = new System.Windows.Forms.CheckBox();
this.chkPerforms = new System.Windows.Forms.CheckBox();
this.txtExpPrefix = new System.Windows.Forms.TextBox(); this.txtExpPrefix = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
@ -63,9 +66,8 @@
this.txtFilePath = new System.Windows.Forms.TextBox(); this.txtFilePath = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label();
this.chkPerforms = new System.Windows.Forms.CheckBox(); this.btnChooseFile = new System.Windows.Forms.Button();
this.chkMvToDisp = new System.Windows.Forms.CheckBox(); this.ofdChooseFild = new System.Windows.Forms.OpenFileDialog();
this.chkDisplays = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.specials.SuspendLayout(); this.specials.SuspendLayout();
@ -287,6 +289,36 @@
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Utgångs inställningar"; this.groupBox1.Text = "Utgångs inställningar";
// //
// chkDisplays
//
this.chkDisplays.AutoSize = true;
this.chkDisplays.Location = new System.Drawing.Point(14, 267);
this.chkDisplays.Name = "chkDisplays";
this.chkDisplays.Size = new System.Drawing.Size(104, 17);
this.chkDisplays.TabIndex = 43;
this.chkDisplays.Text = "Move fr Displays";
this.chkDisplays.UseVisualStyleBackColor = true;
//
// chkMvToDisp
//
this.chkMvToDisp.AutoSize = true;
this.chkMvToDisp.Location = new System.Drawing.Point(14, 244);
this.chkMvToDisp.Name = "chkMvToDisp";
this.chkMvToDisp.Size = new System.Drawing.Size(111, 17);
this.chkMvToDisp.TabIndex = 42;
this.chkMvToDisp.Text = "Move To Displays";
this.chkMvToDisp.UseVisualStyleBackColor = true;
//
// chkPerforms
//
this.chkPerforms.AutoSize = true;
this.chkPerforms.Location = new System.Drawing.Point(14, 220);
this.chkPerforms.Name = "chkPerforms";
this.chkPerforms.Size = new System.Drawing.Size(90, 17);
this.chkPerforms.TabIndex = 41;
this.chkPerforms.Text = "Visa Performs";
this.chkPerforms.UseVisualStyleBackColor = true;
//
// txtExpPrefix // txtExpPrefix
// //
this.txtExpPrefix.Location = new System.Drawing.Point(213, 51); this.txtExpPrefix.Location = new System.Drawing.Point(213, 51);
@ -421,41 +453,27 @@
this.label10.TabIndex = 44; this.label10.TabIndex = 44;
this.label10.Text = "Aktuell Urspr Fil:"; this.label10.Text = "Aktuell Urspr Fil:";
// //
// chkPerforms // btnChooseFile
// //
this.chkPerforms.AutoSize = true; this.btnChooseFile.Location = new System.Drawing.Point(108, 129);
this.chkPerforms.Location = new System.Drawing.Point(14, 220); this.btnChooseFile.Name = "btnChooseFile";
this.chkPerforms.Name = "chkPerforms"; this.btnChooseFile.Size = new System.Drawing.Size(90, 23);
this.chkPerforms.Size = new System.Drawing.Size(90, 17); this.btnChooseFile.TabIndex = 46;
this.chkPerforms.TabIndex = 41; this.btnChooseFile.Text = "Välj ursprungsfil";
this.chkPerforms.Text = "Visa Performs"; this.btnChooseFile.UseVisualStyleBackColor = true;
this.chkPerforms.UseVisualStyleBackColor = true; this.btnChooseFile.Visible = false;
this.btnChooseFile.Click += new System.EventHandler(this.button1_Click);
// //
// chkMvToDisp // ofdChooseFild
// //
this.chkMvToDisp.AutoSize = true; this.ofdChooseFild.InitialDirectory = "Documents";
this.chkMvToDisp.Location = new System.Drawing.Point(14, 244);
this.chkMvToDisp.Name = "chkMvToDisp";
this.chkMvToDisp.Size = new System.Drawing.Size(111, 17);
this.chkMvToDisp.TabIndex = 42;
this.chkMvToDisp.Text = "Move To Displays";
this.chkMvToDisp.UseVisualStyleBackColor = true;
//
// chkDisplays
//
this.chkDisplays.AutoSize = true;
this.chkDisplays.Location = new System.Drawing.Point(14, 267);
this.chkDisplays.Name = "chkDisplays";
this.chkDisplays.Size = new System.Drawing.Size(104, 17);
this.chkDisplays.TabIndex = 43;
this.chkDisplays.Text = "Move fr Displays";
this.chkDisplays.UseVisualStyleBackColor = true;
// //
// frmSettings // frmSettings
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(557, 518); this.ClientSize = new System.Drawing.Size(557, 518);
this.Controls.Add(this.btnChooseFile);
this.Controls.Add(this.label9); this.Controls.Add(this.label9);
this.Controls.Add(this.label10); this.Controls.Add(this.label10);
this.Controls.Add(this.txtFilePath); this.Controls.Add(this.txtFilePath);
@ -525,5 +543,7 @@
private System.Windows.Forms.CheckBox chkPerforms; private System.Windows.Forms.CheckBox chkPerforms;
private System.Windows.Forms.CheckBox chkMvToDisp; private System.Windows.Forms.CheckBox chkMvToDisp;
private System.Windows.Forms.CheckBox chkDisplays; private System.Windows.Forms.CheckBox chkDisplays;
private System.Windows.Forms.Button btnChooseFile;
private System.Windows.Forms.OpenFileDialog ofdChooseFild;
} }
} }

View File

@ -128,7 +128,8 @@ namespace CobXmlSupport
txtUserName.Text = value; txtUserName.Text = value;
} }
} }
public string CompanyName
public string SettingsCompanyName
{ {
get get
{ {
@ -325,7 +326,10 @@ namespace CobXmlSupport
txtExpPrefix.Text = value; txtExpPrefix.Text = value;
} }
} }
public bool VisaFilVal { set {
btnChooseFile.Visible = value;
btnChooseFile.Refresh();
} }
private void btnSave_Click(object sender, EventArgs e) private void btnSave_Click(object sender, EventArgs e)
{ {
@ -390,6 +394,24 @@ namespace CobXmlSupport
CompanyTmp = txtCompanyName.Text = S.ettingCompany; CompanyTmp = txtCompanyName.Text = S.ettingCompany;
} }
private void button1_Click(object sender, EventArgs e)
{
ofdChooseFild.Title = "Välj en befintlig xml-fil";
ofdChooseFild.FileName = this.txtActualFile.Text;
ofdChooseFild.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
ofdChooseFild.Filter= "xml files (*.xml)|*.xml|All files (*.*)|*.*";
ofdChooseFild.Multiselect = false;
if (ofdChooseFild.ShowDialog() == DialogResult.OK)
{
txtActualFile.Text = ofdChooseFild.SafeFileName;
txtFilePath.Text = System.IO.Path.GetDirectoryName(ofdChooseFild.FileName);
txtActualFile.Refresh();
txtFilePath.Refresh();
}
else MessageBox.Show("Programmet kommer att krasha om ingen fil väljs!");
}
private void btnCancel_Click(object sender, EventArgs e) private void btnCancel_Click(object sender, EventArgs e)
{ {
chkAnaTag.Checked = tmpChkAnaTag; chkAnaTag.Checked = tmpChkAnaTag;

View File

@ -117,6 +117,9 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="ofdChooseFild.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,112 @@
param($installPath, $toolsPath, $package, $project)
# open json.net splash page on package install
# don't open if json.net is installed as a dependency
try
{
$url = "http://james.newtonking.com/json/install?version=" + $package.Version
$dte2 = Get-Interface $dte ([EnvDTE80.DTE2])
if ($dte2.ActiveWindow.Caption -eq "Package Manager Console")
{
# user is installing from VS NuGet console
# get reference to the window, the console host and the input history
# show webpage if "install-package newtonsoft.json" was last input
$consoleWindow = $(Get-VSComponentModel).GetService([NuGetConsole.IPowerConsoleWindow])
$props = $consoleWindow.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor `
[System.Reflection.BindingFlags]::NonPublic)
$prop = $props | ? { $_.Name -eq "ActiveHostInfo" } | select -first 1
if ($prop -eq $null) { return }
$hostInfo = $prop.GetValue($consoleWindow)
if ($hostInfo -eq $null) { return }
$history = $hostInfo.WpfConsole.InputHistory.History
$lastCommand = $history | select -last 1
if ($lastCommand)
{
$lastCommand = $lastCommand.Trim().ToLower()
if ($lastCommand.StartsWith("install-package") -and $lastCommand.Contains("newtonsoft.json"))
{
$dte2.ItemOperations.Navigate($url) | Out-Null
}
}
}
else
{
# user is installing from VS NuGet dialog
# get reference to the window, then smart output console provider
# show webpage if messages in buffered console contains "installing...newtonsoft.json" in last operation
$instanceField = [NuGet.Dialog.PackageManagerWindow].GetField("CurrentInstance", [System.Reflection.BindingFlags]::Static -bor `
[System.Reflection.BindingFlags]::NonPublic)
$consoleField = [NuGet.Dialog.PackageManagerWindow].GetField("_smartOutputConsoleProvider", [System.Reflection.BindingFlags]::Instance -bor `
[System.Reflection.BindingFlags]::NonPublic)
if ($instanceField -eq $null -or $consoleField -eq $null) { return }
$instance = $instanceField.GetValue($null)
if ($instance -eq $null) { return }
$consoleProvider = $consoleField.GetValue($instance)
if ($consoleProvider -eq $null) { return }
$console = $consoleProvider.CreateOutputConsole($false)
$messagesField = $console.GetType().GetField("_messages", [System.Reflection.BindingFlags]::Instance -bor `
[System.Reflection.BindingFlags]::NonPublic)
if ($messagesField -eq $null) { return }
$messages = $messagesField.GetValue($console)
if ($messages -eq $null) { return }
$operations = $messages -split "=============================="
$lastOperation = $operations | select -last 1
if ($lastOperation)
{
$lastOperation = $lastOperation.ToLower()
$lines = $lastOperation -split "`r`n"
$installMatch = $lines | ? { $_.StartsWith("------- installing...newtonsoft.json ") } | select -first 1
if ($installMatch)
{
$dte2.ItemOperations.Navigate($url) | Out-Null
}
}
}
}
catch
{
try
{
$pmPane = $dte2.ToolWindows.OutputWindow.OutputWindowPanes.Item("Package Manager")
$selection = $pmPane.TextDocument.Selection
$selection.StartOfDocument($false)
$selection.EndOfDocument($true)
if ($selection.Text.StartsWith("Installing 'Newtonsoft.Json "))
{
$dte2.ItemOperations.Navigate($url) | Out-Null
}
}
catch
{
# stop potential errors from bubbling up
# worst case the splash page won't open
}
}
# still yolo

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<repositories>
<repository path="..\CobXmlSupport\packages.config" />
</repositories>