Projekt neu angelegt.

This commit is contained in:
Eugen Höglinger 2020-02-27 14:30:09 +01:00
commit f63f167b16
10 changed files with 539 additions and 0 deletions

32
.gitignore vendored Normal file
View File

@ -0,0 +1,32 @@
#Ignore thumbnails created by Windows
Thumbs.db
#Ignore files built by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
.vs/
#Nuget packages folder
packages/

18
FixLineLenght.sln Normal file
View File

@ -0,0 +1,18 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 5.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FixLineLenght", "FixLineLenght\FixLineLenght.csproj", "{61170FC7-4865-4BC7-9672-90D386333679}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{61170FC7-4865-4BC7-9672-90D386333679}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{61170FC7-4865-4BC7-9672-90D386333679}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61170FC7-4865-4BC7-9672-90D386333679}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61170FC7-4865-4BC7-9672-90D386333679}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,82 @@
/*
* Erstellt mit SharpDevelop.
* Benutzer: 001142709
* Datum: 15.05.2019
* Zeit: 08:56
*
* Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
*/
using System;
namespace FixLineLenght
{
/// <summary>
/// Description of FixLineLenght.
/// </summary>
public static class FixLineLenght
{
/// <summary>
/// Formats a string with a fixed line length.
/// </summary>
static FixLineLenght()
{
}
/// <summary>
/// Formats a string with a fixed line length.
/// </summary>
/// <param name="text">String to be formatted.</param>
/// <param name="lineLenght">Maximum line length</param>
/// <returns></returns>
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;
}
}
}

View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<ProjectGuid>{61170FC7-4865-4BC7-9672-90D386333679}</ProjectGuid>
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>WinExe</OutputType>
<RootNamespace>FixLineLenght</RootNamespace>
<AssemblyName>FixLineLenght</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="FixLineLenght.cs" />
<Compile Include="Test_FixLineLenght.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Test_FixLineLenght.Designer.cs">
<DependentUpon>Test_FixLineLenght.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Test_FixLineLenght.resx">
<DependentUpon>Test_FixLineLenght.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

31
FixLineLenght/Program.cs Normal file
View File

@ -0,0 +1,31 @@
/*
* Erstellt mit SharpDevelop.
* Benutzer: 001142709
* Datum: 15.05.2019
* Zeit: 08:53
*
* Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
*/
using System;
using System.Windows.Forms;
namespace FixLineLenght
{
/// <summary>
/// Class with program entry point.
/// </summary>
internal sealed class Program
{
/// <summary>
/// Program entry point.
/// </summary>
[STAThread]
private static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}

View File

@ -0,0 +1,31 @@
#region Using directives
using System;
using System.Reflection;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FixLineLenght")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FixLineLenght")]
[assembly: AssemblyCopyright("Copyright 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]

View File

@ -0,0 +1,77 @@
/*
* Erstellt mit SharpDevelop.
* Benutzer: 001142709
* Datum: 15.05.2019
* Zeit: 08:53
*
* Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
*/
namespace FixLineLenght
{
partial class MainForm
{
/// <summary>
/// Designer variable used to keep track of non-visual components.
/// </summary>
private System.ComponentModel.IContainer components = null;
private System.Windows.Forms.Label labelResult;
private System.Windows.Forms.Button buttonFormat;
/// <summary>
/// Disposes resources used by the form.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.labelResult = new System.Windows.Forms.Label();
this.buttonFormat = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// labelResult
//
this.labelResult.Location = new System.Drawing.Point(13, 13);
this.labelResult.Name = "labelResult";
this.labelResult.Size = new System.Drawing.Size(967, 318);
this.labelResult.TabIndex = 0;
this.labelResult.Text = resources.GetString("labelResult.Text");
//
// buttonFormat
//
this.buttonFormat.Location = new System.Drawing.Point(12, 334);
this.buttonFormat.Name = "buttonFormat";
this.buttonFormat.Size = new System.Drawing.Size(968, 23);
this.buttonFormat.TabIndex = 1;
this.buttonFormat.Text = "Format String";
this.buttonFormat.UseVisualStyleBackColor = true;
this.buttonFormat.Click += new System.EventHandler(this.ButtonFormatClick);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(992, 369);
this.Controls.Add(this.buttonFormat);
this.Controls.Add(this.labelResult);
this.Name = "MainForm";
this.Text = "FixLineLenght";
this.ResumeLayout(false);
}
}
}

View File

@ -0,0 +1,66 @@
/*
* Erstellt mit SharpDevelop.
* Benutzer: 001142709
* Datum: 15.05.2019
* Zeit: 08:53
*
* Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
namespace FixLineLenght
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
#region Version und Copyright
// Version und Copyright
string programName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen
string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
static object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
string copyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
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;
}
#endregion
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
}
void ButtonFormatClick(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 lineLenght = 25;
//
// Diese Zeilen gehört in das Programm kopiert
//
// Formatiert den String mit einer fixen Zeilenlänge
string textNeu = FixLineLenght.Format(text, lineLenght);
//
//
labelResult.Text = String.Concat(textNeu);
}
}
}

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: 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">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<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">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<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" 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">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="labelResult.Text" xml:space="preserve">
<value>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.
Ist im Text ein Zeilenvorschub, dann wird dieser erkannt und auch im formatierten Text verwendet.</value>
</data>
</root>

6
FixLineLenght/app.config Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
</configuration>