diff --git a/CobProgAid/CobProgAid/CobProgAid.csproj b/CobProgAid/CobProgAid/CobProgAid.csproj
index 8c6c38d..bec8e58 100644
--- a/CobProgAid/CobProgAid/CobProgAid.csproj
+++ b/CobProgAid/CobProgAid/CobProgAid.csproj
@@ -52,6 +52,11 @@
+
+
+ Form
+
+
Form
@@ -69,6 +74,7 @@
Resources.resx
True
+
SettingsSingleFileGenerator
diff --git a/CobProgAid/CobProgAid/SaveRegCopyFile.Designer.cs b/CobProgAid/CobProgAid/SaveRegCopyFile.Designer.cs
new file mode 100644
index 0000000..efd1b1d
--- /dev/null
+++ b/CobProgAid/CobProgAid/SaveRegCopyFile.Designer.cs
@@ -0,0 +1,147 @@
+namespace CobProgAid
+{
+ partial class SaveRegCopyFile
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtUsageName = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.btnChooseFnameAndPlace = new System.Windows.Forms.Button();
+ this.txtChosenDirectory = new System.Windows.Forms.TextBox();
+ this.txtFileName = new System.Windows.Forms.TextBox();
+ this.btnSave = new System.Windows.Forms.Button();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label1.Location = new System.Drawing.Point(29, 26);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(134, 20);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Spara aktuell fil";
+ //
+ // txtUsageName
+ //
+ this.txtUsageName.Location = new System.Drawing.Point(167, 68);
+ this.txtUsageName.Name = "txtUsageName";
+ this.txtUsageName.Size = new System.Drawing.Size(308, 20);
+ this.txtUsageName.TabIndex = 1;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(30, 71);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(95, 13);
+ this.label2.TabIndex = 2;
+ this.label2.Text = "Användningsnamn";
+ //
+ // btnChooseFnameAndPlace
+ //
+ this.btnChooseFnameAndPlace.Location = new System.Drawing.Point(33, 104);
+ this.btnChooseFnameAndPlace.Name = "btnChooseFnameAndPlace";
+ this.btnChooseFnameAndPlace.Size = new System.Drawing.Size(92, 23);
+ this.btnChooseFnameAndPlace.TabIndex = 3;
+ this.btnChooseFnameAndPlace.Text = "Välj sparplats";
+ this.btnChooseFnameAndPlace.UseVisualStyleBackColor = true;
+ this.btnChooseFnameAndPlace.Click += new System.EventHandler(this.btnChooseFnameAndPlace_Click);
+ //
+ // txtChosenDirectory
+ //
+ this.txtChosenDirectory.Location = new System.Drawing.Point(167, 104);
+ this.txtChosenDirectory.Name = "txtChosenDirectory";
+ this.txtChosenDirectory.ReadOnly = true;
+ this.txtChosenDirectory.Size = new System.Drawing.Size(308, 20);
+ this.txtChosenDirectory.TabIndex = 4;
+ //
+ // txtFileName
+ //
+ this.txtFileName.Location = new System.Drawing.Point(167, 142);
+ this.txtFileName.Name = "txtFileName";
+ this.txtFileName.ReadOnly = true;
+ this.txtFileName.Size = new System.Drawing.Size(308, 20);
+ this.txtFileName.TabIndex = 5;
+ //
+ // btnSave
+ //
+ this.btnSave.Location = new System.Drawing.Point(400, 183);
+ this.btnSave.Name = "btnSave";
+ this.btnSave.Size = new System.Drawing.Size(75, 23);
+ this.btnSave.TabIndex = 6;
+ this.btnSave.Text = "Spara";
+ this.btnSave.UseVisualStyleBackColor = true;
+ this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
+ //
+ // btnCancel
+ //
+ this.btnCancel.Location = new System.Drawing.Point(319, 183);
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size(75, 23);
+ this.btnCancel.TabIndex = 7;
+ this.btnCancel.Text = "Avbryt";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+ //
+ // SaveRegCopyFile
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(503, 233);
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.btnSave);
+ this.Controls.Add(this.txtFileName);
+ this.Controls.Add(this.txtChosenDirectory);
+ this.Controls.Add(this.btnChooseFnameAndPlace);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.txtUsageName);
+ this.Controls.Add(this.label1);
+ this.Name = "SaveRegCopyFile";
+ this.Text = "Spara och Registrera skapad fil";
+ this.Load += new System.EventHandler(this.SaveRegCopyFile_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtUsageName;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Button btnChooseFnameAndPlace;
+ private System.Windows.Forms.TextBox txtChosenDirectory;
+ private System.Windows.Forms.TextBox txtFileName;
+ private System.Windows.Forms.Button btnSave;
+ private System.Windows.Forms.Button btnCancel;
+ private System.Windows.Forms.SaveFileDialog saveFileDialog;
+ }
+}
\ No newline at end of file
diff --git a/CobProgAid/CobProgAid/SaveRegCopyFile.cs b/CobProgAid/CobProgAid/SaveRegCopyFile.cs
new file mode 100644
index 0000000..6e335a0
--- /dev/null
+++ b/CobProgAid/CobProgAid/SaveRegCopyFile.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.IO;
+using System.Windows.Forms;
+
+namespace CobProgAid
+{
+ public partial class SaveRegCopyFile : Form
+ {
+ public savedFile SavedFile { get; set; }
+ public string FileData { get; set; }
+ public string finalFileName { get; set; }
+
+ public SaveRegCopyFile()
+ {
+ InitializeComponent();
+ }
+
+ private void btnChooseFnameAndPlace_Click(object sender, EventArgs e)
+ {
+ saveFileDialog.Title = "Välj plats för den aktuella filen !";
+ saveFileDialog.Filter = "Copy files (*.cpy)|*.cpy|Cobol code (*.cbl)|*.cbl|Text Files (*.txt)|*.txt|All files (*.*)|*.*";
+ saveFileDialog.FileName = SavedFile.fNameSaved;
+ if (saveFileDialog.ShowDialog() == DialogResult.OK)
+ {
+ SavedFile.fNameSaved = txtFileName.Text = saveFileDialog.FileName.Substring(saveFileDialog.FileName.LastIndexOf("\\") + 1); ;
+ SavedFile.directorySaved = txtChosenDirectory.Text = saveFileDialog.FileName.Substring(0, saveFileDialog.FileName.LastIndexOf("\\"));
+ SavedFile.usageName = txtUsageName.Text;
+ if (SavedFile.idConnect.Length > 0)
+ {
+ btnSave.Enabled = true;
+ }
+ else MessageBox.Show("idConnect för filtypen saknas !");
+ }
+ }
+
+ private void btnSave_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ this.finalFileName = saveFileDialog.FileName;
+ File.WriteAllText(saveFileDialog.FileName, FileData);
+ SavedFile.saveDate = DateTime.Now;
+ savedFile tmpSF = new savedFile();
+ //tmpSF = (savedFile)SavedFile.Clone();
+ //S.ettingListAdd(tmpSF);
+ this.Close();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Problem att spara :\r\n" + ex.Message);
+ }
+ }
+
+ private void btnCancel_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+
+ private void SaveRegCopyFile_Load(object sender, EventArgs e)
+ {
+ txtUsageName.Text = SavedFile.usageName;
+ txtChosenDirectory.Text = "";
+ txtFileName.Text = "";
+ btnSave.Enabled = false;
+
+ }
+ }
+}
diff --git a/CobProgAid/CobProgAid/SaveRegCopyFile.resx b/CobProgAid/CobProgAid/SaveRegCopyFile.resx
new file mode 100644
index 0000000..5e7f0a6
--- /dev/null
+++ b/CobProgAid/CobProgAid/SaveRegCopyFile.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/CobProgAid/CobProgAid/ShowCode.Designer.cs b/CobProgAid/CobProgAid/ShowCode.Designer.cs
index b21824f..d687b69 100644
--- a/CobProgAid/CobProgAid/ShowCode.Designer.cs
+++ b/CobProgAid/CobProgAid/ShowCode.Designer.cs
@@ -1,4 +1,4 @@
-namespace CobXmlSupport
+namespace CobProgAid
{
partial class ShowCode
{
diff --git a/CobProgAid/CobProgAid/ShowCode.cs b/CobProgAid/CobProgAid/ShowCode.cs
index 0ec0ba0..fc57b94 100644
--- a/CobProgAid/CobProgAid/ShowCode.cs
+++ b/CobProgAid/CobProgAid/ShowCode.cs
@@ -9,17 +9,16 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
-using Newtonsoft.Json;
-namespace CobXmlSupport
+namespace CobProgAid
{
public partial class ShowCode : Form
{
- public readonly string CSV = ".csv";
- public readonly string DIF = ".dif";
- public readonly string JSON = ".json";
+ //public readonly string CSV = ".csv";
+ //public readonly string DIF = ".dif";
+ //public readonly string JSON = ".json";
string oldTxt;
bool bSynch;
@@ -60,9 +59,9 @@ namespace CobXmlSupport
set { lblCodeType.Text = value; }
}
- private GenCobCode parentWindow;
+ private frmProgAidHome parentWindow;
- public GenCobCode Parent
+ public frmProgAidHome Parent
{
get { return parentWindow; }
set { parentWindow = value; }
@@ -95,47 +94,36 @@ namespace CobXmlSupport
private void btnSynch_Click(object sender, EventArgs e)
{
- 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;
- Cc.TryFill_In_Dic();
+ //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;
+ //Cc.TryFill_In_Dic();
- foreach (CobRow cr in parentWindow.RowList)
- {
- if (!cr.isAttribute && !cr.SampleStr.Equals(parentWindow.NOMOVE))
- {
- if (Cc.WorkDicIn != null && Cc.WorkDicIn.Count > 0)
- {
- if (Cc.WorkDicIn.TryGetValue(cr.FieldName, out fieldCompl))
- {
- cr.MoveCode = fieldCompl;
- }
- }
- if (cr.MoveCode == null) { cr.MoveCode = " "; }
- Cc.WorkDicIn[cr.FieldName]=cr.MoveCode;
- }
- }
+ //foreach (CobRow cr in parentWindow.RowList)
+ //{
+ // if (!cr.isAttribute && !cr.SampleStr.Equals(parentWindow.NOMOVE))
+ // {
+ // if (Cc.WorkDicIn != null && Cc.WorkDicIn.Count > 0)
+ // {
+ // if (Cc.WorkDicIn.TryGetValue(cr.FieldName, out fieldCompl))
+ // {
+ // cr.MoveCode = fieldCompl;
+ // }
+ // }
+ // if (cr.MoveCode == null) { cr.MoveCode = " "; }
+ // Cc.WorkDicIn[cr.FieldName]=cr.MoveCode;
+ // }
+ //}
- Cc.Save_In_Dic();
+ //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;
}
- private Dictionary moveJsonFieldDictionary(string ccIn)
- {
- Dictionary tmpDic = JsonConvert.DeserializeObject>(ccIn);
- return tmpDic;
- }
-
- private string createJsonFromDic(Dictionary wrkDic)
- {
- string tmpJson = JsonConvert.SerializeObject(wrkDic);
- return tmpJson;
- }
-
+
private string deQuote(string inString)
{
string tmpStr = "";
@@ -176,159 +164,38 @@ namespace CobXmlSupport
}
- private Dictionary moveFieldDictionary(string inFil)
- {
- Dictionary tmpDic = new Dictionary();
- string[] splits = { "\r\n" };
- string[] itemPairs = inFil.Split(splits, StringSplitOptions.RemoveEmptyEntries);
- char[] newSplits = { '\t' };
- foreach (string itemPair in itemPairs)
- {
- string[] items = itemPair.Split(newSplits);
- tmpDic.Add(items[0], items[1].Replace("\n", "\r\n"));
- }
-
- return tmpDic;
- }
-
- private Dictionary moveDifFieldDictionary(string inFil)
- {
- bool TABLE = false, VECTORS = false, TUPLES = false, DATA = false;
- int rows = 0, rowCount = 0;
- Dictionary tmpDic = new Dictionary();
- string[] splits = { "\r\n" };
- char[] csplit = { ',' };
- string[] items = inFil.Split(splits, StringSplitOptions.RemoveEmptyEntries);
- for (int i = 0; i < items.Count(); i++)
- {
- string item = items[i];
- switch (item.ToUpper())
- {
- case "TABLE":
- {
- TABLE = true;
- break;
- }
- case "VECTORS":
- {
- VECTORS = true;
- string[] nums = items[i + 1].Split(csplit);
- rows = int.Parse(nums[1]);
- break;
- }
- case "TUPLES":
- {
- TUPLES = true;
- break;
- }
-
- case "DATA":
- {
- DATA = true;
- break;
- }
-
- case "BOT":
- {
- if (TABLE && VECTORS && TUPLES && DATA)
- {
- if (rowCount < rows)
- {
- tmpDic.Add(deQuote(items[i + 2]), items[i + 4].Replace("\n", "\r\n"));
- rowCount++;
- i = i + 4;
- }
- }
- break;
- }
- case "EOD":
- {
- i = items.Count();
- break;
- }
- }
- }
-
- return tmpDic;
- }
-
-
- private void refreshWindow(string inOut)
- {
- this.CodeShower.Text = "";
- foreach (CobRow cr in parentWindow.RowList)
- {
- if (cr.CobLevel < 2)
- {
- string inFile = parentWindow.CmbLastFile.Text.Substring(parentWindow.CmbLastFile.Text.LastIndexOf("\\") + 1);
- parentWindow.CreateComment(this.CodeShower, "Moves reference (with loop) " + cr.FieldName, S.ettingUserName, S.ettingCompany, inFile);
- }
- // Header square created
-
- if (!cr.isAttribute && !cr.SampleStr.Equals(parentWindow.NOMOVE))
- {
- if (this.CodeShower.Text == "") { }
- else this.CodeShower.Text += "\r\n";
- if (inOut == "IN")
- {
- if (cr.MoveCode == null)
- {
- this.CodeShower.Text += "".PadRight(30) + " " + cr.FieldName.PadRight(30);
-
- }
- else
- {
- this.CodeShower.Text += cr.MoveCode.PadRight(30) + " " + cr.FieldName.PadRight(30);
- }
- }
- else
- {
- if (cr.MoveFromCode == null)
- {
- this.CodeShower.Text += "".PadRight(30) + " " + cr.FieldName.PadRight(30);
-
- }
- else
- {
- this.CodeShower.Text += cr.MoveFromCode.PadRight(30) + " " + cr.FieldName.PadRight(30);
- }
- }
-
- }
-
- }
-
- }
+
+
private void btnSynchOut_Click(object sender, EventArgs e)
{
- 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;
- Cc.TryFill_Out_Dic();
+ //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;
+ //Cc.TryFill_Out_Dic();
- // wrkDic = new Dictionary();
- foreach (CobRow cr in parentWindow.RowList)
- {
- if (!cr.isAttribute && !cr.SampleStr.Equals(parentWindow.NOMOVE))
- {
- if (Cc.WorkDicOut != null && Cc.WorkDicOut.Count > 0)
- {
- if (Cc.WorkDicOut.TryGetValue(cr.FieldName, out fieldCompl))
- {
- cr.MoveFromCode = fieldCompl;
- }
- }
- if (cr.MoveFromCode == null) { cr.MoveFromCode = " "; }
- Cc.WorkDicOut[cr.FieldName] = cr.MoveFromCode;
- }
- }
+ //// wrkDic = new Dictionary();
+ //foreach (CobRow cr in parentWindow.RowList)
+ //{
+ // if (!cr.isAttribute && !cr.SampleStr.Equals(parentWindow.NOMOVE))
+ // {
+ // if (Cc.WorkDicOut != null && Cc.WorkDicOut.Count > 0)
+ // {
+ // if (Cc.WorkDicOut.TryGetValue(cr.FieldName, out fieldCompl))
+ // {
+ // cr.MoveFromCode = fieldCompl;
+ // }
+ // }
+ // if (cr.MoveFromCode == null) { cr.MoveFromCode = " "; }
+ // Cc.WorkDicOut[cr.FieldName] = cr.MoveFromCode;
+ // }
+ //}
- Cc.Save_Out_Dic();
+ //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)
diff --git a/CobProgAid/CobProgAid/savedFile.cs b/CobProgAid/CobProgAid/savedFile.cs
new file mode 100644
index 0000000..9648271
--- /dev/null
+++ b/CobProgAid/CobProgAid/savedFile.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace CobProgAid
+{
+ public class savedFile : ICloneable
+ {
+ public savedFile()
+ {
+ idConnect = "";
+ usageName = "";
+ directorySaved = "";
+ fNameSaved = "";
+ saveDate = DateTime.MinValue;
+ }
+
+ public string idConnect;
+ public string usageName;
+ public string directorySaved;
+ public string fNameSaved;
+ public DateTime saveDate;
+
+
+ public object Clone()
+ {
+ savedFile tmpSF = new savedFile();
+ tmpSF = (savedFile)this.MemberwiseClone();
+ return tmpSF;
+ }
+ }
+}