From c4e23b385026790a2a3a2f01e9444e08e0468ef4 Mon Sep 17 00:00:00 2001 From: BlubbFish Date: Mon, 16 Nov 2015 00:41:45 +0000 Subject: [PATCH] rest --- Anzeige/Anzeige.csproj | 94 +++++++++++++++++ Anzeige/App.config | 6 ++ Anzeige/Form1.Designer.cs | 120 +++++++++++++++++++++ Anzeige/Form1.cs | 84 +++++++++++++++ Anzeige/Form1.resx | 126 ++++++++++++++++++++++ Anzeige/Program.cs | 22 ++++ Anzeige/Properties/AssemblyInfo.cs | 36 +++++++ Anzeige/Properties/Resources.Designer.cs | 71 +++++++++++++ Anzeige/Properties/Resources.resx | 117 ++++++++++++++++++++ Anzeige/Properties/Settings.Designer.cs | 30 ++++++ Anzeige/Properties/Settings.settings | 7 ++ Converting/Conv.cs | 65 ++++++++++++ Converting/Converter.cs | 95 +++++++++++++++++ Converting/Converting.csproj | 54 ++++++++++ Converting/Properties/AssemblyInfo.cs | 36 +++++++ tconv.sln | 32 ++++++ tconv/App.config | 6 ++ tconv/Program.cs | 129 +++++++++++++++++++++++ tconv/Properties/AssemblyInfo.cs | 36 +++++++ tconv/tconv.csproj | 58 ++++++++++ 20 files changed, 1224 insertions(+) create mode 100644 Anzeige/Anzeige.csproj create mode 100644 Anzeige/App.config create mode 100644 Anzeige/Form1.Designer.cs create mode 100644 Anzeige/Form1.cs create mode 100644 Anzeige/Form1.resx create mode 100644 Anzeige/Program.cs create mode 100644 Anzeige/Properties/AssemblyInfo.cs create mode 100644 Anzeige/Properties/Resources.Designer.cs create mode 100644 Anzeige/Properties/Resources.resx create mode 100644 Anzeige/Properties/Settings.Designer.cs create mode 100644 Anzeige/Properties/Settings.settings create mode 100644 Converting/Conv.cs create mode 100644 Converting/Converter.cs create mode 100644 Converting/Converting.csproj create mode 100644 Converting/Properties/AssemblyInfo.cs create mode 100644 tconv.sln create mode 100644 tconv/App.config create mode 100644 tconv/Program.cs create mode 100644 tconv/Properties/AssemblyInfo.cs create mode 100644 tconv/tconv.csproj diff --git a/Anzeige/Anzeige.csproj b/Anzeige/Anzeige.csproj new file mode 100644 index 0000000..0e21809 --- /dev/null +++ b/Anzeige/Anzeige.csproj @@ -0,0 +1,94 @@ + + + + + Debug + AnyCPU + {5C9086EB-7EC5-4AC1-801E-07F6D12D3E19} + WinExe + Properties + Anzeige + Anzeige + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + {53bf135e-d9aa-48ed-9139-bcecaf89a1af} + Converting + + + + + \ No newline at end of file diff --git a/Anzeige/App.config b/Anzeige/App.config new file mode 100644 index 0000000..fad249e --- /dev/null +++ b/Anzeige/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Anzeige/Form1.Designer.cs b/Anzeige/Form1.Designer.cs new file mode 100644 index 0000000..88c7343 --- /dev/null +++ b/Anzeige/Form1.Designer.cs @@ -0,0 +1,120 @@ +namespace Anzeige +{ + partial class Form1 + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); + this.button1 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.button2 = new System.Windows.Forms.Button(); + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); + this.SuspendLayout(); + // + // openFileDialog1 + // + this.openFileDialog1.Filter = "Target PCB-Pool|*.T3000|Target 3001|*.T3001"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(12, 12); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 0; + this.button1.Text = "Öffnen"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 77); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(56, 13); + this.label1.TabIndex = 2; + this.label1.Text = "Richtung: "; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); + this.label2.Location = new System.Drawing.Point(75, 68); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(209, 25); + this.label2.TabIndex = 3; + this.label2.Text = "keine Datei geladen."; + // + // button2 + // + this.button2.Enabled = false; + this.button2.Location = new System.Drawing.Point(197, 12); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 4; + this.button2.Text = "Speichern"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // progressBar1 + // + this.progressBar1.Location = new System.Drawing.Point(12, 96); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Size = new System.Drawing.Size(260, 23); + this.progressBar1.TabIndex = 5; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(284, 130); + this.Controls.Add(this.progressBar1); + this.Controls.Add(this.button2); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.OpenFileDialog openFileDialog1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.ProgressBar progressBar1; + private System.Windows.Forms.SaveFileDialog saveFileDialog1; + } +} + diff --git a/Anzeige/Form1.cs b/Anzeige/Form1.cs new file mode 100644 index 0000000..d051d10 --- /dev/null +++ b/Anzeige/Form1.cs @@ -0,0 +1,84 @@ +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 Converting; +using System.IO; + +namespace Anzeige +{ + public partial class Form1 : Form + { + private String file_in = ""; + private String file_out = ""; + private bool encode = false; + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + this.openFileDialog1.FileName = ""; + this.openFileDialog1.Filter = "Target PCB-Pool|*.T3000|Target 3001|*.T3001"; + if (openFileDialog1.ShowDialog() == DialogResult.OK) + { + file_in = openFileDialog1.FileName; + String filename = file_in.Substring(file_in.LastIndexOf("\\") + 1, file_in.LastIndexOf(".") - file_in.LastIndexOf("\\") - 1); + if (file_in.Substring(file_in.LastIndexOf(".")).ToLower() == ".t3000") + { + + this.saveFileDialog1.Filter = "Target 3001|*.T3001"; + this.saveFileDialog1.FileName = filename + ".T3001"; + label2.Text = "Decoding"; + encode = false; + } + else + { + this.saveFileDialog1.Filter = "Target PCB-Pool|*.T3000"; + this.saveFileDialog1.FileName = filename + ".T3000"; + label2.Text = "Encoding"; + encode = true; + } + button2.Enabled = true; + } + } + + private void button2_Click(object sender, EventArgs e) + { + if (saveFileDialog1.ShowDialog() == DialogResult.OK) + { + file_out = saveFileDialog1.FileName; + FileInfo f = new FileInfo(file_in); + progressBar1.Maximum = Int32.Parse(f.Length.ToString()); + Conv c = new Conv(); + c.OnNewPosition += c_OnNewPosition; + c.OnFinish += c_OnFinish; + c.ConvertFile(file_in, file_out, encode); + } + } + + void c_OnFinish(object sender, int exitcode) + { + if (exitcode == 1) + { + label2.Text = "Error!"; + label2.ForeColor = Color.Red; + } + else + { + label2.Text = "Fertig!"; + } + } + + void c_OnNewPosition(object sender, int pos) + { + progressBar1.Value = pos; + } + } +} diff --git a/Anzeige/Form1.resx b/Anzeige/Form1.resx new file mode 100644 index 0000000..e14e86d --- /dev/null +++ b/Anzeige/Form1.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 157, 17 + + \ No newline at end of file diff --git a/Anzeige/Program.cs b/Anzeige/Program.cs new file mode 100644 index 0000000..f7d2533 --- /dev/null +++ b/Anzeige/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Anzeige +{ + static class Program + { + /// + /// Der Haupteinstiegspunkt für die Anwendung. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Anzeige/Properties/AssemblyInfo.cs b/Anzeige/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c494300 --- /dev/null +++ b/Anzeige/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die mit einer Assembly verknüpft sind. +[assembly: AssemblyTitle("Anzeige")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Anzeige")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von +// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("9a5b52b9-7d52-4c34-a3d6-532d00da5898")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Anzeige/Properties/Resources.Designer.cs b/Anzeige/Properties/Resources.Designer.cs new file mode 100644 index 0000000..768223a --- /dev/null +++ b/Anzeige/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.17929 +// +// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn +// der Code neu generiert wird. +// +//------------------------------------------------------------------------------ + +namespace Anzeige.Properties +{ + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse + // über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu. + [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 + { + + 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() + { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Anzeige.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Anzeige/Properties/Resources.resx b/Anzeige/Properties/Resources.resx new file mode 100644 index 0000000..ffecec8 --- /dev/null +++ b/Anzeige/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Anzeige/Properties/Settings.Designer.cs b/Anzeige/Properties/Settings.Designer.cs new file mode 100644 index 0000000..f3acb23 --- /dev/null +++ b/Anzeige/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.17929 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Anzeige.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Anzeige/Properties/Settings.settings b/Anzeige/Properties/Settings.settings new file mode 100644 index 0000000..abf36c5 --- /dev/null +++ b/Anzeige/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Converting/Conv.cs b/Converting/Conv.cs new file mode 100644 index 0000000..a50b4a5 --- /dev/null +++ b/Converting/Conv.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.IO; + +namespace Converting +{ + public class Conv + { + public delegate void PositionEventHandler(object sender, int pos); + public event PositionEventHandler OnNewPosition; + public delegate void FinishEventHandler(object sender, int exitcode); + public event FinishEventHandler OnFinish; + public void ConvertFile(String input, String output, bool encode) + { + BinaryReader reader = new BinaryReader(File.Open(input, FileMode.Open)); + BinaryWriter writer = new BinaryWriter(File.Open(output, FileMode.Create)); + Converter conv = new Converter(); + int i = 0; + try + { + while (true) + { + byte inp = reader.ReadByte(); + byte oup = 0; + if (encode) + { + oup = conv.encoding((byte)i++, inp); + } + else + { + oup = conv.decoding((byte)i++, inp); + } + if (this.OnNewPosition != null) + { + this.OnNewPosition(this, i); + } + writer.Write(oup); + //System.Threading.Thread.Sleep(1); + } + } + catch (EndOfStreamException) { } + catch (Exception e) + { + Console.WriteLine(e.Message); + if (this.OnFinish != null) + { + this.OnFinish(this, 1); + reader.Close(); + writer.Close(); + return; + } + } + if (this.OnFinish != null) + { + this.OnFinish(this, 0); + reader.Close(); + writer.Close(); + return; + } + } + } +} diff --git a/Converting/Converter.cs b/Converting/Converter.cs new file mode 100644 index 0000000..987d505 --- /dev/null +++ b/Converting/Converter.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Converting +{ + class Converter + { + private Dictionary, byte> enc = new Dictionary, byte>(); + private Dictionary, byte> dec = new Dictionary, byte>(); + private static byte[] encode = { 0x0C, 0x0D, 0x0E, 0x0F, 0x08, 0x09, 0x0A, 0x0B, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03 }; + private static byte[] decode = { 0x09, 0x0A, 0x0B, 0x0C, 0x05, 0x06, 0x07, 0x08, 0x01, 0x02, 0x03, 0x04, 0x0D, 0x0E, 0x0F, 0x00 }; + public static byte conv(byte pos, byte value, bool enc = true) + { + byte ret = 0; + //pos / 8; + //int offset_high = 14; + //int offset_low = 0; + + //int offset_high = 14; + + int offset_high = 0; + int offset_low = 0; + + if (enc) + { + offset_high = (14 - (pos / 16) >= 0) ? 14 - (pos / 16) : 15; + offset_low = (14 - (pos % 16) >= 0) ? 14 - (pos % 16) : 15; + if (pos % 16 == 15) + { + offset_high = (offset_high - 1 >= 0) ? offset_high - 1 : 15; + } + offset_high = offset_high % 16; + offset_high = offset_high + (((value / 8) + offset_low) / 16); + + int ol = ((value / 8) + offset_low) % 16; + int oh = ((((value & 0x0F) & 0x7) * 2) + offset_high) % 16; + + ret = (byte)(encode[oh] << 4); + ret = (byte)(ret | encode[ol]); + } + else + { + offset_low = decode[(pos+1)%16]; + offset_high = ((pos / 16)+1)%16; + if (pos % 16 == 15) + { + offset_high = (offset_high + 1) % 16; + } + offset_high = decode[offset_high]; + + byte nh = (byte)(value >> 4); + byte nl = (byte)(value & 0x0F); + + int oh = (nh + offset_high) % 16; + int ol = (nl + offset_low) % 16; + + + ret = (byte)(encode[oh] << 4); + ret = (byte)(ret | encode[ol]); + } + //int offset_high = pos + 1; + //int offset_low = 1; + + //int offset_low = (offset_high / 16) + 1; + + //byte n1 = (byte)(value >> 4); + //byte n2 = (byte)(value & 0x0F); + //int over = (((value / 8) + offset_low) / 16) % 2; + //ret = (byte)(nibble_high[(((value & 0x0F) & 0x7) + offset_high) % 8] + over << 4); + return ret; + } + public Converter() + { + for (int i = 0; i < 256; i++) + { + for (int j = 0; j < 256; j++) + { + enc.Add(new Tuple((byte)i, (byte)j), conv((byte)i, (byte)j, true)); + dec.Add(new Tuple((byte)i, conv((byte)i, (byte)j, true)), (byte)j); + } + } + } + public byte encoding(byte pos, byte value) + { + return enc[new Tuple(pos, value)]; + } + public byte decoding(byte pos, byte value) + { + return dec[new Tuple(pos, value)]; + } + } +} diff --git a/Converting/Converting.csproj b/Converting/Converting.csproj new file mode 100644 index 0000000..46c5225 --- /dev/null +++ b/Converting/Converting.csproj @@ -0,0 +1,54 @@ + + + + + Debug + AnyCPU + {53BF135E-D9AA-48ED-9139-BCECAF89A1AF} + Library + Properties + Converting + Converting + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Converting/Properties/AssemblyInfo.cs b/Converting/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..55e3139 --- /dev/null +++ b/Converting/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die mit einer Assembly verknüpft sind. +[assembly: AssemblyTitle("Converting")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Converting")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von +// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("35b2f8f7-0ddd-40a8-91ca-d7cce7f53dae")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/tconv.sln b/tconv.sln new file mode 100644 index 0000000..11902c2 --- /dev/null +++ b/tconv.sln @@ -0,0 +1,32 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tconv", "tconv\tconv.csproj", "{F5E3BC2C-6202-46F6-BF94-6BF31DD74C16}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Converting", "Converting\Converting.csproj", "{53BF135E-D9AA-48ED-9139-BCECAF89A1AF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Anzeige", "Anzeige\Anzeige.csproj", "{5C9086EB-7EC5-4AC1-801E-07F6D12D3E19}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F5E3BC2C-6202-46F6-BF94-6BF31DD74C16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F5E3BC2C-6202-46F6-BF94-6BF31DD74C16}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F5E3BC2C-6202-46F6-BF94-6BF31DD74C16}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F5E3BC2C-6202-46F6-BF94-6BF31DD74C16}.Release|Any CPU.Build.0 = Release|Any CPU + {53BF135E-D9AA-48ED-9139-BCECAF89A1AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {53BF135E-D9AA-48ED-9139-BCECAF89A1AF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {53BF135E-D9AA-48ED-9139-BCECAF89A1AF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {53BF135E-D9AA-48ED-9139-BCECAF89A1AF}.Release|Any CPU.Build.0 = Release|Any CPU + {5C9086EB-7EC5-4AC1-801E-07F6D12D3E19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5C9086EB-7EC5-4AC1-801E-07F6D12D3E19}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5C9086EB-7EC5-4AC1-801E-07F6D12D3E19}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5C9086EB-7EC5-4AC1-801E-07F6D12D3E19}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tconv/App.config b/tconv/App.config new file mode 100644 index 0000000..fad249e --- /dev/null +++ b/tconv/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tconv/Program.cs b/tconv/Program.cs new file mode 100644 index 0000000..1ee5303 --- /dev/null +++ b/tconv/Program.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.IO; + +namespace tconv +{ + class Program + { + static void Main(string[] args) + { + + /*BinaryReader reader = new BinaryReader(File.Open("D:\\Doc's\\Basteleien\\Zeitschaltung\\V6\\Zeitschaltung.T3000", FileMode.Open)); + BinaryWriter writer = new BinaryWriter(File.Open("E:\\bla.T3001", FileMode.Create)); + Converter conv = new Converter(); + int i = 0; + try + { + while (true) + { + byte c = reader.ReadByte(); + byte u = conv.decodeing((byte)i++, c); + writer.Write(u); + //byte u = Converter.conv((byte)(i%256),c,false); + //Console.Write(u.ToString("X2") + " "); + } + } + catch (Exception e) + { + Console.WriteLine(e.Message); + }//*/ + /*List oc = new List(); + List ou = new List(); + try + { + while (true) + { + byte[] t = new byte[16]; + t = scr.ReadBytes(16); + oc.Add(t[13]); + t = scr.ReadBytes(16); + t = scr.ReadBytes(16); + t = scr.ReadBytes(16); + t = scr.ReadBytes(16); + t = scr.ReadBytes(16); + t = scr.ReadBytes(16); + t = scr.ReadBytes(16); + t = scr.ReadBytes(16); + t = scr.ReadBytes(16); + t = scr.ReadBytes(16); + t = scr.ReadBytes(16); + t = scr.ReadBytes(16); + t = scr.ReadBytes(16); + t = scr.ReadBytes(16); + t = scr.ReadBytes(16); + } + } + catch (Exception) { }; + try + { + while (true) + { + byte[] t = new byte[16]; + t = sur.ReadBytes(16); + ou.Add(t[13]); + t = sur.ReadBytes(16); + t = sur.ReadBytes(16); + t = sur.ReadBytes(16); + t = sur.ReadBytes(16); + t = sur.ReadBytes(16); + t = sur.ReadBytes(16); + t = sur.ReadBytes(16); + t = sur.ReadBytes(16); + t = sur.ReadBytes(16); + t = sur.ReadBytes(16); + t = sur.ReadBytes(16); + t = sur.ReadBytes(16); + t = sur.ReadBytes(16); + t = sur.ReadBytes(16); + t = sur.ReadBytes(16); + } + } + catch (Exception) { }; + Dictionary output = new Dictionary(); + for (int i = 0; i < ou.Count; i++) + { + String o = ""; + byte u = ou[i]; + byte c = oc[i]; + o += Convert.ToString(u, 10).PadLeft(3, '0') + " -> " + Convert.ToString(c, 10).PadLeft(3, '0') + " | " + + u.ToString("X2") + " -> " + c.ToString("X2") + " | " + + Convert.ToString(u, 2).PadLeft(8, '0') + " -> " + Convert.ToString(c, 2).PadLeft(8, '0'); + if(!output.Keys.Contains(c)) + output.Add(c, o); + } + for (byte i = 0; i < 0xFF; i++) + { + if(output.Keys.Contains(i)) + Console.WriteLine(output[i]); + } + Console.WriteLine(output[0xFF]);*/ + /*byte u = 0x7E; + int pos = 0; + //byte c = Converter.conv((byte)(pos % 256), u, false); + Converter conv = new Converter(); + byte c = conv.decodeing((byte)pos, u); + String o = Convert.ToString(u, 10).PadLeft(3, '0') + " -> " + Convert.ToString(c, 10).PadLeft(3, '0') + " | " + + u.ToString("X2") + " -> " + c.ToString("X2") + " | " + + Convert.ToString(u, 2).PadLeft(8, '0') + " -> " + Convert.ToString(c, 2).PadLeft(8, '0'); + Console.WriteLine(o);*/ + + Console.WriteLine("\nEOF"); + Console.ReadKey(); + /*BinaryWriter s = new BinaryWriter(File.Open("E:\\bla.txt", FileMode.Create)); + for (int i = 0; i <= 0xff; i++) + { + for (int j = 0; j < 16; j++) + { + for (int k = 0; k < 16; k++) + { + s.Write((byte)i); + } + } + }*/ + } + } +} diff --git a/tconv/Properties/AssemblyInfo.cs b/tconv/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..107c011 --- /dev/null +++ b/tconv/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die mit einer Assembly verknüpft sind. +[assembly: AssemblyTitle("tconv")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("tconv")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von +// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("1795b418-d1e3-4525-a324-97377e268fd1")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/tconv/tconv.csproj b/tconv/tconv.csproj new file mode 100644 index 0000000..8627a11 --- /dev/null +++ b/tconv/tconv.csproj @@ -0,0 +1,58 @@ + + + + + Debug + AnyCPU + {F5E3BC2C-6202-46F6-BF94-6BF31DD74C16} + Exe + Properties + tconv + tconv + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file