commit e178c8e84340d784713a04d9403b0806b4096698 Author: Eugen Höglinger Date: Wed Nov 25 16:59:10 2020 +0100 Initialize diff --git a/.vs/FixedLineLength.git/v16/.suo b/.vs/FixedLineLength.git/v16/.suo new file mode 100644 index 0000000..aa9582a Binary files /dev/null and b/.vs/FixedLineLength.git/v16/.suo differ diff --git a/FixedLineLength.git.sln b/FixedLineLength.git.sln new file mode 100644 index 0000000..ca85865 --- /dev/null +++ b/FixedLineLength.git.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30709.132 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FixedLineLength", "FixedLineLength\FixedLineLength.csproj", "{17B0C08E-D3D2-4FF9-A76D-2C602BF26834}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_FixedLineLength", "Test_FixedLineLength\Test_FixedLineLength.csproj", "{A64CE09F-3F79-4A61-8F9A-190EABA1DC8F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {17B0C08E-D3D2-4FF9-A76D-2C602BF26834}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {17B0C08E-D3D2-4FF9-A76D-2C602BF26834}.Debug|Any CPU.Build.0 = Debug|Any CPU + {17B0C08E-D3D2-4FF9-A76D-2C602BF26834}.Release|Any CPU.ActiveCfg = Release|Any CPU + {17B0C08E-D3D2-4FF9-A76D-2C602BF26834}.Release|Any CPU.Build.0 = Release|Any CPU + {A64CE09F-3F79-4A61-8F9A-190EABA1DC8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A64CE09F-3F79-4A61-8F9A-190EABA1DC8F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A64CE09F-3F79-4A61-8F9A-190EABA1DC8F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A64CE09F-3F79-4A61-8F9A-190EABA1DC8F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E9986507-CB62-4BCE-A602-0F6DE31003C5} + EndGlobalSection +EndGlobal diff --git a/FixedLineLength/FixedLineLength.cs b/FixedLineLength/FixedLineLength.cs new file mode 100644 index 0000000..09c2dbd --- /dev/null +++ b/FixedLineLength/FixedLineLength.cs @@ -0,0 +1,162 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Eugen.ESystem +{ + public static class FixedLineLength + { + #region Version und Copyright + // Version und Copyright + static string dllName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen + static string dllVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); + static object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); + static string copyright = GenerateCopyright(); + static string icon = Application.StartupPath + "\\Info.bmp"; + //Assembly Datum und Zeit + static DateTime value = AssemblyDateTime(); + static string date = value.ToShortDateString(); + static string time = value.ToLongTimeString(); + private static DateTime AssemblyDateTime() + { + var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + var buildDateTime = new DateTime(2000, 1, 1).Add(new TimeSpan(TimeSpan.TicksPerDay * version.Build + TimeSpan.TicksPerSecond * 2 * version.Revision)); + //Tage seit dem 1. Januar 2000 und Sekunden seit Mitternacht, (multiplizier mit 2 ergibt das Original) + return buildDateTime; + } + + private static string CurrentYear() + { + DateTime dtn = DateTime.Now; + return dtn.Year.ToString(); + } + + private static string StartYear() + { + string startYear = ""; + if (((AssemblyCopyrightAttribute)attributes[0]).Copyright.Contains("Copyright © ")) + { + startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace("Copyright © ", ""); + while (startYear.StartsWith(" ")) + { + startYear = startYear.Remove(0, 1); + } + startYear = startYear.Remove(startYear.IndexOf(" ")); + return startYear; + } + else + { + DateTime dtn = DateTime.Now; + return dtn.Year.ToString(); + } + } + + private static string GenerateCopyright() + { + string startYear = StartYear(); + string currentYear = CurrentYear(); + + if (startYear == currentYear) + { + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + } + else + { + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace(startYear, String.Concat(startYear, "-", currentYear)); + } + } + #endregion + + #region DLL-Info + /// + /// Contains the name of the program file + /// + public static string DllName { set; get; } + + /// + /// Contains the version of the program file + /// + public static string DllVersion { set; get; } + + /// + /// Contains the copyright notice + /// + public static string Copyright { set; get; } + + static private void SetDllInfo() + { + //Name, Version und Copyright setzen + DllName = dllName; + DllVersion = dllVersion; + Copyright = copyright; + } + #endregion + + static FixedLineLength() + { + SetDllInfo(); + } + + /// + /// Formats a string with a fixed line length. + /// + /// String to be formatted. + /// Maximum line length + /// + public static string Format(string text, int lineLenght) + { + int pos = 0; + int spacePos = 0; + string character = ""; + string temp = ""; + string result = ""; + + while (text.Length > 0) + { + if (text.Length <= lineLenght) + { + result = String.Concat(result, text); + text = ""; + } + else + { + while (pos <= lineLenght) + { + character = text.Remove(0, pos).Remove(1); + + //Bei einem Zeilenumbruch oder Wagenrücklauf eine neu Zeile beginnen + if (character == "\n" || character == "\r") + { + spacePos = text.IndexOf("\n") + 1; + break; + } + + if (character == " ") + { + spacePos = pos + 1; + } + + pos++; + } + + temp = text.Remove(spacePos - 1); + if (temp.EndsWith("\n") || temp.EndsWith("\r")) + { + temp = temp.Remove(temp.Length - 1);// Ein schon enthaltenes '\n' oder '\r' am Ende de temporären Strings muss entfernt werden + } + text = text.Remove(0, spacePos); + result = String.Concat(result, temp, "\r\n"); + pos = 0; + spacePos = 0; + } + } + + return result; + } + } +} diff --git a/FixedLineLength/FixedLineLength.csproj b/FixedLineLength/FixedLineLength.csproj new file mode 100644 index 0000000..592cc79 --- /dev/null +++ b/FixedLineLength/FixedLineLength.csproj @@ -0,0 +1,49 @@ + + + + + Debug + AnyCPU + {17B0C08E-D3D2-4FF9-A76D-2C602BF26834} + Library + Properties + FixedLineLength + FixedLineLength + v4.7.2 + 512 + false + + + 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/FixedLineLength/Properties/AssemblyInfo.cs b/FixedLineLength/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..750200b --- /dev/null +++ b/FixedLineLength/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 einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("FixedLineLength")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FixedLineLength")] +[assembly: AssemblyCopyright("Copyright © 2020 by Eugen Höglinger")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("17b0c08e-d3d2-4ff9-a76d-2c602bf26834")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/FixedLineLength/bin/Debug/FixedLineLength.dll b/FixedLineLength/bin/Debug/FixedLineLength.dll new file mode 100644 index 0000000..7da7b05 Binary files /dev/null and b/FixedLineLength/bin/Debug/FixedLineLength.dll differ diff --git a/FixedLineLength/bin/Debug/FixedLineLength.pdb b/FixedLineLength/bin/Debug/FixedLineLength.pdb new file mode 100644 index 0000000..3ba5d51 Binary files /dev/null and b/FixedLineLength/bin/Debug/FixedLineLength.pdb differ diff --git a/FixedLineLength/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs b/FixedLineLength/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs new file mode 100644 index 0000000..3871b18 --- /dev/null +++ b/FixedLineLength/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] diff --git a/FixedLineLength/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/FixedLineLength/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..73653a6 Binary files /dev/null and b/FixedLineLength/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/FixedLineLength/obj/Debug/FixedLineLength.csproj.CoreCompileInputs.cache b/FixedLineLength/obj/Debug/FixedLineLength.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..48ec9b1 --- /dev/null +++ b/FixedLineLength/obj/Debug/FixedLineLength.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +d6ae7ded222e8c3392039badf32df6da748fa1f8 diff --git a/FixedLineLength/obj/Debug/FixedLineLength.csproj.FileListAbsolute.txt b/FixedLineLength/obj/Debug/FixedLineLength.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..b60b7b9 --- /dev/null +++ b/FixedLineLength/obj/Debug/FixedLineLength.csproj.FileListAbsolute.txt @@ -0,0 +1,6 @@ +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\FixedLineLength\bin\Debug\FixedLineLength.dll +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\FixedLineLength\bin\Debug\FixedLineLength.pdb +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\FixedLineLength\obj\Debug\FixedLineLength.csprojAssemblyReference.cache +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\FixedLineLength\obj\Debug\FixedLineLength.csproj.CoreCompileInputs.cache +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\FixedLineLength\obj\Debug\FixedLineLength.dll +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\FixedLineLength\obj\Debug\FixedLineLength.pdb diff --git a/FixedLineLength/obj/Debug/FixedLineLength.csprojAssemblyReference.cache b/FixedLineLength/obj/Debug/FixedLineLength.csprojAssemblyReference.cache new file mode 100644 index 0000000..4853dcc Binary files /dev/null and b/FixedLineLength/obj/Debug/FixedLineLength.csprojAssemblyReference.cache differ diff --git a/FixedLineLength/obj/Debug/FixedLineLength.dll b/FixedLineLength/obj/Debug/FixedLineLength.dll new file mode 100644 index 0000000..7da7b05 Binary files /dev/null and b/FixedLineLength/obj/Debug/FixedLineLength.dll differ diff --git a/FixedLineLength/obj/Debug/FixedLineLength.pdb b/FixedLineLength/obj/Debug/FixedLineLength.pdb new file mode 100644 index 0000000..3ba5d51 Binary files /dev/null and b/FixedLineLength/obj/Debug/FixedLineLength.pdb differ diff --git a/Test_FixedLineLength/App.config b/Test_FixedLineLength/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/Test_FixedLineLength/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Test_FixedLineLength/Form1.Designer.cs b/Test_FixedLineLength/Form1.Designer.cs new file mode 100644 index 0000000..30925c3 --- /dev/null +++ b/Test_FixedLineLength/Form1.Designer.cs @@ -0,0 +1,143 @@ + +namespace Test_FixedLineLength +{ + 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() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); + this.button1 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.labelResult = new System.Windows.Forms.Label(); + this.groupBoxProgramInfo = new System.Windows.Forms.GroupBox(); + this.labelProgramInfo = new System.Windows.Forms.Label(); + this.groupBoxDLLInfo = new System.Windows.Forms.GroupBox(); + this.labelDLLInfo = new System.Windows.Forms.Label(); + this.groupBoxProgramInfo.SuspendLayout(); + this.groupBoxDLLInfo.SuspendLayout(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(12, 373); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(776, 23); + this.button1.TabIndex = 0; + this.button1.Text = "Text Formatieren"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(775, 77); + this.label1.TabIndex = 1; + this.label1.Text = resources.GetString("label1.Text"); + // + // labelResult + // + this.labelResult.AutoSize = true; + this.labelResult.Location = new System.Drawing.Point(13, 103); + this.labelResult.Name = "labelResult"; + this.labelResult.Size = new System.Drawing.Size(220, 13); + this.labelResult.TabIndex = 2; + this.labelResult.Text = "Formatierter Text (25 Zeichen Zeichenlänge):"; + // + // groupBoxProgramInfo + // + this.groupBoxProgramInfo.Controls.Add(this.labelProgramInfo); + this.groupBoxProgramInfo.Location = new System.Drawing.Point(12, 402); + this.groupBoxProgramInfo.Name = "groupBoxProgramInfo"; + this.groupBoxProgramInfo.Size = new System.Drawing.Size(385, 66); + this.groupBoxProgramInfo.TabIndex = 9; + this.groupBoxProgramInfo.TabStop = false; + this.groupBoxProgramInfo.Text = "Programm Information"; + // + // labelProgramInfo + // + this.labelProgramInfo.AutoSize = true; + this.labelProgramInfo.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelProgramInfo.Location = new System.Drawing.Point(7, 20); + this.labelProgramInfo.Name = "labelProgramInfo"; + this.labelProgramInfo.Size = new System.Drawing.Size(16, 13); + this.labelProgramInfo.TabIndex = 0; + this.labelProgramInfo.Text = "..."; + // + // groupBoxDLLInfo + // + this.groupBoxDLLInfo.Controls.Add(this.labelDLLInfo); + this.groupBoxDLLInfo.Location = new System.Drawing.Point(403, 402); + this.groupBoxDLLInfo.Name = "groupBoxDLLInfo"; + this.groupBoxDLLInfo.Size = new System.Drawing.Size(385, 66); + this.groupBoxDLLInfo.TabIndex = 10; + this.groupBoxDLLInfo.TabStop = false; + this.groupBoxDLLInfo.Text = "DLL Information"; + // + // labelDLLInfo + // + this.labelDLLInfo.AutoSize = true; + this.labelDLLInfo.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelDLLInfo.Location = new System.Drawing.Point(7, 20); + this.labelDLLInfo.Name = "labelDLLInfo"; + this.labelDLLInfo.Size = new System.Drawing.Size(16, 13); + this.labelDLLInfo.TabIndex = 0; + this.labelDLLInfo.Text = "..."; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 480); + this.Controls.Add(this.groupBoxProgramInfo); + this.Controls.Add(this.groupBoxDLLInfo); + this.Controls.Add(this.labelResult); + this.Controls.Add(this.label1); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Test_FixedLineLength"; + this.groupBoxProgramInfo.ResumeLayout(false); + this.groupBoxProgramInfo.PerformLayout(); + this.groupBoxDLLInfo.ResumeLayout(false); + this.groupBoxDLLInfo.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label labelResult; + private System.Windows.Forms.GroupBox groupBoxProgramInfo; + private System.Windows.Forms.Label labelProgramInfo; + private System.Windows.Forms.GroupBox groupBoxDLLInfo; + private System.Windows.Forms.Label labelDLLInfo; + } +} + diff --git a/Test_FixedLineLength/Form1.cs b/Test_FixedLineLength/Form1.cs new file mode 100644 index 0000000..edbabd9 --- /dev/null +++ b/Test_FixedLineLength/Form1.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Eugen.ESystem; + +namespace Test_FixedLineLength +{ + public partial class Form1 : Form + { + #region Version und Copyright + // Version und Copyright + string programName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen + string programVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); + static object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); + string copyright = GenerateCopyright(); + string icon = Application.StartupPath + "\\Info.bmp"; + //Assembly Datum und Zeit + static DateTime value = AssemblyDateTime(); + string date = value.ToShortDateString(); + string time = value.ToLongTimeString(); + private static DateTime AssemblyDateTime() + { + var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + var buildDateTime = new DateTime(2000, 1, 1).Add(new TimeSpan(TimeSpan.TicksPerDay * version.Build + TimeSpan.TicksPerSecond * 2 * version.Revision)); + //Tage seit dem 1. Januar 2000 und Sekunden seit Mitternacht, (multiplizier mit 2 ergibt das Original) + return buildDateTime; + } + + private static string CurrentYear() + { + DateTime dtn = DateTime.Now; + return dtn.Year.ToString(); + } + + private static string StartYear() + { + //string startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + //return startYear.Remove(0, startYear.LastIndexOf(" ") + 1); + string startYear = ""; + if (((AssemblyCopyrightAttribute)attributes[0]).Copyright.Contains("Copyright © ")) + { + startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace("Copyright © ", ""); + while (startYear.StartsWith(" ")) + { + startYear = startYear.Remove(0, 1); + } + startYear = startYear.Remove(startYear.IndexOf(" ")); + return startYear; + } + else + { + DateTime dtn = DateTime.Now; + return dtn.Year.ToString(); + } + } + + private static string GenerateCopyright() + { + string startYear = StartYear(); + string currentYear = CurrentYear(); + + if (startYear == currentYear) + { + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + } + else + { + //return String.Concat(((AssemblyCopyrightAttribute)attributes[0]).Copyright, "-", currentYear); + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace(startYear, String.Concat(startYear, "-", currentYear)); + } + } + #endregion + + #region Programm-Info + /// + /// Contains the name of the program file + /// + public static string ProgramName { set; get; } + + /// + /// Contains the version of the program file + /// + public static string ProgramVersion { set; get; } + + /// + /// Contains the copyright notice + /// + public static string Copyright { set; get; } + + private void SetProgramInfo() + { + //Name, Version und Copyright setzen + ProgramName = programName; + ProgramVersion = programVersion; + Copyright = copyright; + } + #endregion + + public Form1() + { + SetProgramInfo(); + InitializeComponent(); + + ShowInformation(); //Programm- und DLL-Information anzeigen + } + + private void ShowInformation() + { + labelProgramInfo.Text = String.Concat(ProgramName, "\n", ProgramVersion, "\n", Copyright); //Programm-Information anzeigen + + // DLL-Information anzeigen + labelDLLInfo.Text = String.Concat(FixedLineLength.DllName, "\n", FixedLineLength.DllVersion, "\n", FixedLineLength.Copyright); + } + + private void button1_Click(object sender, EventArgs e) + { + string text = "Das ist ein Text, der immer nach 25 Zeichen getrennt werden soll, aber nur dann wenn das Zeichen ein Leerzeichen ist. Ist das 25. Zeichen kein Leerzeichen, dann beim letzten Leerzeichen vor der 25. Stelle trennen. Dabei werden beim Trennen keine Typografischen Regeln beachtet.\nIst im Text ein Zeilenvorschub, dann wird dieser erkannt und auch im formatierten Text verwendet."; + int lineLength = 25; + + //-------------------------------------------------------------- + //--- Diesen Bereich ins eigene Programm einfügen --- Anfang --- + //-------------------------------------------------------------- + // Formatiert den String mit einer fixen Zeilenlänge + string textNeu = FixedLineLength.Format(text, lineLength); + //-------------------------------------------------------------- + //--- Diesen Bereich ins eigene Programm einfügen --- Ende --- + //-------------------------------------------------------------- + + labelResult.Text = String.Concat("Formatierter Text (25 Zeichen Zeichenlänge):\n\n", textNeu); + } + } +} diff --git a/Test_FixedLineLength/Form1.resx b/Test_FixedLineLength/Form1.resx new file mode 100644 index 0000000..24f5c3d --- /dev/null +++ b/Test_FixedLineLength/Form1.resx @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Ursprünglicher Text: + +Das ist ein Text, der immer nach 25 Zeichen getrennt werden soll, aber nur dann wenn das Zeichen ein Leerzeichen ist. Ist das 25. Zeichen kein Leerzeichen, dann beim letzten Leerzeichen vor der 25. Stelle trennen. Dabei werden beim Trennen keine Typografischen Regeln beachtet.\nIst im Text ein Zeilenvorschub, dann wird dieser erkannt und auch im formatierten Text verwendet. + + \ No newline at end of file diff --git a/Test_FixedLineLength/Program.cs b/Test_FixedLineLength/Program.cs new file mode 100644 index 0000000..a8e86c1 --- /dev/null +++ b/Test_FixedLineLength/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Test_FixedLineLength +{ + 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/Test_FixedLineLength/Properties/AssemblyInfo.cs b/Test_FixedLineLength/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d742bb8 --- /dev/null +++ b/Test_FixedLineLength/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 einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("Test_FixedLineLength")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Test_FixedLineLength")] +[assembly: AssemblyCopyright("Copyright © 2020 by Eugen Höglinger")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("a64ce09f-3f79-4a61-8f9a-190eaba1dc8f")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Test_FixedLineLength/Properties/Resources.Designer.cs b/Test_FixedLineLength/Properties/Resources.Designer.cs new file mode 100644 index 0000000..f28ccfd --- /dev/null +++ b/Test_FixedLineLength/Properties/Resources.Designer.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion: 4.0.30319.42000 +// +// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn +// der Code neu generiert wird. +// +//------------------------------------------------------------------------------ + + +namespace Test_FixedLineLength.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("Test_FixedLineLength.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/Test_FixedLineLength/Properties/Resources.resx b/Test_FixedLineLength/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Test_FixedLineLength/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/Test_FixedLineLength/Properties/Settings.Designer.cs b/Test_FixedLineLength/Properties/Settings.Designer.cs new file mode 100644 index 0000000..a3b8ff7 --- /dev/null +++ b/Test_FixedLineLength/Properties/Settings.Designer.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +namespace Test_FixedLineLength.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/Test_FixedLineLength/Properties/Settings.settings b/Test_FixedLineLength/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Test_FixedLineLength/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Test_FixedLineLength/Test_FixedLineLength.csproj b/Test_FixedLineLength/Test_FixedLineLength.csproj new file mode 100644 index 0000000..bf0b8c4 --- /dev/null +++ b/Test_FixedLineLength/Test_FixedLineLength.csproj @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {A64CE09F-3F79-4A61-8F9A-190EABA1DC8F} + WinExe + Test_FixedLineLength + Test_FixedLineLength + v4.7.2 + 512 + true + false + + + 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 + + + + + + + + {17b0c08e-d3d2-4ff9-a76d-2c602bf26834} + FixedLineLength + + + + \ No newline at end of file diff --git a/Test_FixedLineLength/bin/Debug/FixedLineLength.dll b/Test_FixedLineLength/bin/Debug/FixedLineLength.dll new file mode 100644 index 0000000..7da7b05 Binary files /dev/null and b/Test_FixedLineLength/bin/Debug/FixedLineLength.dll differ diff --git a/Test_FixedLineLength/bin/Debug/FixedLineLength.pdb b/Test_FixedLineLength/bin/Debug/FixedLineLength.pdb new file mode 100644 index 0000000..3ba5d51 Binary files /dev/null and b/Test_FixedLineLength/bin/Debug/FixedLineLength.pdb differ diff --git a/Test_FixedLineLength/bin/Debug/Test_FixedLineLength.exe b/Test_FixedLineLength/bin/Debug/Test_FixedLineLength.exe new file mode 100644 index 0000000..0e10fbe Binary files /dev/null and b/Test_FixedLineLength/bin/Debug/Test_FixedLineLength.exe differ diff --git a/Test_FixedLineLength/bin/Debug/Test_FixedLineLength.exe.config b/Test_FixedLineLength/bin/Debug/Test_FixedLineLength.exe.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/Test_FixedLineLength/bin/Debug/Test_FixedLineLength.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Test_FixedLineLength/bin/Debug/Test_FixedLineLength.pdb b/Test_FixedLineLength/bin/Debug/Test_FixedLineLength.pdb new file mode 100644 index 0000000..381947c Binary files /dev/null and b/Test_FixedLineLength/bin/Debug/Test_FixedLineLength.pdb differ diff --git a/Test_FixedLineLength/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs b/Test_FixedLineLength/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs new file mode 100644 index 0000000..3871b18 --- /dev/null +++ b/Test_FixedLineLength/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] diff --git a/Test_FixedLineLength/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/Test_FixedLineLength/obj/Debug/DesignTimeResolveAssemblyReferences.cache new file mode 100644 index 0000000..d277094 Binary files /dev/null and b/Test_FixedLineLength/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Test_FixedLineLength/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Test_FixedLineLength/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..8fbc0fd Binary files /dev/null and b/Test_FixedLineLength/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.Form1.resources b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.Form1.resources new file mode 100644 index 0000000..1582e6f Binary files /dev/null and b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.Form1.resources differ diff --git a/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.Properties.Resources.resources b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.Properties.Resources.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.Properties.Resources.resources differ diff --git a/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.csproj.CopyComplete b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.csproj.CopyComplete new file mode 100644 index 0000000..e69de29 diff --git a/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.csproj.CoreCompileInputs.cache b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..6848936 --- /dev/null +++ b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +d06ecca2d272e98b16ae0a6a1e4d809286556c5d diff --git a/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.csproj.FileListAbsolute.txt b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..b5530bf --- /dev/null +++ b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.csproj.FileListAbsolute.txt @@ -0,0 +1,13 @@ +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\Test_FixedLineLength\bin\Debug\Test_FixedLineLength.exe.config +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\Test_FixedLineLength\bin\Debug\Test_FixedLineLength.exe +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\Test_FixedLineLength\bin\Debug\Test_FixedLineLength.pdb +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\Test_FixedLineLength\bin\Debug\FixedLineLength.dll +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\Test_FixedLineLength\bin\Debug\FixedLineLength.pdb +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\Test_FixedLineLength\obj\Debug\Test_FixedLineLength.csprojAssemblyReference.cache +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\Test_FixedLineLength\obj\Debug\Test_FixedLineLength.Form1.resources +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\Test_FixedLineLength\obj\Debug\Test_FixedLineLength.Properties.Resources.resources +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\Test_FixedLineLength\obj\Debug\Test_FixedLineLength.csproj.GenerateResource.cache +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\Test_FixedLineLength\obj\Debug\Test_FixedLineLength.csproj.CoreCompileInputs.cache +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\Test_FixedLineLength\obj\Debug\Test_FixedLineLength.csproj.CopyComplete +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\Test_FixedLineLength\obj\Debug\Test_FixedLineLength.exe +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\FixedLineLength.git\Test_FixedLineLength\obj\Debug\Test_FixedLineLength.pdb diff --git a/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.csproj.GenerateResource.cache b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.csproj.GenerateResource.cache new file mode 100644 index 0000000..9bccb1f Binary files /dev/null and b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.csproj.GenerateResource.cache differ diff --git a/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.csprojAssemblyReference.cache b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.csprojAssemblyReference.cache new file mode 100644 index 0000000..3ff724e Binary files /dev/null and b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.csprojAssemblyReference.cache differ diff --git a/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.exe b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.exe new file mode 100644 index 0000000..0e10fbe Binary files /dev/null and b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.exe differ diff --git a/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.pdb b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.pdb new file mode 100644 index 0000000..381947c Binary files /dev/null and b/Test_FixedLineLength/obj/Debug/Test_FixedLineLength.pdb differ