Neu dazu
- Funktion die das anzeigen des Log Levels vor einer Zeile ermöglicht
This commit is contained in:
parent
240a90c863
commit
692cef160e
Binary file not shown.
@ -1,11 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace Eugen.ESystem.IO
|
namespace Eugen.ESystem.IO
|
||||||
{
|
{
|
||||||
@ -131,6 +127,15 @@ namespace Eugen.ESystem.IO
|
|||||||
NoWrite
|
NoWrite
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum LogLevel
|
||||||
|
{
|
||||||
|
Information,
|
||||||
|
Warning,
|
||||||
|
Error,
|
||||||
|
Fatal,
|
||||||
|
NoWrite
|
||||||
|
}
|
||||||
|
|
||||||
static LogWriter()
|
static LogWriter()
|
||||||
{
|
{
|
||||||
SetDllInfo();
|
SetDllInfo();
|
||||||
@ -180,29 +185,65 @@ namespace Eugen.ESystem.IO
|
|||||||
this.CurrentDate = dateTime.ToString().Remove(dateTime.ToString().IndexOf(" "));
|
this.CurrentDate = dateTime.ToString().Remove(dateTime.ToString().IndexOf(" "));
|
||||||
}
|
}
|
||||||
|
|
||||||
private string messageFormat = "{0:T}.{1} - {2}"; // Definiert das Mitteilungsformat
|
private string messageFormat = "{0}{1:T}.{2} - {3}"; // Definiert das Mitteilungsformat
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes a message to a log file
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">The message to write</param>
|
||||||
|
/// <returns>On success true is returned, on the other hand false</returns>
|
||||||
public bool WriteMessage(string message)
|
public bool WriteMessage(string message)
|
||||||
{
|
{
|
||||||
return WriteMessage(message, Time.Write);
|
return WriteMessage(message, LogLevel.NoWrite, Time.Write);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool WriteMessage(string message, Time writeTime)
|
/// <summary>
|
||||||
|
/// Writes a message to a log file
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">The message to write</param>
|
||||||
|
/// <param name="writeLogLevel">Writes the log level in front of the line</param>
|
||||||
|
/// <param name="writeTime">Writes the log time</param>
|
||||||
|
/// <returns>On success true is returned, on the other hand false</returns>
|
||||||
|
public bool WriteMessage(string message, LogLevel writeLogLevel, Time writeTime)
|
||||||
{
|
{
|
||||||
|
string logLevel = "";
|
||||||
|
|
||||||
|
switch (writeLogLevel)
|
||||||
|
{
|
||||||
|
case LogLevel.Information:
|
||||||
|
logLevel = "INFO - ";
|
||||||
|
break;
|
||||||
|
case LogLevel.Warning:
|
||||||
|
logLevel = "WARN - ";
|
||||||
|
break;
|
||||||
|
case LogLevel.Error:
|
||||||
|
logLevel = "ERROR - ";
|
||||||
|
break;
|
||||||
|
case LogLevel.Fatal:
|
||||||
|
logLevel = "FATAL - ";
|
||||||
|
break;
|
||||||
|
case LogLevel.NoWrite:
|
||||||
|
logLevel = "";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
logLevel = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
DateTime time = DateTime.Now;
|
DateTime time = DateTime.Now;
|
||||||
int ms = time.Millisecond;
|
int ms = time.Millisecond;
|
||||||
|
|
||||||
if (writeTime == Time.Write)
|
if (writeTime == Time.Write)
|
||||||
{
|
{
|
||||||
return WriteLine(time, ms, String.Format(this.messageFormat, new object[] { time, ms.ToString("000"), message }));
|
return WriteLine(logLevel, time, ms, String.Format(this.messageFormat, new object[] { logLevel, time, ms.ToString("000"), message }));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return WriteLine(time, ms, message);
|
return WriteLine(logLevel, time, ms, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool WriteLine(DateTime time, int ms, string message)
|
private bool WriteLine(string logLevel, DateTime time, int ms, string message)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -226,7 +267,7 @@ namespace Eugen.ESystem.IO
|
|||||||
// Logdatei schließen
|
// Logdatei schließen
|
||||||
writer.Close();
|
writer.Close();
|
||||||
|
|
||||||
OnMessageWritten(new LogWriterEventArgs(time, ms, message));
|
OnMessageWritten(new LogWriterEventArgs(logLevel, time, ms, message));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -245,6 +286,40 @@ namespace Eugen.ESystem.IO
|
|||||||
return ShowLogFile(this.Path, this.FileName);
|
return ShowLogFile(this.Path, this.FileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Displays a logfile
|
||||||
|
///// </summary>
|
||||||
|
///// <param name="path">A valid path</param>
|
||||||
|
///// <param name="fileName">A valid filename</param>
|
||||||
|
///// <returns>Wheather the displaying progress was successful</returns>
|
||||||
|
//public bool ShowLogFile(string path, string fileName)
|
||||||
|
//{
|
||||||
|
// if (String.IsNullOrEmpty(path) || String.IsNullOrEmpty(fileName))
|
||||||
|
// {
|
||||||
|
// return false; // Pfad oder Name wurde nicht gefunden
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// if (!fileName.EndsWith(".log"))
|
||||||
|
// {
|
||||||
|
// fileName = String.Concat(fileName, ".log");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (File.Exists(String.Concat(path, "\\", fileName)))
|
||||||
|
// {
|
||||||
|
// if (!ShowTextFile.Show(String.Concat(path, "\\", fileName)))
|
||||||
|
// {
|
||||||
|
// return false; // Editor nicht gefunden
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// return false; //Datei nicht gefunden
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return true;
|
||||||
|
//}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Displays a logfile
|
/// Displays a logfile
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -259,24 +334,43 @@ namespace Eugen.ESystem.IO
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!fileName.EndsWith(".log"))
|
|
||||||
{
|
|
||||||
fileName = String.Concat(fileName, ".log");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (File.Exists(String.Concat(path, "\\", fileName)))
|
if (File.Exists(String.Concat(path, "\\", fileName)))
|
||||||
{
|
{
|
||||||
if (!ShowTextFile.Show(String.Concat(path, "\\", fileName)))
|
try
|
||||||
{
|
{
|
||||||
return false; // Editor nicht gefunden
|
//Aufruf mit dem Standardprogramm
|
||||||
|
var process = new Process();
|
||||||
|
process.StartInfo = new ProcessStartInfo()
|
||||||
|
{
|
||||||
|
UseShellExecute = true,
|
||||||
|
FileName = String.Concat(path, "\\", fileName)
|
||||||
|
};
|
||||||
|
|
||||||
|
process.Start();
|
||||||
|
process.WaitForExit();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const string program = "Notepad.exe"; //Aufruf mit Notepad
|
||||||
|
|
||||||
|
ProcessStartInfo start = new ProcessStartInfo(program, String.Concat(path, "\\", fileName));
|
||||||
|
Process.Start(start);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false; //Datei nicht gefunden
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -403,14 +497,20 @@ namespace Eugen.ESystem.IO
|
|||||||
/// <param name="time">Specifyes the message post time</param>
|
/// <param name="time">Specifyes the message post time</param>
|
||||||
/// <param name="millisecond">Specifyes the message post milliseconds</param>
|
/// <param name="millisecond">Specifyes the message post milliseconds</param>
|
||||||
/// <param name="message">Specifyes the message</param>
|
/// <param name="message">Specifyes the message</param>
|
||||||
public LogWriterEventArgs(DateTime time, int millisecond, string message) : base()
|
public LogWriterEventArgs(string logLevel, DateTime time, int millisecond, string message) : base()
|
||||||
{
|
{
|
||||||
|
this.logLevel = logLevel;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
this.millisecond = millisecond;
|
this.millisecond = millisecond;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region fields
|
#region fields
|
||||||
|
/// <summary>
|
||||||
|
/// Stores the logging level
|
||||||
|
/// </summary>
|
||||||
|
private string logLevel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stores the message post time
|
/// Stores the message post time
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -37,13 +37,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="LogWriter.cs" />
|
<Compile Include="LogWriter.cs" />
|
||||||
|
|||||||
@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
|
|||||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||||
// die einer Assembly zugeordnet sind.
|
// die einer Assembly zugeordnet sind.
|
||||||
[assembly: AssemblyTitle("LogWriter")]
|
[assembly: AssemblyTitle("LogWriter")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("Writes a log file")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("LogWriter")]
|
[assembly: AssemblyProduct("LogWriter")]
|
||||||
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||||
// indem Sie "*" wie unten gezeigt eingeben:
|
// indem Sie "*" wie unten gezeigt eingeben:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.*")]
|
[assembly: AssemblyVersion("1.1.*")]
|
||||||
//[assembly: AssemblyFileVersion("1.0.0.0")] //Wenn auskommentiert, dann gleich wie AssemblyVersion!
|
//[assembly: AssemblyFileVersion("1.0.0.0")] //Wenn auskommentiert, dann gleich wie AssemblyVersion!
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
|||||||
2c170a6de4ecef6e0914644ba93f8bbf52dc503d
|
e1faeb35ce76a8d38c55282029a3d9258634bb5d
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\obj\Debug\LogWriter.csproj.AssemblyReference.cache
|
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\obj\Debug\LogWriter.csproj.CoreCompileInputs.cache
|
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\bin\Debug\helogwri.dll
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\bin\Debug\helogwri.dll
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\bin\Debug\helogwri.pdb
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\bin\Debug\helogwri.pdb
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\obj\Debug\helogwri.dll
|
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\obj\Debug\helogwri.pdb
|
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\bin\Debug\heshowtf.dll
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\bin\Debug\heshowtf.dll
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\bin\Debug\heshowtf.pdb
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\bin\Debug\heshowtf.pdb
|
||||||
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\obj\Debug\LogWriter.csproj.AssemblyReference.cache
|
||||||
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\obj\Debug\LogWriter.csproj.CoreCompileInputs.cache
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\obj\Debug\LogWriter.csproj.CopyComplete
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\obj\Debug\LogWriter.csproj.CopyComplete
|
||||||
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\obj\Debug\helogwri.dll
|
||||||
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\LogWriter\obj\Debug\helogwri.pdb
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
87
Netz/CreateExeWithEmbededDlls.bat
Normal file
87
Netz/CreateExeWithEmbededDlls.bat
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
:SELECTIONMENU
|
||||||
|
cls
|
||||||
|
echo.
|
||||||
|
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
|
||||||
|
echo º º
|
||||||
|
echo º Programmkomprimierung in eine einzelene EXE mit .NETZ º
|
||||||
|
echo º º
|
||||||
|
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
|
||||||
|
echo º Version 1.0 º
|
||||||
|
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
|
||||||
|
echo º Dieses Script erzeugt aus der Programm '.exe' und allen da- º
|
||||||
|
echo º zugehoerenden '.dll's, eine gemeinsame, komprimierte Pro- º
|
||||||
|
echo º gramm '.exe' mit eingebetteten '.dll's in einem Unterver- º
|
||||||
|
echo º zeichnis im Verzeichnis der Programm .exe. Die dazugehoer- º
|
||||||
|
echo º igen Hilfe-Dateien werden ebenfals in dieses Unterverzeich- º
|
||||||
|
echo º nis kopiert. Das Unterverzeichnis kann dann unmittelbar an º
|
||||||
|
echo º seinen Bestimmungsort kopiert werden und ist dadurch an º
|
||||||
|
echo º diesem Ort sofort einsetzbar und funktionsfaehig. º
|
||||||
|
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
|
||||||
|
echo º º
|
||||||
|
echo º [S] Prozess starten º
|
||||||
|
echo º [C] Script abbrechen º
|
||||||
|
echo º º
|
||||||
|
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
|
||||||
|
echo.
|
||||||
|
|
||||||
|
set asw=0
|
||||||
|
set /p asw=">>> Bitte eine Auswahl treffen: "
|
||||||
|
|
||||||
|
if %asw%==s goto START
|
||||||
|
if %asw%==S goto START
|
||||||
|
if %asw%==c goto CANCEL
|
||||||
|
if %asw%==C goto CANCEL
|
||||||
|
goto SELECTIONMENU
|
||||||
|
|
||||||
|
:START
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo --- Starte den Koprimierungsprozess
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
|
||||||
|
rem --- Argumente --- Anfang ---
|
||||||
|
rem --- Die Argumente mit den entsprechenden Werten belegen ---
|
||||||
|
rem --- NETZ ... Der Programmname und der kompletter Pfad der netz.exe
|
||||||
|
rem --- FOLDER ... Der Pfad zur Programm .exe
|
||||||
|
rem --- NAME ... Ist gleich dem Programnamen ohne '.exe'
|
||||||
|
rem --- EXE ... Der Programmname und der komplette Pfad der '.exe' die komprimiert werden soll
|
||||||
|
rem --- DLL ... Die durch Leerzeichen getrennt Liste der im Programm verwendeten '.dll'
|
||||||
|
rem --- HELP ... Die durch Leerzeichen getrennt Liste der verwendeten Hilfedateien. Gibt es keine Hilfe-Dateien, dann bleibt der Platz nach dem 'Ist Gleich'-Zeichen leer
|
||||||
|
|
||||||
|
set NETZ=H:\Programmieren\Netz\netz.exe
|
||||||
|
|
||||||
|
set FOLDER=H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug
|
||||||
|
set NAME=LogWriter
|
||||||
|
|
||||||
|
set EXE=%FOLDER%\Test_LogWriter.exe
|
||||||
|
rem set DLL=%FOLDER%\myDLL1.dll %FOLDER%\MyDLL2.dll
|
||||||
|
rem set HELP=%FOLDER%\Hilfe.chm %FOLDER%\Help.chm
|
||||||
|
rem --- Argumente --- Ende ---
|
||||||
|
|
||||||
|
rem --- Prozess ausfuehren ---
|
||||||
|
%NETZ% -s -z %EXE% %DLL%
|
||||||
|
|
||||||
|
rem --- Hilfe-Dateien kopieren ---
|
||||||
|
if not defined HELP goto NEXT
|
||||||
|
set DESTINATION=%FOLDER%\%NAME%.exe.netz
|
||||||
|
for %%A in (%HELP%) do xcopy %%A %DESTINATION% /D /Y
|
||||||
|
|
||||||
|
:NEXT
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo --- Der Komprimierungsprozess wurde ausgefuehrt.
|
||||||
|
echo.
|
||||||
|
goto END
|
||||||
|
|
||||||
|
:CANCEL
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo Das Script wird auf Ihren Wunsch hin abgebrochen!
|
||||||
|
echo.
|
||||||
|
goto END
|
||||||
|
|
||||||
|
:END
|
||||||
|
pause
|
||||||
19
Test_LogWriter/Form1.Designer.cs
generated
19
Test_LogWriter/Form1.Designer.cs
generated
@ -37,6 +37,7 @@
|
|||||||
this.buttonShowLog2 = new System.Windows.Forms.Button();
|
this.buttonShowLog2 = new System.Windows.Forms.Button();
|
||||||
this.buttonShowLog1 = new System.Windows.Forms.Button();
|
this.buttonShowLog1 = new System.Windows.Forms.Button();
|
||||||
this.labelResult = new System.Windows.Forms.Label();
|
this.labelResult = new System.Windows.Forms.Label();
|
||||||
|
this.buttonShowLog4 = new System.Windows.Forms.Button();
|
||||||
this.groupBoxProgramInfo.SuspendLayout();
|
this.groupBoxProgramInfo.SuspendLayout();
|
||||||
this.groupBoxDLLInfo.SuspendLayout();
|
this.groupBoxDLLInfo.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -93,7 +94,7 @@
|
|||||||
//
|
//
|
||||||
// buttonShowLog3
|
// buttonShowLog3
|
||||||
//
|
//
|
||||||
this.buttonShowLog3.Location = new System.Drawing.Point(627, 254);
|
this.buttonShowLog3.Location = new System.Drawing.Point(421, 254);
|
||||||
this.buttonShowLog3.Name = "buttonShowLog3";
|
this.buttonShowLog3.Name = "buttonShowLog3";
|
||||||
this.buttonShowLog3.Size = new System.Drawing.Size(160, 23);
|
this.buttonShowLog3.Size = new System.Drawing.Size(160, 23);
|
||||||
this.buttonShowLog3.TabIndex = 20;
|
this.buttonShowLog3.TabIndex = 20;
|
||||||
@ -103,7 +104,7 @@
|
|||||||
//
|
//
|
||||||
// buttonShowLog2
|
// buttonShowLog2
|
||||||
//
|
//
|
||||||
this.buttonShowLog2.Location = new System.Drawing.Point(319, 254);
|
this.buttonShowLog2.Location = new System.Drawing.Point(216, 254);
|
||||||
this.buttonShowLog2.Name = "buttonShowLog2";
|
this.buttonShowLog2.Name = "buttonShowLog2";
|
||||||
this.buttonShowLog2.Size = new System.Drawing.Size(160, 23);
|
this.buttonShowLog2.Size = new System.Drawing.Size(160, 23);
|
||||||
this.buttonShowLog2.TabIndex = 19;
|
this.buttonShowLog2.TabIndex = 19;
|
||||||
@ -113,7 +114,7 @@
|
|||||||
//
|
//
|
||||||
// buttonShowLog1
|
// buttonShowLog1
|
||||||
//
|
//
|
||||||
this.buttonShowLog1.Location = new System.Drawing.Point(11, 254);
|
this.buttonShowLog1.Location = new System.Drawing.Point(12, 254);
|
||||||
this.buttonShowLog1.Name = "buttonShowLog1";
|
this.buttonShowLog1.Name = "buttonShowLog1";
|
||||||
this.buttonShowLog1.Size = new System.Drawing.Size(160, 23);
|
this.buttonShowLog1.Size = new System.Drawing.Size(160, 23);
|
||||||
this.buttonShowLog1.TabIndex = 18;
|
this.buttonShowLog1.TabIndex = 18;
|
||||||
@ -130,11 +131,22 @@
|
|||||||
this.labelResult.TabIndex = 17;
|
this.labelResult.TabIndex = 17;
|
||||||
this.labelResult.Text = "...";
|
this.labelResult.Text = "...";
|
||||||
//
|
//
|
||||||
|
// buttonShowLog4
|
||||||
|
//
|
||||||
|
this.buttonShowLog4.Location = new System.Drawing.Point(626, 254);
|
||||||
|
this.buttonShowLog4.Name = "buttonShowLog4";
|
||||||
|
this.buttonShowLog4.Size = new System.Drawing.Size(160, 23);
|
||||||
|
this.buttonShowLog4.TabIndex = 21;
|
||||||
|
this.buttonShowLog4.Text = "Log-Datei 4 anzeigen";
|
||||||
|
this.buttonShowLog4.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonShowLog4.Click += new System.EventHandler(this.buttonShowLog4_Click);
|
||||||
|
//
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.buttonShowLog4);
|
||||||
this.Controls.Add(this.buttonShowLog3);
|
this.Controls.Add(this.buttonShowLog3);
|
||||||
this.Controls.Add(this.buttonShowLog2);
|
this.Controls.Add(this.buttonShowLog2);
|
||||||
this.Controls.Add(this.buttonShowLog1);
|
this.Controls.Add(this.buttonShowLog1);
|
||||||
@ -165,6 +177,7 @@
|
|||||||
private System.Windows.Forms.Button buttonShowLog2;
|
private System.Windows.Forms.Button buttonShowLog2;
|
||||||
private System.Windows.Forms.Button buttonShowLog1;
|
private System.Windows.Forms.Button buttonShowLog1;
|
||||||
private System.Windows.Forms.Label labelResult;
|
private System.Windows.Forms.Label labelResult;
|
||||||
|
private System.Windows.Forms.Button buttonShowLog4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Eugen.ESystem.IO;
|
using Eugen.ESystem.IO;
|
||||||
|
|
||||||
@ -128,35 +121,47 @@ namespace Test_LogWriter
|
|||||||
labelDLLInfo.Text = String.Concat(LogWriter.DllName, "\r\n", LogWriter.DllVersion, "\r\n", LogWriter.Copyright); // Zeigt die DLL-Information an
|
labelDLLInfo.Text = String.Concat(LogWriter.DllName, "\r\n", LogWriter.DllVersion, "\r\n", LogWriter.Copyright); // Zeigt die DLL-Information an
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogWriter logWriter1 = new LogWriter(@"C:\TMP\");
|
||||||
|
LogWriter logWriter2 = new LogWriter(@"C:\TMP\", "my_logfile2.log");
|
||||||
|
LogWriter logWriter3 = new LogWriter(@"C:\TMP\", "my_logfile3");
|
||||||
|
LogWriter logWriter4 = new LogWriter(@"C:\TMP\", "my_logfile4");
|
||||||
|
|
||||||
private void buttonRunProgram_Click(object sender, EventArgs e)
|
private void buttonRunProgram_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//Variante 1 - Logdateiname ist automatisch 'log_dd-mm-yy.log'
|
//Variante 1 - Logdateiname ist automatisch 'log_dd-mm-yy.log'
|
||||||
var logWriter1 = new LogWriter(@"C:\TMP\");
|
|
||||||
logWriter1.Delete();
|
logWriter1.Delete();
|
||||||
logWriter1.WriteMessage("Das ist Test 1");
|
logWriter1.WriteMessage("Das ist Test 1");
|
||||||
labelResult.Text = String.Concat("Die Log-Datei C:\\TMP\\log_", DateTime.Now.Date.ToString().Remove(10), ".log wurde geschrieben.");
|
labelResult.Text = String.Concat("Die Log-Datei C:\\TMP\\log_", DateTime.Now.Date.ToString().Remove(10), ".log wurde geschrieben.");
|
||||||
|
|
||||||
//Variante 2 - Logdateiname wird angegeben, z.B. 'my_logfile2.log'
|
//Variante 2 - Logdateiname wird angegeben, z.B. 'my_logfile2.log'
|
||||||
var logWriter2 = new LogWriter(@"C:\TMP\", "my_logfile2.log");
|
|
||||||
logWriter2.Delete();
|
logWriter2.Delete();
|
||||||
logWriter2.WriteMessage("Das ist Test 2");
|
logWriter2.WriteMessage("Das ist Test 2");
|
||||||
labelResult.Text = String.Concat(labelResult.Text, "\nDie Log-Datei C:\\TMP\\my_logfile2.log wurde geschrieben");
|
labelResult.Text = String.Concat(labelResult.Text, "\nDie Log-Datei C:\\TMP\\my_logfile2.log wurde geschrieben");
|
||||||
|
|
||||||
//Variante 3 - Logdateiname wird angegeben und Header wird geschrieben
|
//Variante 3 - Logdateiname wird angegeben und Header wird geschrieben
|
||||||
string header = "--------------------\n Das ist der Header\n--------------------";
|
string header = "--------------------\n Das ist der Header\n--------------------";
|
||||||
var logWriter3 = new LogWriter(@"C:\TMP\", "my_logfile3");
|
|
||||||
logWriter3.Delete();
|
logWriter3.Delete();
|
||||||
logWriter3.WriteMessage(header, LogWriter.Time.NoWrite);
|
logWriter3.WriteMessage(header, LogWriter.LogLevel.NoWrite, LogWriter.Time.NoWrite);
|
||||||
logWriter3.WriteMessage("Das ist Test 3");
|
logWriter3.WriteMessage("Das ist Test 3");
|
||||||
labelResult.Text = String.Concat(labelResult.Text, "\nDie Log-Datei C:\\TMP\\my_logfile3.log wurde geschrieben");
|
labelResult.Text = String.Concat(labelResult.Text, "\nDie Log-Datei C:\\TMP\\my_logfile3.log wurde geschrieben");
|
||||||
|
|
||||||
|
//Variante 4 - Logdateiname wird angegeben und Header wird geschrieben
|
||||||
|
//Der Header ist schon in Variante 3 definiert
|
||||||
|
logWriter4.Delete();
|
||||||
|
logWriter4.WriteMessage(header, LogWriter.LogLevel.NoWrite, LogWriter.Time.NoWrite);
|
||||||
|
logWriter4.WriteMessage("Das ist Test 4", LogWriter.LogLevel.Information, LogWriter.Time.Write);
|
||||||
|
logWriter4.WriteMessage("Eine Zeile ohne Log Level", LogWriter.LogLevel.NoWrite, LogWriter.Time.Write);
|
||||||
|
logWriter4.WriteMessage("Und noch eine Zeile mit Log Level", LogWriter.LogLevel.Warning, LogWriter.Time.Write);
|
||||||
|
labelResult.Text = String.Concat(labelResult.Text, "\nDie Log-Datei C:\\TMP\\my_logfile4.log wurde geschrieben");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonShowLog1_Click_1(object sender, EventArgs e)
|
private void buttonShowLog1_Click_1(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string textFileName = String.Concat("C:\\TMP\\log_", DateTime.Now.Date.ToString().Remove(10), ".log");
|
//string textFileName = String.Concat("C:\\TMP\\log_", DateTime.Now.Date.ToString().Remove(10), ".log");
|
||||||
|
|
||||||
//Wenn die Datei nicht angezeigt werden kann, dann eine Fehlermeldung ausgeben
|
//Wenn die Datei nicht angezeigt werden kann, dann eine Fehlermeldung ausgeben
|
||||||
if (!ShowTextFile.Show(textFileName))
|
//if (!ShowTextFile.Show(textFileName))
|
||||||
|
if (!logWriter1.ShowLogFile("C:\\TMP", String.Concat("log_", DateTime.Now.Date.ToString().Remove(10), ".log")))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Entweder die Datei existiert nicht oder der Editor konnte nicht geöffnet werden!");
|
MessageBox.Show("Entweder die Datei existiert nicht oder der Editor konnte nicht geöffnet werden!");
|
||||||
}
|
}
|
||||||
@ -164,10 +169,11 @@ namespace Test_LogWriter
|
|||||||
|
|
||||||
private void buttonShowLog2_Click(object sender, EventArgs e)
|
private void buttonShowLog2_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string textFileName = "C:\\TMP\\my_logfile2.log";
|
//string textFileName = "C:\\TMP\\my_logfile2.log";
|
||||||
|
|
||||||
//Wenn die Datei nicht angezeigt werden kann, dann eine Fehlermeldung ausgeben
|
//Wenn die Datei nicht angezeigt werden kann, dann eine Fehlermeldung ausgeben
|
||||||
if (!ShowTextFile.Show(textFileName))
|
//if (!ShowTextFile.Show(textFileName))
|
||||||
|
if (!logWriter1.ShowLogFile("C:\\TMP", "my_logfile2.log"))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Entweder die Datei existiert nicht oder der Editor konnte nicht geöffnet werden!");
|
MessageBox.Show("Entweder die Datei existiert nicht oder der Editor konnte nicht geöffnet werden!");
|
||||||
}
|
}
|
||||||
@ -175,10 +181,19 @@ namespace Test_LogWriter
|
|||||||
|
|
||||||
private void buttonShowLog3_Click(object sender, EventArgs e)
|
private void buttonShowLog3_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string textFileName = "C:\\TMP\\my_logfile3.log";
|
//string textFileName = "C:\\TMP\\my_logfile3.log";
|
||||||
|
|
||||||
//Wenn die Datei nicht angezeigt werden kann, dann eine Fehlermeldung ausgeben
|
//Wenn die Datei nicht angezeigt werden kann, dann eine Fehlermeldung ausgeben
|
||||||
if (!ShowTextFile.Show(textFileName))
|
//if (!ShowTextFile.Show(textFileName))
|
||||||
|
if (!logWriter1.ShowLogFile("C:\\TMP", "my_logfile3.log"))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Entweder die Datei existiert nicht oder der Editor konnte nicht geöffnet werden!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonShowLog4_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!logWriter1.ShowLogFile("C:\\TMP", "my_logfile4.log"))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Entweder die Datei existiert nicht oder der Editor konnte nicht geöffnet werden!");
|
MessageBox.Show("Entweder die Datei existiert nicht oder der Editor konnte nicht geöffnet werden!");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,9 +37,6 @@
|
|||||||
<Reference Include="helogwri">
|
<Reference Include="helogwri">
|
||||||
<HintPath>..\LogWriter\bin\Debug\helogwri.dll</HintPath>
|
<HintPath>..\LogWriter\bin\Debug\helogwri.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="heshowtf">
|
|
||||||
<HintPath>..\LogWriter\bin\Debug\heshowtf.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
|||||||
0b37f65528887a8f138f27074e88fb5740eb62c1
|
094cd05bab9c4c022c89eb29561a520b03346241
|
||||||
|
|||||||
@ -8,9 +8,7 @@ H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWrit
|
|||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\Test_LogWriter.exe
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\Test_LogWriter.exe
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\Test_LogWriter.pdb
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\Test_LogWriter.pdb
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\helogwri.dll
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\helogwri.dll
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\heshowtf.dll
|
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\helogwri.pdb
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\helogwri.pdb
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\heshowtf.pdb
|
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\obj\Debug\Test_LogWriter.csproj.CopyComplete
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\obj\Debug\Test_LogWriter.csproj.CopyComplete
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\obj\Debug\Test_LogWriter.exe
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\obj\Debug\Test_LogWriter.exe
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\obj\Debug\Test_LogWriter.pdb
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\obj\Debug\Test_LogWriter.pdb
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user