Compare commits

...

10 Commits

Author SHA1 Message Date
ffe8b61444 some unused controls hidden, tooltips on other 2015-12-28 22:06:10 +01:00
342f19daef Possibility to avoid event-procedures 2015-11-11 01:27:31 +01:00
d115ed2307 New buttons had wrong anchor property 2015-11-06 09:38:10 +01:00
71f8953de4 Changes removed 2015-11-03 23:45:19 +01:00
cf6bc34631 canceled Code 2015-11-03 23:26:02 +01:00
42c16b48da Changed guids for different products 2015-11-03 16:16:06 +01:00
253e3c4adb Attrib retrieval even in offloader 2015-11-03 15:13:15 +01:00
3e128794e1 new button copy including attributes 2015-11-03 14:10:41 +01:00
b4e8089efc Extra backup on my local device 2015-10-10 17:14:24 +02:00
46e6585495 Better procnames (events) 2015-09-29 07:42:25 +02:00
11 changed files with 356 additions and 362 deletions

View File

@ -1,6 +1,8 @@

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}"
EndProject
Global

View File

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

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Reflection;
namespace CobXmlSupport
{
@ -59,7 +60,6 @@ namespace CobXmlSupport
return " *" + S.strX(' ', 72 - 15 - this.FieldName.Length) + "------" + this.FieldName + "\r\n" +
moveCode +
"\r\n *" + S.strX(' ', 72 - 15 - this.FieldName.Length) + "------" + this.FieldName + "\r\n";
}
set{
moveCode = value;
@ -86,6 +86,11 @@ namespace CobXmlSupport
}
set{
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

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GenCobCode));
this.button1 = new System.Windows.Forms.Button();
this.outText = new System.Windows.Forms.TextBox();
@ -59,6 +60,9 @@
this.chkBackupVars = new System.Windows.Forms.CheckBox();
this.btnRerun = new System.Windows.Forms.Button();
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.chkAttribs = new System.Windows.Forms.CheckBox();
this.chkNewArea = new System.Windows.Forms.CheckBox();
@ -71,6 +75,7 @@
this.grpSettings = new System.Windows.Forms.GroupBox();
this.btnSaveArea = 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.grpSettings.SuspendLayout();
this.SuspendLayout();
@ -94,7 +99,7 @@
this.outText.Multiline = true;
this.outText.Name = "outText";
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.WordWrap = false;
//
@ -108,7 +113,7 @@
this.outCob.Multiline = true;
this.outCob.Name = "outCob";
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.WordWrap = false;
this.outCob.KeyDown += new System.Windows.Forms.KeyEventHandler(this.outCob_KeyDown);
@ -136,7 +141,7 @@
// btnClose
//
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.Location = new System.Drawing.Point(880, 628);
this.btnClose.Location = new System.Drawing.Point(880, 688);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(72, 23);
this.btnClose.TabIndex = 6;
@ -308,12 +313,13 @@
// btnSettings
//
this.btnSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnSettings.Location = new System.Drawing.Point(9, 17);
this.btnSettings.Location = new System.Drawing.Point(9, 37);
this.btnSettings.Margin = new System.Windows.Forms.Padding(2);
this.btnSettings.Name = "btnSettings";
this.btnSettings.Size = new System.Drawing.Size(81, 23);
this.btnSettings.TabIndex = 26;
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.Click += new System.EventHandler(this.btnSettings_Click);
//
@ -338,7 +344,7 @@
// btnTestThings
//
this.btnTestThings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnTestThings.Location = new System.Drawing.Point(9, 41);
this.btnTestThings.Location = new System.Drawing.Point(9, 74);
this.btnTestThings.Name = "btnTestThings";
this.btnTestThings.Size = new System.Drawing.Size(81, 23);
this.btnTestThings.TabIndex = 33;
@ -349,7 +355,7 @@
// btnCrossref
//
this.btnCrossref.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnCrossref.Location = new System.Drawing.Point(93, 17);
this.btnCrossref.Location = new System.Drawing.Point(95, 37);
this.btnCrossref.Name = "btnCrossref";
this.btnCrossref.Size = new System.Drawing.Size(81, 23);
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.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.Size = new System.Drawing.Size(87, 17);
this.chkBackupVars.TabIndex = 36;
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.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)
| 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.chkAttribs);
this.grpProduce.Controls.Add(this.chkNewArea);
@ -392,21 +402,60 @@
this.grpProduce.Controls.Add(this.btnMoveFrom);
this.grpProduce.Controls.Add(this.btnMoves);
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.Size = new System.Drawing.Size(545, 77);
this.grpProduce.Size = new System.Drawing.Size(545, 110);
this.grpProduce.TabIndex = 38;
this.grpProduce.TabStop = false;
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
//
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.Size = new System.Drawing.Size(92, 22);
this.btnFrXMLTo.TabIndex = 43;
this.btnFrXMLTo.Text = "Kopiera XML";
this.toolTip1.SetToolTip(this.btnFrXMLTo, resources.GetString("btnFrXMLTo.ToolTip"));
this.btnFrXMLTo.UseVisualStyleBackColor = true;
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.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.Size = new System.Drawing.Size(85, 17);
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.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.Size = new System.Drawing.Size(64, 17);
this.chkNewArea.TabIndex = 41;
this.chkNewArea.Text = "Till Area";
this.chkNewArea.UseVisualStyleBackColor = true;
this.chkNewArea.Visible = false;
this.chkNewArea.CheckedChanged += new System.EventHandler(this.chkNewArea_CheckedChanged);
//
// chkMvToDisp
//
this.chkMvToDisp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkMvToDisp.AutoSize = true;
this.chkMvToDisp.Location = new System.Drawing.Point(219, 38);
this.chkMvToDisp.Location = new System.Drawing.Point(212, 49);
this.chkMvToDisp.Name = "chkMvToDisp";
this.chkMvToDisp.Size = new System.Drawing.Size(71, 17);
this.chkMvToDisp.TabIndex = 40;
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.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.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.Size = new System.Drawing.Size(62, 17);
this.chkPerform.TabIndex = 39;
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.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.AutoSize = true;
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.Size = new System.Drawing.Size(71, 17);
this.chkDisplays.TabIndex = 38;
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.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.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.Size = new System.Drawing.Size(92, 23);
this.btnMoveFrom.TabIndex = 37;
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.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.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.Name = "btnMoves";
this.btnMoves.Size = new System.Drawing.Size(93, 23);
this.btnMoves.TabIndex = 36;
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.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.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.Name = "btnGenICode";
this.btnGenICode.Size = new System.Drawing.Size(81, 23);
this.btnGenICode.TabIndex = 35;
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.Click += new System.EventHandler(this.btnGenICodeNew_Click);
//
@ -519,9 +578,9 @@
this.grpSettings.Controls.Add(this.btnSettings);
this.grpSettings.Controls.Add(this.btnTestThings);
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.Size = new System.Drawing.Size(379, 77);
this.grpSettings.Size = new System.Drawing.Size(379, 110);
this.grpSettings.TabIndex = 39;
this.grpSettings.TabStop = false;
this.grpSettings.Text = "Ställ in, testa";
@ -529,21 +588,23 @@
// btnSaveArea
//
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.Size = new System.Drawing.Size(99, 23);
this.btnSaveArea.TabIndex = 40;
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.Click += new System.EventHandler(this.btnSaveArea_Click);
//
// 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.Size = new System.Drawing.Size(99, 23);
this.btnShowWorkFiles.TabIndex = 41;
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.Click += new System.EventHandler(this.btnShowWorkFiles_Click);
//
@ -551,7 +612,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
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.grpProduce);
this.Controls.Add(this.btnRerun);
@ -637,6 +698,10 @@
private System.Windows.Forms.GroupBox grpSettings;
private System.Windows.Forms.Button btnSaveArea;
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";
private readonly bool MOVEFROM = true;
//private readonly bool MOVEFROM = true;
public string FldPref
{
@ -109,6 +109,7 @@ namespace CobXmlSupport
private void runXMLgen()
{
chkEvents.Checked = false;
if (!formLoading)
{
btnGenICode.Enabled = false;
@ -252,14 +253,17 @@ namespace CobXmlSupport
if (Cc.WorkDicOut.TryGetValue(rw.FieldName, out fieldOutCompl))
{
rw.MoveFromCode = fieldOutCompl;
//Debug.WriteLine("Existerarnde fält: " + rw.FieldName + " Kod : " + fieldOutCompl);
}
else
{
Cc.WorkDicOut.Add(rw.FieldName, "");
//Debug.WriteLine("Upplagt fält: " + rw.FieldName);
}
}
if (rw.Move_FromCode == null) { rw.MoveFromCode = " "; }
Cc.WorkDicOut[rw.FieldName] = rw.Move_FromCode;
FieldList.Add(rw.FieldName, objNr++);
}
// Prefill with possibly filled out code
@ -784,6 +788,7 @@ namespace CobXmlSupport
chkWrap.Checked = true;
chkNewArea.Checked = false;
//chkNewArea.Checked = true;
chkEvents.Checked = false;
ClientSizeMinWidth = this.ClientSize.Width;
@ -834,6 +839,7 @@ namespace CobXmlSupport
chkValues.Checked = S.ettingValues;
chkWrap.Checked = S.ettingWrap;
btnTestThings.Visible = S.ettingShowTestbtns;
btnCrossref.Visible = S.ettingShowTestbtns;
formLoading = false;
// cmbLastFile.Text = cmbLastFile.Items[0].ToString();
@ -860,7 +866,7 @@ namespace CobXmlSupport
string IndVarText = " *--------------------------------------------------*\r\n * Extra indexvariabler för occurs-taggar --------*\r\n *--------------------------------------------------*";
string slask = "";
genCode = new ShowCode();
genCode.Parent = this;
genCode.FormParent = this;
genCode.Labeltext = "Creating Initialization Code";
savedFile SF = new savedFile();
@ -915,9 +921,9 @@ namespace CobXmlSupport
Dictionary<string, string> indexNames = new Dictionary<string, string>();
//string IndVarText = " *--------------------------------------------------*\r\n * Extra indexvariabler för occurs-taggar --------*\r\n *--------------------------------------------------*";
string slask = "";
//string slask = "";
genCode = new ShowCode();
genCode.Parent = this;
genCode.FormParent = this;
genCode.Labeltext = "Creating Initialization Code";
savedFile SF = new savedFile();
@ -986,7 +992,7 @@ namespace CobXmlSupport
genCode.CodeShower.Text += " PERFORM VARYING " + indTxt + " FROM 1 BY 1\r\n UNTIL " +
indTxt + "\r\n > " + tmpQfh.qualCobRow.occNum.ToString() + "\r\n"; // +tmpQfh.indexRedText;
if (tmpQfh.qualCobRow.isOccurs) slask = "";
//if (tmpQfh.qualCobRow.isOccurs) slask = "";
}
}
@ -1222,20 +1228,25 @@ namespace CobXmlSupport
/// <param name="e"></param>
private void btnMoveFrom_Click(object sender, EventArgs e)
{
if (chkNewArea.Checked)
{
CreateMoveDataFromTo();
fromToMoves.Show();
GenerateFromCode(false);
}
else
private void GenerateFromCode(bool inclAttr)
{
//if (chkNewArea.Checked)
//{
// CreateMoveDataFromTo();
// fromToMoves.Show();
//}
//else
//{
if (!chkDisplays.Checked)
{
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.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Unload.cbl";
createXMLMoveCode(SF, true);
createXMLMoveCode(SF, true, inclAttr);
}
else
{
@ -1243,7 +1254,7 @@ namespace CobXmlSupport
CreateMoveFromData();
fromMoves.Show();
}
}
//}
}
private string adjustIf(bool ifTrue)
@ -1458,6 +1469,8 @@ namespace CobXmlSupport
txtExpPrefix.Refresh();
btnTestThings.Visible = S.ettingShowTestbtns;
btnTestThings.Refresh();
btnCrossref.Visible = S.ettingShowTestbtns;
btnCrossref.Refresh();
chkBackupVars.Checked = S.ettingUserCodeBcup;
chkBackupVars.Refresh();
eventRun = false;
@ -1471,7 +1484,7 @@ namespace CobXmlSupport
string IndVarText = " *--------------------------------------------------*\r\n * Extra indexvariabler för occurs-taggar --------*\r\n *--------------------------------------------------*";
string slask = "";
genMoves = new ShowCode();
genMoves.Parent = this;
genMoves.FormParent = this;
genMoves.Labeltext = "Creating \"move to\" Code";
// CreateComment(genMoves.CodeShower, "Moves to", "Tommy Öman", "Fordonsdata Nordic AB");
@ -1521,11 +1534,11 @@ namespace CobXmlSupport
string aktIndList = "", slask = "", slask2 = "", struktMove = ""; ;
IndexState Is = new IndexState(indexNames, rowList);
genExtMoves = new ShowCode();
genExtMoves.Parent = this;
genExtMoves.FormParent = this;
genExtMoves.Labeltext = "Creating \"move to (with loop)\" Code";
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.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Load.cbl";
genExtMoves.SavedFile = SF;
@ -1766,7 +1779,7 @@ namespace CobXmlSupport
string aktIndList = "", slask = "", slask2 = "";
IndexState Is = new IndexState(indexNames, rowList, false);
fromMoves = new ShowCode();
fromMoves.Parent = this;
fromMoves.FormParent = this;
fromMoves.Labeltext = "Creating \"move from\" Code";
savedFile SF = new savedFile();
@ -1932,258 +1945,6 @@ namespace CobXmlSupport
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)
{
@ -2194,14 +1955,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;
string SectionNames = "", BoolVars = "";
qualifieldhlp locTmpQfh = null;
Stack<string> indexStack = new Stack<string>();
//Create showing window
fromToMoves = new ShowCode();
fromToMoves.Parent = this;
fromToMoves.FormParent = this;
if (!justOut)
{
fromToMoves.Labeltext = "Created \"move From To\" Code";
@ -2242,7 +2005,9 @@ namespace CobXmlSupport
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
@ -2251,6 +2016,15 @@ namespace CobXmlSupport
//If indexes get out of scope there will come an END-PERFORM for each
for (int i = 0; i < indSt.Returns; i++)
{
string xtIndex = indexStack.Pop();
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
if (chkEvents.Checked)
{
fromToMoves.CodeShower.Text += " PERFORM " + createAftReferenceSections(locTmpQfh.qualCobRow.TagName, "LAST-in-",
xtIndex, ref SectionNames) + "\r\n";
}
fromToMoves.CodeShower.Text += " END-PERFORM" + "\r\n";
}
@ -2274,11 +2048,16 @@ namespace CobXmlSupport
fromToMoves.CodeShower.Text += " PERFORM VARYING " + indTxt + " FROM 1 BY 1\r\n UNTIL " +
indTxt + "\r\n > " + locTmpQfh.qualCobRow.CountIn.ToString() + "\r\n" + locTmpQfh.indexRedText;
string tmpCheckVar = "";
fromToMoves.CodeShower.Text += " PERFORM " + createAftReferenceSections(locTmpQfh.qualCobRow.TagName, "NXTO-",
//string tmpCheckVar = "";
indexStack.Push(indTxt);
if (chkEvents.Checked)
{
fromToMoves.CodeShower.Text += " PERFORM " + createAftReferenceSections(locTmpQfh.qualCobRow.TagName, "FIRST-in-",
indTxt, ref SectionNames) + "\r\n";
}
}
}
//When count-variable is put on a "Value" XML-record-field the the count-value isnt correctly updated so better always move the value as is
if (tmpQfh.qualCobRow.FieldName.ToUpper().Contains("_VALUE")) { }
@ -2295,14 +2074,14 @@ namespace CobXmlSupport
if (!justOut)
{
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";
}
}
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)
//{
@ -2367,10 +2146,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)
{
string tmpProcName = procPrefix + tagName.Replace("\"", "").Replace(":", "");;
if (!wrkSectStr.Contains(tmpProcName))
string tmpProcName = procPrefix + tagName.Replace("\"", "").Replace(":", "") + "-x";
if (!wrkSectStr.Contains(tmpProcName + "-x"))
{
wrkSectStr += "\r\n *>------------------- HANDLE SECTION --------------*" + tmpProcName;
wrkSectStr += "\r\n * Den här sektionen används för att positionera ";
@ -2390,7 +2177,7 @@ namespace CobXmlSupport
private void btnFrXMLTo_Click(object sender, EventArgs e)
{
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.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer.cbl";
createXMLMoveCode(SF);
@ -2401,7 +2188,7 @@ namespace CobXmlSupport
//Create showing window
loadResWords();
fromToMoves = new ShowCode();
fromToMoves.Parent = this;
fromToMoves.FormParent = this;
fromToMoves.Labeltext = "Cobol \"reserved\" Words";
savedFile SF = new savedFile();
@ -2462,7 +2249,7 @@ namespace CobXmlSupport
{
//Create showing window
fromToMoves = new ShowCode();
fromToMoves.Parent = this;
fromToMoves.FormParent = this;
fromToMoves.BSynch = true;
fromToMoves.Labeltext = "Cobol \"CrossRef\" List";
@ -2550,5 +2337,20 @@ namespace CobXmlSupport
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">
<value>17, 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>
<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">
<value>78</value>
</metadata>

View File

@ -2,20 +2,48 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Threading;
namespace CobXmlSupport
{
static class Program
{
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetForegroundWindow(IntPtr hWnd);
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
bool createdNew = true;
using (Mutex mutex = new Mutex(true, "GenCobCode", out createdNew))
{
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

@ -42,10 +42,10 @@
// btnClose
//
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.Location = new System.Drawing.Point(805, 790);
this.btnClose.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnClose.Location = new System.Drawing.Point(604, 642);
this.btnClose.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
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.Text = "Close";
this.btnClose.UseVisualStyleBackColor = true;
@ -57,12 +57,12 @@
| System.Windows.Forms.AnchorStyles.Left)
| 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.Location = new System.Drawing.Point(15, 66);
this.txtCode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtCode.Location = new System.Drawing.Point(11, 54);
this.txtCode.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtCode.Multiline = true;
this.txtCode.Name = "txtCode";
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.TextChanged += new System.EventHandler(this.txtCode_TextChanged);
this.txtCode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtCode_KeyDown);
@ -70,10 +70,9 @@
// btnSynch
//
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.Margin = new System.Windows.Forms.Padding(4);
this.btnSynch.Location = new System.Drawing.Point(494, 642);
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.Text = "Synch Moves To";
this.btnSynch.UseVisualStyleBackColor = true;
@ -83,10 +82,9 @@
// btnSynchOut
//
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.Margin = new System.Windows.Forms.Padding(4);
this.btnSynchOut.Location = new System.Drawing.Point(378, 642);
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.Text = "Synch Moves From";
this.btnSynchOut.UseVisualStyleBackColor = true;
@ -96,10 +94,9 @@
// btnSaveAktualText
//
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.Margin = new System.Windows.Forms.Padding(4);
this.btnSaveAktualText.Location = new System.Drawing.Point(12, 642);
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.Text = "Spara Copy";
this.btnSaveAktualText.UseVisualStyleBackColor = true;
@ -107,10 +104,10 @@
//
// btnCompare
//
this.btnCompare.Location = new System.Drawing.Point(135, 790);
this.btnCompare.Margin = new System.Windows.Forms.Padding(4);
this.btnCompare.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnCompare.Location = new System.Drawing.Point(101, 642);
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.Text = "Compare Existing";
this.btnCompare.UseVisualStyleBackColor = true;
@ -118,10 +115,12 @@
//
// btnMoveToLib
//
this.btnMoveToLib.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
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.Size = new System.Drawing.Size(131, 28);
this.btnMoveToLib.Size = new System.Drawing.Size(98, 23);
this.btnMoveToLib.TabIndex = 7;
this.btnMoveToLib.Text = "Flytta Till cpylib";
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)
| System.Windows.Forms.AnchorStyles.Right)));
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.ReadOnly = true;
this.txtCodeType.Size = new System.Drawing.Size(864, 15);
this.txtCodeType.Size = new System.Drawing.Size(648, 13);
this.txtCodeType.TabIndex = 8;
//
// 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.ClientSize = new System.Drawing.Size(893, 830);
this.ClientSize = new System.Drawing.Size(670, 674);
this.Controls.Add(this.txtCodeType);
this.Controls.Add(this.btnMoveToLib);
this.Controls.Add(this.btnCompare);
@ -152,7 +152,7 @@
this.Controls.Add(this.txtCode);
this.Controls.Add(this.btnClose);
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.Text = "ShowCode";
this.Load += new System.EventHandler(this.ShowCode_Load);

View File

@ -17,6 +17,8 @@ namespace CobXmlSupport
public partial class ShowCode : Form
{
private GenCobCode parentWindow=null;
public readonly string CSV = ".csv";
public readonly string DIF = ".dif";
public readonly string JSON = ".json";
@ -67,9 +69,8 @@ namespace CobXmlSupport
}
}
private GenCobCode parentWindow;
public GenCobCode Parent
public GenCobCode FormParent
{
get { return parentWindow; }
set { parentWindow = value; }
@ -104,7 +105,14 @@ namespace CobXmlSupport
{
codeCompleter Cc = new codeCompleter(parentWindow.CmbLastFile.Text, parentWindow.FldPref);
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();
foreach (CobRow cr in parentWindow.RowList)
@ -123,11 +131,19 @@ namespace CobXmlSupport
}
}
if (DialogResult.OK == MessageBox.Show("Vill du verkligen spara...?", "Spara kompletterad kod", MessageBoxButtons.OKCancel))
{
Cc.Save_In_Dic();
}
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);
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();
// wrkDic = new Dictionary<string, string>();
@ -331,11 +353,19 @@ namespace CobXmlSupport
}
}
if (DialogResult.OK == MessageBox.Show("Vill du verkligen spara...?", "Spara kompletterad kod", MessageBoxButtons.OKCancel))
{
Cc.Save_Out_Dic();
}
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)

View File

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

View File

@ -128,7 +128,8 @@ namespace CobXmlSupport
txtUserName.Text = value;
}
}
public string CompanyName
public string SettingsCompanyName
{
get
{