mall resurs + visning window

This commit is contained in:
2015-09-05 15:49:11 +02:00
parent da7ffc31fc
commit 56a913d962
10 changed files with 4090 additions and 39 deletions

View File

@ -44,16 +44,20 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<Compile Include="frmProgAidHome.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
<Compile Include="frmProgAidHome.Designer.cs">
<DependentUpon>frmProgAidHome.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
<Compile Include="ShowCode.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ShowCode.Designer.cs" />
<EmbeddedResource Include="frmProgAidHome.resx">
<DependentUpon>frmProgAidHome.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
@ -63,7 +67,9 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="ShowCode.resx" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

View File

@ -16,7 +16,7 @@ namespace CobProgAid
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
Application.Run(new frmProgAidHome());
}
}
}

View File

@ -8,10 +8,10 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace CobProgAid.Properties
{
namespace CobProgAid.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@ -22,50 +22,58 @@ namespace CobProgAid.Properties
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CobProgAid.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to *----------------------------------------------------------------*
/// * *
/// * SYSTEM GENOMKÖRNING AV FILER *
/// * *
/// * PROGRAM-ID YYYYYYY *
/// * *
/// * AUTHOR Peter Quick / omarbetad av Tommy Öman *
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string CobMallLasFil {
get {
return ResourceManager.GetString("CobMallLasFil", resourceCulture);
}
}
}
}

View File

