diff --git a/SweetLib.Demo.Console/App.config b/SweetLib.Demo.Console/App.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/SweetLib.Demo.Console/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SweetLib.Demo.Console/Program.cs b/SweetLib.Demo.Console/Program.cs new file mode 100644 index 0000000..6da4911 --- /dev/null +++ b/SweetLib.Demo.Console/Program.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SweetLib.Utils.Logger; + +namespace SweetLib.Demo.Console +{ + class Program + { + static void Main(string[] args) + { + //Logger.GlobalLogLevel |= LogLevel.Debug | LogLevel.Trace; + Logger.GlobalLogLevel=LogLevel.All; + + Logger.Trace("Trace!"); + Logger.Debug("Debug"); + Logger.Info("Hallo Welt"); + Logger.Warn("WARN!"); + Logger.Error("Error :("); + + System.Console.ReadLine(); + } + } +} diff --git a/SweetLib.Demo.Console/Properties/AssemblyInfo.cs b/SweetLib.Demo.Console/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2dae91b --- /dev/null +++ b/SweetLib.Demo.Console/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("SweetLib.Demo.Console")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SweetLib.Demo.Console")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[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 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("c8681e08-6f23-45e1-a16f-bba72003219b")] + +// 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.19.0")] +[assembly: AssemblyFileVersion("1.0.19.0")] diff --git a/SweetLib.Demo.Console/SweetLib.Demo.Console.csproj b/SweetLib.Demo.Console/SweetLib.Demo.Console.csproj new file mode 100644 index 0000000..9bc892b --- /dev/null +++ b/SweetLib.Demo.Console/SweetLib.Demo.Console.csproj @@ -0,0 +1,66 @@ + + + + + Debug + AnyCPU + {C8681E08-6F23-45E1-A16F-BBA72003219B} + Exe + Properties + SweetLib.Demo.Console + SweetLib.Demo.Console + v4.6.1 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + {02c1f8ef-32f2-4e77-a36d-79129402af37} + SweetLib + + + + + \ No newline at end of file diff --git a/SweetLib.Demo/Properties/AssemblyInfo.cs b/SweetLib.Demo/Properties/AssemblyInfo.cs index 20c2bdf..5dcfe0a 100644 --- a/SweetLib.Demo/Properties/AssemblyInfo.cs +++ b/SweetLib.Demo/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 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.12.0")] -[assembly: AssemblyFileVersion("1.0.12.0")] +[assembly: AssemblyVersion("1.0.13.0")] +[assembly: AssemblyFileVersion("1.0.13.0")] diff --git a/SweetLib.sln b/SweetLib.sln index afbcc0d..b1da169 100644 --- a/SweetLib.sln +++ b/SweetLib.sln @@ -1,12 +1,14 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SweetLib", "SweetLib\SweetLib.csproj", "{02C1F8EF-32F2-4E77-A36D-79129402AF37}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SweetLib.Demo", "SweetLib.Demo\SweetLib.Demo.csproj", "{9350E0D4-9FE7-49D5-ACDE-E857E547889C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SweetLib.Demo.Console", "SweetLib.Demo.Console\SweetLib.Demo.Console.csproj", "{C8681E08-6F23-45E1-A16F-BBA72003219B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {9350E0D4-9FE7-49D5-ACDE-E857E547889C}.Debug|Any CPU.Build.0 = Debug|Any CPU {9350E0D4-9FE7-49D5-ACDE-E857E547889C}.Release|Any CPU.ActiveCfg = Release|Any CPU {9350E0D4-9FE7-49D5-ACDE-E857E547889C}.Release|Any CPU.Build.0 = Release|Any CPU + {C8681E08-6F23-45E1-A16F-BBA72003219B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C8681E08-6F23-45E1-A16F-BBA72003219B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C8681E08-6F23-45E1-A16F-BBA72003219B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C8681E08-6F23-45E1-A16F-BBA72003219B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SweetLib/Properties/AssemblyInfo.cs b/SweetLib/Properties/AssemblyInfo.cs index dfdc628..430144b 100644 --- a/SweetLib/Properties/AssemblyInfo.cs +++ b/SweetLib/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden @@ -32,5 +31,5 @@ using System.Runtime.InteropServices; // 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.3.0")] -[assembly: AssemblyFileVersion("1.0.3.0")] +[assembly: AssemblyVersion("1.0.21.0")] +[assembly: AssemblyFileVersion("1.0.21.0")] diff --git a/SweetLib/Utils/Logger/Logger.cs b/SweetLib/Utils/Logger/Logger.cs index 6705ced..a6ea578 100644 --- a/SweetLib/Utils/Logger/Logger.cs +++ b/SweetLib/Utils/Logger/Logger.cs @@ -12,7 +12,9 @@ namespace SweetLib.Utils.Logger Debug = 1 << 1, Info = 1 << 2, Warn = 1 << 3, - Error = 1 << 4 + Error = 1 << 4, + + All = Int32.MaxValue, }; public static class Logger diff --git a/SweetLib/Utils/Logger/Memory/ArchivableConsoleLogMemory.cs b/SweetLib/Utils/Logger/Memory/ArchivableConsoleLogMemory.cs index 3453bee..108a898 100644 --- a/SweetLib/Utils/Logger/Memory/ArchivableConsoleLogMemory.cs +++ b/SweetLib/Utils/Logger/Memory/ArchivableConsoleLogMemory.cs @@ -4,7 +4,6 @@ using System.IO; using System.IO.Compression; using System.Linq; using System.Threading; -using System.Threading.Tasks; using SweetLib.Utils.Logger.Message; namespace SweetLib.Utils.Logger.Memory @@ -107,6 +106,9 @@ namespace SweetLib.Utils.Logger.Memory using (var tmpFileStream = new FileInfo(TempFile).OpenRead()) { + if (!Directory.Exists(Path.GetDirectoryName(fullFileName))) + Directory.CreateDirectory(Path.GetDirectoryName(fullFileName)); + using (var compressedFileStream = File.Create(fullFileName)) { using (var compressionsStream = new GZipStream(compressedFileStream, CompressionMode.Compress)) @@ -130,7 +132,19 @@ namespace SweetLib.Utils.Logger.Memory ProcessQueue(); if (AutoArchiveOnDispose) - Archive(); + { + try + { + Archive(); + } + catch (FileNotFoundException) + { + if (disposing) + throw; + } + } + + File.Delete(TempFile); } } } diff --git a/SweetLib/Utils/Logger/Message/LogMessageFormatter.cs b/SweetLib/Utils/Logger/Message/LogMessageFormatter.cs index 44be3b6..2c0187c 100644 --- a/SweetLib/Utils/Logger/Message/LogMessageFormatter.cs +++ b/SweetLib/Utils/Logger/Message/LogMessageFormatter.cs @@ -12,7 +12,7 @@ namespace SweetLib.Utils.Logger.Message public static LogMessageFormatter FormatterInstance { get; set; } - public static string DefaultFormatString { get; set; } = $"[{CultureInfo.CurrentCulture.DateTimeFormat}] (LL) - V"; + public static string DefaultFormatString { get; set; } = $"[{CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern} - {CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern}] (LL): V"; public static LogMessageFormatter Instance { diff --git a/SweetLib/Utils/TaskBar/TaskBarProgress.cs b/SweetLib/Utils/TaskBar/TaskBarProgress.cs index 18f01f8..cde7803 100644 --- a/SweetLib/Utils/TaskBar/TaskBarProgress.cs +++ b/SweetLib/Utils/TaskBar/TaskBarProgress.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; namespace SweetLib.Utils.TaskBar {