@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@ -109,9 +112,263 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.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>
<data name="CobMallLasFil" xml:space="preserve">
<value>*----------------------------------------------------------------*
* *
* SYSTEM GENOMKÖRNING AV FILER *
* *
* PROGRAM-ID YYYYYYY *
* *
* AUTHOR Peter Quick / omarbetad av Tommy Öman *
* *
* DATUM September 2015 *
* *
* genereras genom *
* pqfix &lt;FILNAMN&gt; ex OBFIL *
* *
* Loggfil under /tmp ex. PQOBFIL0150.txt *
* OK, FIL TOM, FIL SAKNAS eller ERR XX *
* Loggfilen |ppnas EXTEND *
* *
*$$ *
*----------------------------------------------------------------*
*$DATUM SIGN [NDRING *
* ------ ---- ------------------------------------------------ *
*----------------------------------------------------------------*
IDENTIFICATION DIVISION.
PROGRAM-ID. TOXXXXX.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
CONSOLE IS CRT.
/----------------------------------------------------------------*
INPUT-OUTPUT SECTION.
FILE-CONTROL.
*----------------------------------------------------------------*
COPY COPFCXXXXX.
SELECT LOGG ASSIGN W-FILNAMN
ORGANIZATION LINE SEQUENTIAL
STATUS F-STATUS.
/----------------------------------------------------------------*
DATA DIVISION.
FILE SECTION.
*----------------------------------------------------------------*
COPY COPFDXXXXX.
FD LOGG.
01 LOGGRAD.
03 LOGG-FIL PIC X(05).
03 LOGG-SEMI PIC X(02).
03 LOGG-TEXT PIC X(73).
*----------------------------------------------------------------*
WORKING-STORAGE SECTION.
*----------------------------------------------------------------*
77 W-IX PIC 9(02) VALUE 0.
77 W-SUBSTATUS PIC 9(04) VALUE 0.
77 W-LAES-VIDARE PIC X VALUE SPACE.
88 LAES-VIDARE VALUE SPACE FALSE "X".
77 W-NUM10 PIC 9(10).
77 W-NUM9 PIC 9(09).
77 W-NUM8 PIC 9(08).
77 W-NUM7 PIC 9(07).
77 W-NUM6 PIC 9(06).
77 W-NUM5 PIC 9(05).
77 W-NUM4 PIC 9(04).
77 W-NUM3 PIC 9(03).
77 W-NUM2 PIC 9(02).
77 W-NUM1 PIC 9(01).
77 W-NUM92 PIC 9(09)V99-.
77 W-THRUFIL PIC X(05).
01 W-FILNAMN.
02 FILLER PIC X(05) VALUE "/tmp/".
02 FILLER PIC X(07) VALUE "YYYYYYY".
02 W-FILFORNR PIC 9(04).
02 FILLER PIC X(04) VALUE ".txt".
01 W-STATUS-KEY PIC 9(1).
COPY COPTXTKSY990.
COPY COPWSSTD.
COPY COPWSDATUM.
COPY COPLSLOKAL.
*----------------------------------------------------------------*
LINKAGE SECTION.
*----------------------------------------------------------------*
COPY COPLSMENY.
COPY COPLSGLOBAL.
COPY COPLSSYSTEM.
*----------------------------------------------------------------*
PROCEDURE DIVISION USING MENY-AREA, GLOB-AREA, SYST-AREA.
*----------------------------------------------------------------*
A-100-START SECTION.
COPY COPPDINITSS.
MOVE "XXXXX" TO W-THRUFIL
PERFORM X-DRIVE-THRU.
IF F-STATUS NOT = "00"
PERFORM X-SKRIV-LOG
END-IF.
A-900-SLUT.
EXIT PROGRAM.
X-DRIVE-THRU SECTION.
X-DRIVE-1000-START.
MOVE "00" TO F-STATUS.
MOVE SPACE TO LOGGRAD.
MOVE MENY-FORNR TO W-FILFORNR.
OPEN OUTPUT LOGG.
CLOSE LOGG.
MOVE MENY-FORNR TO FIL-FORNR.
MOVE W-THRUFIL TO FIL-NAMN.
OPEN INPUT XXXXX.
IF ACCESSFEL
IF FIL-SAKNAS
MOVE "FIL SAKNAS" TO LOGG-TEXT
ELSE
PERFORM X-FORMAT-FATAL
END-IF
EXIT SECTION
END-IF.
INITIALIZE XXXXX-NYC.
START XXXXX KEY NOT &lt; XXXXX-NYC.
IF ACCESSFEL
IF POST-SAKNAS
MOVE "FIL TOM" TO LOGG-TEXT
ELSE
PERFORM X-FORMAT-FATAL
END-IF
ELSE
SET LAES-VIDARE TO TRUE
PERFORM UNTIL NOT LAES-VIDARE
PERFORM X-DRIVE-READ
END-PERFORM
END-IF.
CLOSE XXXXX.
MOVE W-THRUFIL TO LOGG-FIL.
MOVE ":" TO LOGG-SEMI.
X-DRIVE-1999-END.
EXIT.
X-DRIVE-READ SECTION.
READ XXXXX NEXT
IF FILSLUT
MOVE "OK" TO LOGG-TEXT
SET LAES-VIDARE TO FALSE
EXIT SECTION
END-IF
IF ACCESSFEL AND NOT POST-LOCKED
IF POST-SAKNAS
MOVE "FIL TOM" TO LOGG-TEXT
ELSE
PERFORM X-FORMAT-FATAL
END-IF
SET LAES-VIDARE TO FALSE
EXIT SECTION
END-IF
* Exempel som loggar en parameter hos alla kunder.
* Levereras med en upddata och g}r i nattk|rningen.
* H{mtas hem med pqget tv} dagar senare.
* IF GRUND-AVD = 0 AND GRUND-SYSTEM = SPACE AND
* GRUND-POSTTYP = "GEMEN"
* MOVE MENY-FORNR TO LOGGRAD
* MOVE GRUND-AFFOREDOV TO LOGGRAD(6:1)
* IF GRUND-AFFOREDOV = 1
* MOVE "OBS!" TO LOGGRAD(8:4)
* END-IF
* PERFORM X-SKRIV-LOG
* END-IF.
* IF OBFIL-VAKOD = "EVR"
* MOVE MENY-FORNR TO LOGGRAD
* MOVE OBFIL-FAKTNR TO W-NUM8
* MOVE W-NUM8 TO LOGGRAD(6:8)
* MOVE OBFIL-VAKOD TO LOGGRAD(15:3)
* PERFORM X-SKRIV-LOG
* END-IF.
* Observera filen {r |ppnad med INPUT
******* L{gg in vad programmet ska g|ra h{r ******************
******* *********************************** ******************
.
X-DRIVE-READ-EX.
EXIT.
X-SKRIV-LOG SECTION.
X-SKRIV-10000-START.
MOVE MENY-FORNR TO W-FILFORNR.
OPEN EXTEND LOGG.
WRITE LOGGRAD BEFORE 1.
CLOSE LOGG.
X-SKRIV-10900-SLUT.
EXIT.
X-FORMAT-FATAL SECTION.
X-SKRIV-11000-START.
MOVE "FEL" TO LOGG-TEXT(1:3)
MOVE F-STATUS TO LOGG-TEXT(5:2)
IF F-STATUS1 = 9
MOVE LOW-VALUES TO F-STATUS1
MOVE F-STATUS-BIN TO W-SUBSTATUS
MOVE W-SUBSTATUS TO LOGG-TEXT(8:3)
MOVE FATAL-TABTEXT(W-SUBSTATUS) TO LOGG-TEXT(12:68)
EXIT SECTION
END-IF
EVALUATE F-STATUS
WHEN "10" MOVE 10 TO W-SUBSTATUS
WHEN "22" MOVE 66 TO W-SUBSTATUS
WHEN "23" MOVE 73 TO W-SUBSTATUS
WHEN "39" MOVE 139 TO W-SUBSTATUS
WHEN "41" MOVE 12 TO W-SUBSTATUS
WHEN "46" MOVE 146 TO W-SUBSTATUS
WHEN "47" MOVE 147 TO W-SUBSTATUS
WHEN "48" MOVE 148 TO W-SUBSTATUS
WHEN "49" MOVE 149 TO W-SUBSTATUS
END-EVALUATE
IF W-SUBSTATUS NOT &lt; 1 AND NOT &gt; 254
MOVE FATAL-TABTEXT(W-SUBSTATUS) TO LOGG-TEXT(12:68)
END-IF
.
X-SKRIV-11900-SLUT.
EXIT.</value>
</data>
</root>

157
CobProgAid/CobProgAid/ShowCode.Designer.cs generated Normal file
View File

@ -0,0 +1,157 @@
namespace CobXmlSupport
{
partial class ShowCode
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShowCode));
this.btnClose = new System.Windows.Forms.Button();
this.txtCode = new System.Windows.Forms.TextBox();
this.lblCodeType = new System.Windows.Forms.Label();
this.btnSynch = new System.Windows.Forms.Button();
this.btnSynchOut = new System.Windows.Forms.Button();
this.btnSaveAktualText = new System.Windows.Forms.Button();
this.btnCompare = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// 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(604, 642);
this.btnClose.Margin = new System.Windows.Forms.Padding(2);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(56, 23);
this.btnClose.TabIndex = 0;
this.btnClose.Text = "Close";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// txtCode
//
this.txtCode.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| 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(11, 54);
this.txtCode.Margin = new System.Windows.Forms.Padding(2);
this.txtCode.Multiline = true;
this.txtCode.Name = "txtCode";
this.txtCode.ScrollBars = System.Windows.Forms.ScrollBars.Both;
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);
//
// lblCodeType
//
this.lblCodeType.AutoSize = true;
this.lblCodeType.Font = new System.Drawing.Font("Microsoft YaHei UI", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblCodeType.Location = new System.Drawing.Point(9, 28);
this.lblCodeType.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblCodeType.Name = "lblCodeType";
this.lblCodeType.Size = new System.Drawing.Size(75, 16);
this.lblCodeType.TabIndex = 2;
this.lblCodeType.Text = "<codeType>";
//
// 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(494, 642);
this.btnSynch.Name = "btnSynch";
this.btnSynch.Size = new System.Drawing.Size(105, 23);
this.btnSynch.TabIndex = 3;
this.btnSynch.Text = "Synch Moves To";
this.btnSynch.UseVisualStyleBackColor = true;
this.btnSynch.Visible = false;
this.btnSynch.Click += new System.EventHandler(this.btnSynch_Click);
//
// 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(378, 642);
this.btnSynchOut.Name = "btnSynchOut";
this.btnSynchOut.Size = new System.Drawing.Size(110, 23);
this.btnSynchOut.TabIndex = 4;
this.btnSynchOut.Text = "Synch Moves From";
this.btnSynchOut.UseVisualStyleBackColor = true;
this.btnSynchOut.Visible = false;
this.btnSynchOut.Click += new System.EventHandler(this.btnSynchOut_Click);
//
// 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(12, 642);
this.btnSaveAktualText.Name = "btnSaveAktualText";
this.btnSaveAktualText.Size = new System.Drawing.Size(83, 23);
this.btnSaveAktualText.TabIndex = 5;
this.btnSaveAktualText.Text = "Spara Copy";
this.btnSaveAktualText.UseVisualStyleBackColor = true;
this.btnSaveAktualText.Click += new System.EventHandler(this.btnSaveAktualText_Click);
//
// btnCompare
//
this.btnCompare.Location = new System.Drawing.Point(101, 642);
this.btnCompare.Name = "btnCompare";
this.btnCompare.Size = new System.Drawing.Size(98, 23);
this.btnCompare.TabIndex = 6;
this.btnCompare.Text = "Compare Existing";
this.btnCompare.UseVisualStyleBackColor = true;
this.btnCompare.Click += new System.EventHandler(this.btnCompare_Click);
//
// ShowCode
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(670, 674);
this.Controls.Add(this.btnCompare);
this.Controls.Add(this.btnSaveAktualText);
this.Controls.Add(this.btnSynchOut);
this.Controls.Add(this.btnSynch);
this.Controls.Add(this.lblCodeType);
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(2);
this.Name = "ShowCode";
this.Text = "ShowCode";
this.Load += new System.EventHandler(this.ShowCode_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.TextBox txtCode;
private System.Windows.Forms.Label lblCodeType;
private System.Windows.Forms.Button btnSynch;
private System.Windows.Forms.Button btnSynchOut;
private System.Windows.Forms.Button btnSaveAktualText;
private System.Windows.Forms.Button btnCompare;
}
}

View File

@ -0,0 +1,368 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using Newtonsoft.Json;
namespace CobXmlSupport
{
public partial class ShowCode : Form
{
public readonly string CSV = ".csv";
public readonly string DIF = ".dif";
public readonly string JSON = ".json";
string oldTxt;
bool bSynch;
string finalFileSafe;
public savedFile SavedFile { get; set; }
public ShowCode()
{
InitializeComponent();
oldTxt = "";
bSynch = false;
}
public bool BSynch
{
get
{
return bSynch;
}
set
{
bSynch = value;
btnSynch.Visible = bSynch;
btnSynchOut.Visible = bSynch;
}
}
public TextBox CodeShower
{
get { return txtCode; }
set { txtCode = value; }
}
public string Labeltext
{
get { return lblCodeType.Text; }
set { lblCodeType.Text = value; }
}
private GenCobCode parentWindow;
public GenCobCode Parent
{
get { return parentWindow; }
set { parentWindow = value; }
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void txtCode_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.A)
{
txtCode.SelectAll();
}
}
private void txtCode_TextChanged(object sender, EventArgs e)
{
if (txtCode.Text.Length > oldTxt.Length)
{
string tmpNewText = txtCode.Text.Substring(oldTxt.Length);
//Debug.Write(tmpNewText);
//Tag bort denna kommentering för att testa på vad som precis skrivs på log-fönster.
oldTxt = txtCode.Text;
}
}
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();
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();
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;
}
private Dictionary<string, string> moveJsonFieldDictionary(string ccIn)
{
Dictionary<string, string> tmpDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(ccIn);
return tmpDic;
}
private string createJsonFromDic(Dictionary<string, string> wrkDic)
{
string tmpJson = JsonConvert.SerializeObject(wrkDic);
return tmpJson;
}
private string deQuote(string inString)
{
string tmpStr = "";
char[] x = inString.ToArray<char>();
for (int i = 0; i < x.Length; i++)
{
if (x[i] == '\"')
{
if (i < x.Length - 1)
{
if (x[i + 1] == '\"')
{
i++;
tmpStr += "\"";
}
}
}
else tmpStr += x[i];
}
return tmpStr;
}
private string enQuote(string inString)
{
string tmpStr = "";
char[] x = inString.ToArray<char>();
for (int i = 0; i < x.Length; i++)
{
if (x[i] == '\"')
{
{
tmpStr += "\"\"";
}
}
else tmpStr += x[i];
}
return "\"" + tmpStr + "\"";
}
private Dictionary<string, string> moveFieldDictionary(string inFil)
{
Dictionary<string, string> tmpDic = new Dictionary<string, string>();
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<string, string> moveDifFieldDictionary(string inFil)
{
bool TABLE = false, VECTORS = false, TUPLES = false, DATA = false;
int rows = 0, rowCount = 0;
Dictionary<string, string> tmpDic = new Dictionary<string, string>();
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();
// wrkDic = new Dictionary<string, string>();
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();
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;
}
private void btnSaveAktualText_Click(object sender, EventArgs e)
{
SaveRegCopyFile saveWin = new SaveRegCopyFile();
saveWin.SavedFile = this.SavedFile;
saveWin.FileData = this.txtCode.Text;
saveWin.ShowDialog();
finalFileSafe = saveWin.finalFileName;
btnCompare.Enabled = (finalFileSafe.Trim() != "");
}
private void ShowCode_Load(object sender, EventArgs e)
{
if (parentWindow == null)
{
btnSaveAktualText.Enabled = false;
}
else btnSaveAktualText.Enabled = true;
btnCompare.Enabled = false;
}
private void btnCompare_Click(object sender, EventArgs e)
{
try
{
string existing = finalFileSafe.Substring(finalFileSafe.LastIndexOf("\\"));
Process.Start("C:\\Program Files (x86)\\WinMerge\\WinMergeU.exe", finalFileSafe + " Q:\\kII20\\cpy\\" + existing);
}
catch (Exception ex)
{
MessageBox.Show("Problem vid starta WinMerge :" + ex.Message);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
namespace CobProgAid
{
partial class Form1
partial class frmProgAidHome
{
/// <summary>
/// Required designer variable.

View File

@ -10,9 +10,9 @@ using System.Windows.Forms;
namespace CobProgAid
{
public partial class Form1 : Form
public partial class frmProgAidHome : Form
{
public Form1()
public frmProgAidHome()
{
InitializeComponent();
}