diff --git a/SweetLib.Old/Classes/Exception/RegistryStorerException.cs b/SweetLib.Old/Classes/Exception/RegistryStorerException.cs
deleted file mode 100644
index aed90c9..0000000
--- a/SweetLib.Old/Classes/Exception/RegistryStorerException.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using SweetLib.Classes.Storer;
-
-namespace SweetLib.Classes.Exception
-{
- ///
- /// Exception thrown by .
- ///
- public class RegistryStorerException : System.Exception
- {
- ///
- /// Creates a new .
- ///
- public RegistryStorerException(){}
-
- ///
- /// Creates a new .
- ///
- /// Exception message.
- public RegistryStorerException(string message):base(message) {}
- }
-}
diff --git a/SweetLib.Old/Classes/Storer/IStorer.cs b/SweetLib.Old/Classes/Storer/IStorer.cs
deleted file mode 100644
index 0c5f258..0000000
--- a/SweetLib.Old/Classes/Storer/IStorer.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-namespace SweetLib.Classes.Storer
-{
- ///
- /// Interface, which provides several methods to store simple data.
- ///
- public interface IStorer
- {
- ///
- /// Reads a string value.
- ///
- /// Represents the section in which the data is stored.
- /// Represents the key of the stored data.
- /// Default value, if this value does not exist.
- /// Value of the in .
- string ReadString(string section, string key, string defaultValue = "");
-
- ///
- /// Reads an integer value.
- ///
- /// Represents the section in which the data is stored.
- /// Represents the key of the stored data.
- /// Default value, if this value does not exist.
- /// Value of the in .
- int ReadInteger(string section, string key, int defaultValue = 0);
-
- ///
- /// Reads a bool value.
- ///
- /// Represents the section in which the data is stored.
- /// Represents the key of the stored data.
- /// Default value, if this value does not exist.
- /// Value of the in .
- bool ReadBool(string section, string key, bool defaultValue = false);
-
- ///
- /// Checks, if a key exists inside a section.
- ///
- /// Represents the section in which the data is stored.
- /// Represents the key of the stored data.
- /// True, if is found inside .
- bool HasKey(string section, string key);
-
- ///
- /// Writes a string value.
- ///
- /// Represents the section in which the data is stored.
- /// Represents the key of the stored data.
- /// Value to be stored.
- void WriteString(string section, string key, string value);
-
- ///
- /// Writes an integer value.
- ///
- /// Represents the section in which the data is stored.
- /// Represents the key of the stored data.
- /// Value to be stored.
- void WriteInteger(string section, string key, int value);
-
- ///
- /// Writes a bool value.
- ///
- /// Represents the section in which the data is stored.
- /// Represents the key of the stored data.
- /// Value to be stored.
- void WriteBool(string section, string key, bool value);
-
- ///
- /// Deletes a key inside a .
- ///
- /// Represents the section in which the data is stored.
- /// Represents the key to be deleted.
- void DeleteKey(string section, string key);
-
- ///
- /// Deletes a section with all its keys.
- ///
- /// Represents the section to be deleted.
- void DeleteSection(string section);
- }
-}
diff --git a/SweetLib.Old/Classes/Storer/IniFileStorer.cs b/SweetLib.Old/Classes/Storer/IniFileStorer.cs
deleted file mode 100644
index c0e77ff..0000000
--- a/SweetLib.Old/Classes/Storer/IniFileStorer.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace SweetLib.Classes.Storer
-{
- ///
- /// Implementation of an interface which stores the data inside an ini file.
- ///
- public class IniFileStorer : IStorer
- {
- ///
- /// Ini file path.
- ///
- public string FileName { get; }
-
- [DllImport("kernel32", CharSet = CharSet.Unicode)]
- private static extern long WritePrivateProfileString(string section, string key, string value, string filePath);
-
- [DllImport("kernel32", CharSet = CharSet.Unicode)]
- private static extern int GetPrivateProfileString(string section, string key, string defaultValue, StringBuilder value, int size, string filePath);
-
- ///
- /// Creates a new instance of with a specified file name.
- ///
- /// The file name of the ini file.
- public IniFileStorer(string fileName)
- {
- FileName = fileName;
- }
-
- public string ReadString(string section, string key, string defaultValue = "")
- {
- var builder = new StringBuilder(255);
- GetPrivateProfileString(section, key, defaultValue, builder, 255, FileName);
- return builder.ToString();
- }
-
- public int ReadInteger(string section, string key, int defaultValue = 0)
- {
- int result;
- if (!int.TryParse(ReadString(section, key, defaultValue.ToString()), out result))
- result = defaultValue;
-
- return result;
- }
-
- public bool ReadBool(string section, string key, bool defaultValue = false)
- {
- return ReadInteger(section, key, defaultValue ? 1 : 0) > 0;
- }
-
- public bool HasKey(string section, string key)
- {
- return ReadString(section, key).Length > 0;
- }
-
- public void WriteString(string section, string key, string value)
- {
- WritePrivateProfileString(section, key, value, FileName);
- }
-
- public void WriteInteger(string section, string key, int value)
- {
- WriteString(section, key, value.ToString());
- }
-
- public void WriteBool(string section, string key, bool value)
- {
- WriteInteger(section, key, value ? 1 : 0);
- }
-
- public void DeleteKey(string section, string key)
- {
- WriteString(section, key, null);
- }
-
- public void DeleteSection(string section)
- {
- WriteString(section, null, null);
- }
- }
-}
diff --git a/SweetLib.Old/Classes/Storer/RegistryStorer.cs b/SweetLib.Old/Classes/Storer/RegistryStorer.cs
deleted file mode 100644
index a04aac2..0000000
--- a/SweetLib.Old/Classes/Storer/RegistryStorer.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-using Microsoft.Win32;
-using SweetLib.Classes.Exception;
-
-namespace SweetLib.Classes.Storer
-{
- ///
- /// Implementation of an interface which stores the data inside the registry.
- ///
- ///
- /// Sections will be interpreted as subkeys on registry level.
- ///
- public class RegistryStorer : IStorer
- {
- ///
- /// The base registry key in which will be operated.
- ///
- public RegistryKey OperatingRegistryKey { get; }
-
- ///
- /// Creates a new instance of with a specified application name.
- ///
- /// The applications base name. This will be used as name for a sub key inside the software key below the base key.
- ///
- /// This will use current user as the base key.
- ///
- public RegistryStorer(string appName) : this(Registry.CurrentUser, appName) { }
-
- ///
- /// Creates a new instance of with a specified application name.
- ///
- /// Provide a key of , e.G. Registry.CurrentUser.
- /// The applications base name. This will be used as name for a sub key inside the software key below the base key.
- public RegistryStorer(RegistryKey baseRegistryKey, string appName)
- {
- baseRegistryKey = baseRegistryKey.CreateSubKey("SOFTWARE");
- OperatingRegistryKey = baseRegistryKey?.CreateSubKey(appName);
-
- if (OperatingRegistryKey == null)
- throw new RegistryStorerException("Unable to create registriy key.");
- }
-
- public string ReadString(string section, string key, string defaultValue = "")
- {
- var localRegKey = OperatingRegistryKey.OpenSubKey(section);
- return (string)localRegKey?.GetValue(key.ToUpper());
- }
-
- public int ReadInteger(string section, string key, int defaultValue = 0)
- {
- int result;
- if (!int.TryParse(ReadString(section, key, defaultValue.ToString()), out result))
- result = defaultValue;
-
- return result;
- }
-
- public bool ReadBool(string section, string key, bool defaultValue = false)
- {
- return ReadInteger(section, key, defaultValue ? 1 : 0) > 0;
- }
-
- public bool HasKey(string section, string key)
- {
- return ReadString(section, key).Length > 0;
- }
-
- public void WriteString(string section, string key, string value)
- {
- var localRegKey = OperatingRegistryKey.CreateSubKey(section);
- localRegKey?.SetValue(key.ToUpper(), value);
- }
-
- public void WriteInteger(string section, string key, int value)
- {
- WriteString(section, key, value.ToString());
- }
-
- public void WriteBool(string section, string key, bool value)
- {
- WriteInteger(section, key, value ? 1 : 0);
- }
-
- public void DeleteKey(string section, string key)
- {
- var localRegKey = OperatingRegistryKey.CreateSubKey(section);
- localRegKey?.DeleteValue(key);
- }
-
- public void DeleteSection(string section)
- {
- OperatingRegistryKey.DeleteSubKey(section);
- }
- }
-}
diff --git a/SweetLib.Old/Properties/AssemblyInfo.cs b/SweetLib.Old/Properties/AssemblyInfo.cs
deleted file mode 100644
index 731d62c..0000000
--- a/SweetLib.Old/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-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")]
-[assembly: AssemblyDescription("Sweet collection of helpful utils in .Net")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Serraniel")]
-[assembly: AssemblyProduct("SweetLib")]
-[assembly: AssemblyCopyright("Copyright © 2017 by Serraniel")]
-[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("02c1f8ef-32f2-4e77-a36d-79129402af37")]
-
-// 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("0.1.26.0")]
-[assembly: AssemblyFileVersion("0.1.26.0")]
diff --git a/SweetLib.Old/SweetLib.Old.csproj b/SweetLib.Old/SweetLib.Old.csproj
deleted file mode 100644
index e612631..0000000
--- a/SweetLib.Old/SweetLib.Old.csproj
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {02C1F8EF-32F2-4E77-A36D-79129402AF37}
- Library
- Properties
- SweetLib
- SweetLib
- v4.5
- 512
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/SweetLib.Old/SweetLib.nuspec b/SweetLib.Old/SweetLib.nuspec
deleted file mode 100644
index 60041e9..0000000
--- a/SweetLib.Old/SweetLib.nuspec
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- $id$
- $version$-alpha
- $title$
- Serraniel
- $author$
- https://opensource.org/licenses/GPL-3.0
- https://github.com/Serraniel/SweetLib
- https://github.com/Serraniel/SweetLib/blob/develop/nuget_icon.png?raw=true
- true
- $description$
- First pre version just to try that nuget package thing :)
- Copyright © 2017 Serraniel
- Utility
-
-
\ No newline at end of file
diff --git a/SweetLib.Old/Utils/Logger/Logger.cs b/SweetLib.Old/Utils/Logger/Logger.cs
deleted file mode 100644
index daa682d..0000000
--- a/SweetLib.Old/Utils/Logger/Logger.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-using System;
-using SweetLib.Utils.Logger.Memory;
-using SweetLib.Utils.Logger.Message;
-
-namespace SweetLib.Utils.Logger
-{
- ///
- /// Enum which contains the several log levels.
- ///
- [Flags]
- public enum LogLevel
- {
- None = 0,
- Trace = 1 << 0,
- Debug = 1 << 1,
- Info = 1 << 2,
- Warn = 1 << 3,
- Error = 1 << 4,
-
- All = Int32.MaxValue,
- };
-
- ///
- /// Global logger class providing several methods to log events by the application.
- ///
- ///
- /// As a will be used. You can change this to any other implementation at any time while runtime.
- /// Default log levels are set as bitflags in .
- ///
- public static class Logger
- {
- ///
- /// The global log level. Only messages with the set will be procedered.
- ///
- public static LogLevel GlobalLogLevel { get; set; } = LogLevel.Info | LogLevel.Warn | LogLevel.Error;
-
- ///
- /// The default which will be used for any logging action, if no custom is set as parameter.
- ///
- public static ILogMemory DefaultLogMemory = new ArchivableConsoleLogMemory();
-
- ///
- /// Will log a message into the global .
- ///
- /// The log level of this message.
- /// The message to log.
- public static void Log(LogLevel logLevel, string message)
- {
- Log(logLevel, message, DefaultLogMemory);
- }
-
- ///
- /// Will log a message into the provided .
- ///
- /// The log level of this message.
- /// /// The message to log.
- /// The to store the into.
- public static void Log(LogLevel logLevel, string message, ILogMemory logMemory)
- {
- Log(new LogMessage(logLevel, message), logMemory);
- }
-
- ///
- /// Will log a message into the provided .
- ///
- /// A object to store.
- /// The to store the into.
- /// In general use cases you should either use one of the or methods which will generate a call to this method.
- public static void Log(LogMessage message, ILogMemory logMemory)
- {
- if (message == null)
- throw new ArgumentNullException(nameof(message));
-
- if (logMemory == null)
- throw new ArgumentNullException(nameof(logMemory));
-
- if ((GlobalLogLevel & message.LogLevel) == LogLevel.None)
- return;
-
- logMemory.Remember(message);
- }
-
- ///
- /// Will log a message with the log level.
- ///
- /// Message to log.
- public static void Trace(string message)
- {
- Log(LogLevel.Trace, message);
- }
-
- ///
- /// Will log a message with the log level.
- ///
- /// Message to log.
- public static void Debug(string message)
- {
- Log(LogLevel.Debug, message);
- }
-
- ///
- /// Will log a message with the log level.
- ///
- /// Message to log.
- public static void Info(string message)
- {
- Log(LogLevel.Info, message);
- }
-
- ///
- /// Will log a message with the log level.
- ///
- /// Message to log.
- public static void Warn(string message)
- {
- Log(LogLevel.Warn, message);
- }
-
- ///
- /// Will log a message with the log level.
- ///
- /// Message to log.
- public static void Error(string message)
- {
- Log(LogLevel.Error, message);
- }
- }
-}
diff --git a/SweetLib.Old/Utils/Logger/Memory/ArchivableConsoleLogMemory.cs b/SweetLib.Old/Utils/Logger/Memory/ArchivableConsoleLogMemory.cs
deleted file mode 100644
index 482dac5..0000000
--- a/SweetLib.Old/Utils/Logger/Memory/ArchivableConsoleLogMemory.cs
+++ /dev/null
@@ -1,163 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.IO;
-using System.IO.Compression;
-using System.Linq;
-using System.Threading;
-using SweetLib.Utils.Logger.Message;
-
-namespace SweetLib.Utils.Logger.Memory
-{
- public class ArchivableConsoleLogMemory : ILogMemory
- {
- private string TempFile { get; } = Path.GetTempFileName();
-
- private Timer QueueTimer { get; }
-
- private ConcurrentQueue LogQueue { get; } = new ConcurrentQueue();
-
- public string ArchiveFile { get; set; } = null;
-
- public bool AutoArchiveOnDispose { get; set; } = true;
-
- public ArchivableConsoleLogMemory() : this(null) { }
-
- public ArchivableConsoleLogMemory(string archiveFile)
- {
- ArchiveFile = archiveFile;
-
- QueueTimer = new Timer(e => ProcessQueue(), null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
- }
-
- ~ArchivableConsoleLogMemory()
- {
- Dispose(false);
- }
-
- private void ProcessQueue(bool isDisposing = false)
- {
- if (LogQueue.IsEmpty)
- return;
-
- // if we are disposing no need to lock. This might cause issues!
- if (!isDisposing)
- {
- lock (this)
- {
- if (LogQueue.IsEmpty)
- return;
-
- LogMessage message;
- if (LogQueue.TryDequeue(out message))
- File.AppendAllText(TempFile, message.ToString());
- }
- }
- else
- {
- if (LogQueue.IsEmpty)
- return;
-
- LogMessage message;
- if (LogQueue.TryDequeue(out message))
- File.AppendAllText(TempFile, message.ToString());
- }
- }
-
- public void Remember(LogMessage message)
- {
- var consoleColor = Console.ForegroundColor;
-
- switch (message.LogLevel)
- {
- case LogLevel.Trace:
- Console.ForegroundColor = ConsoleColor.Gray;
- break;
- case LogLevel.Debug:
- Console.ForegroundColor = ConsoleColor.DarkYellow;
- break;
- case LogLevel.Info:
- Console.ForegroundColor = ConsoleColor.Cyan;
- break;
- case LogLevel.Warn:
- Console.ForegroundColor = ConsoleColor.Yellow;
- break;
- case LogLevel.Error:
- Console.ForegroundColor = ConsoleColor.Red;
- break;
- }
-
- Console.WriteLine(message.ToString());
- LogQueue.Enqueue(message);
-
- Console.ForegroundColor = consoleColor;
- }
-
-
-
- public void Forget(LogMessage message)
- {
- lock (this)
- {
- var lines = File.ReadAllLines(TempFile).ToList();
- foreach (var line in lines)
- {
- if (line == message.ToString())
- lines.Remove(line);
- }
-
- File.WriteAllLines(TempFile, lines);
- }
- }
-
- public void Archive(string fullFileName = null)
- {
- if (fullFileName == null)
- fullFileName = ArchiveFile;
-
- if (fullFileName == null)
- throw new FileNotFoundException("target file not found");
-
- 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))
- {
- tmpFileStream.CopyTo(compressionsStream);
- }
- }
- }
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- QueueTimer.Dispose();
-
- ProcessQueue(true);
-
- if (AutoArchiveOnDispose)
- {
- try
- {
- Archive();
- }
- catch (FileNotFoundException)
- {
- if (disposing)
- throw;
- }
- }
-
- File.Delete(TempFile);
- }
- }
-}
diff --git a/SweetLib.Old/Utils/Logger/Memory/ILogMemory.cs b/SweetLib.Old/Utils/Logger/Memory/ILogMemory.cs
deleted file mode 100644
index 4f59112..0000000
--- a/SweetLib.Old/Utils/Logger/Memory/ILogMemory.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using SweetLib.Utils.Logger.Message;
-
-namespace SweetLib.Utils.Logger.Memory
-{
- ///
- /// Interface for a class to store and proceed objects.
- ///
- public interface ILogMemory
- {
- ///
- /// Adds a into the .
- ///
- /// to be stored.
- void Remember(LogMessage message);
-
- ///
- /// Removes a from the .
- ///
- /// to be removed.
- /// This might not have any effect depending on the implementation.
- void Forget(LogMessage message);
-
- ///
- /// Saves all remembered objects into a persistent file.
- ///
- /// File name to store the objects.
- void Archive(string fullFileName);
- }
-}
diff --git a/SweetLib.Old/Utils/Logger/Message/LogMessage.cs b/SweetLib.Old/Utils/Logger/Message/LogMessage.cs
deleted file mode 100644
index 978dc17..0000000
--- a/SweetLib.Old/Utils/Logger/Message/LogMessage.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System;
-using System.Globalization;
-
-namespace SweetLib.Utils.Logger.Message
-{
- ///
- /// contains all event log data which should be logged in as a single log message.
- ///
- public class LogMessage : IFormattable
- {
- ///
- /// The of this event log.
- ///
- public LogLevel LogLevel { get; }
-
- ///
- /// The message of this event log.
- ///
- public string Message { get; }
-
- ///
- /// The date and time of this event log.
- ///
- public DateTime LogDateTime { get; }
-
- ///
- /// Creates a new instance. will be the .
- ///
- /// The log level of this event log.
- /// The message of this event log.
- public LogMessage(LogLevel logLevel, string message) : this(logLevel, message, DateTime.Now) { }
-
- ///
- /// Creates a new instance.
- ///
- /// The log level of this event log.
- /// The message of this event log.
- /// The of this event log.
- public LogMessage(LogLevel logLevel, string message, DateTime logDateTime)
- {
- if (message == null)
- throw new ArgumentNullException(nameof(message));
-
- if (logDateTime == null)
- throw new ArgumentNullException(nameof(logDateTime));
-
- LogLevel = logLevel;
- Message = message;
- LogDateTime = logDateTime;
- }
-
- ///
- /// Generates a formatted of this event log. will be used to format this event log.
- ///
- /// A formated of this event log.
- public override string ToString()
- {
- return ToString(LogMessageFormatter.DefaultFormatString, CultureInfo.CurrentCulture);
- }
-
- ///
- /// Generates a formatted of this event log with a given format.
- ///
- /// The format to be used. See for more format information.
- /// Optional, an interface to be used while formatting if needed.
- /// A formated of this event log.
- public string ToString(string format, IFormatProvider formatProvider = null)
- {
- return LogMessageFormatter.Instance.Format(format, this, formatProvider);
- }
- }
-}
diff --git a/SweetLib.Old/Utils/Logger/Message/LogMessageFormatter.cs b/SweetLib.Old/Utils/Logger/Message/LogMessageFormatter.cs
deleted file mode 100644
index 85befa7..0000000
--- a/SweetLib.Old/Utils/Logger/Message/LogMessageFormatter.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-using System;
-using System.Globalization;
-
-namespace SweetLib.Utils.Logger.Message
-{
- ///
- /// A which is used to format objects.
- ///
- /// This class implements a singleton pattern.
- public class LogMessageFormatter : ICustomFormatter
- {
-
- private LogMessageFormatter() { }
-
- private static object Locker { get; } = new object();
-
- ///
- /// Accesses the global instance of the .
- ///
- private static LogMessageFormatter FormatterInstance { get; set; }
-
- public static string DefaultFormatString { get; set; } = $"[{CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern} - {CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern}] (LL): V";
-
- ///
- /// The default format string which is used to format objects, if no custom format string is provided.
- ///
- public static LogMessageFormatter Instance
- {
- get
- {
- if (FormatterInstance != null)
- return FormatterInstance;
-
- lock (Locker)
- {
- if (FormatterInstance != null)
- return FormatterInstance;
-
- FormatterInstance = new LogMessageFormatter();
- }
- return FormatterInstance;
- }
- }
-
- ///
- /// Formats a object.
- ///
- /// The format string. If , will be used.
- /// The object to be formatted.
- /// Optional, an interface to be used while formatting if needed.
- /// A formatted of the .
- ///
- /// If is not a object, it will either be returned the formatted string implemented by the type of , if is implemented by it, or the result."
- ///
- public string Format(string format, object arg, IFormatProvider formatProvider)
- {
- if (format == null)
- format = DefaultFormatString;
-
- if (arg == null)
- throw new ArgumentNullException(nameof(arg));
-
- if (arg.GetType() != typeof(LogMessage))
- {
- var formattable = arg as IFormattable;
- return formattable?.ToString(format, formatProvider) ?? arg.ToString();
- }
-
- var message = (LogMessage)arg;
-
- var result = message.LogDateTime.ToString(format, formatProvider);
-
- result = result.Replace("LL", message.LogLevel.ToString());
- result = result.Replace("V", message.Message);
-
- return result;
- }
- }
-}
diff --git a/SweetLib.Old/Utils/SweetUtils.cs b/SweetLib.Old/Utils/SweetUtils.cs
deleted file mode 100644
index 4147a48..0000000
--- a/SweetLib.Old/Utils/SweetUtils.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SweetLib.Utils
-{
- ///
- /// A generic class containing useful methods.
- ///
- public static class SweetUtils
- {
- public static char DefaultFileNameReplaceChar { get; set; } = '-';
-
- ///
- /// Legalizes a file name with the character.
- ///
- /// File name to legalize.
- /// Legalized file name.
- public static string LegalizeFilename(string fileName)
- {
- return LegalizeFilename(fileName, '-');
- }
-
- ///
- /// Legalizes a file name by a given replace character.
- ///
- /// File name to legalize.
- /// Character to be used as replace character.
- /// Legalized file name.
- public static string LegalizeFilename(string fileName, char replaceChar)
- {
- var invalidChars = System.IO.Path.GetInvalidFileNameChars();
-
- if (invalidChars.Contains(replaceChar))
- throw new IOException($"Replace character {replaceChar} is an invalid file name character.");
-
- return invalidChars.Aggregate(fileName, (current, c) => current.Replace(c, replaceChar));
- }
-
- ///
- /// Converts a into an Unix timestamp.
- ///
- /// to convert into Unix timestamp.
- /// Converted Unix timestamp.
- public static double DateTimeToUnixTimeStamp(DateTime date)
- {
- return date.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
- }
-
- ///
- /// Converts an Unix timestamp into a .
- ///
- /// Unix timestamp to convert.
- /// Converted .
- public static DateTime UnixTimestampToDateTime(double timestamp)
- {
- return new DateTime(1970, 1, 1).AddMilliseconds(timestamp);
- }
- }
-}
diff --git a/SweetLib.Old/Utils/TaskBar/TaskBarProgress.cs b/SweetLib.Old/Utils/TaskBar/TaskBarProgress.cs
deleted file mode 100644
index cde7803..0000000
--- a/SweetLib.Old/Utils/TaskBar/TaskBarProgress.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-
-namespace SweetLib.Utils.TaskBar
-{
- public static class TaskBarProgress
- {
- public enum TaskbarStates
- {
- NoProgress = 0,
- Indeterminate = 0x1,
- Normal = 0x2,
- Error = 0x4,
- Paused = 0x8
- }
-
- [ComImport]
- [Guid("26C41017-74B8-4C70-88AA-61B11D8C0D5A")]
- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- private interface ITaskbarList3
- {
- // ITaskbarList
- [PreserveSig]
- void HrInit();
- [PreserveSig]
- void AddTab(IntPtr hwnd);
- [PreserveSig]
- void DeleteTab(IntPtr hwnd);
- [PreserveSig]
- void ActivateTab(IntPtr hwnd);
- [PreserveSig]
- void SetActiveAlt(IntPtr hwnd);
-
- // ITaskbarList2
- [PreserveSig]
- void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
-
- // ITaskbarList3
- [PreserveSig]
- void SetProgressValue(IntPtr hwnd, UInt64 ullCompleted, UInt64 ullTotal);
- [PreserveSig]
- void SetProgressState(IntPtr hwnd, TaskbarStates state);
- }
-
- [Guid("D6031210-4108-4E8A-B740-A627052FDAC2")]
- [ClassInterface(ClassInterfaceType.None)]
- [ComImport]
- private class TaskbarInstance
- {
- }
-
- private static ITaskbarList3 taskbarInstance = (ITaskbarList3)new TaskbarInstance();
- private static bool taskbarSupported = Environment.OSVersion.Version >= new Version(6, 1);
-
- public static void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
- {
- if (taskbarSupported) taskbarInstance.SetProgressState(windowHandle, taskbarState);
- }
-
- public static void SetValue(IntPtr windowHandle, double progressValue, double progressMax)
- {
- if (taskbarSupported) taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
- }
- }
-}
diff --git a/SweetLib.Old/build-nuget.bat b/SweetLib.Old/build-nuget.bat
deleted file mode 100644
index ac3b2ab..0000000
--- a/SweetLib.Old/build-nuget.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-nuget pack SweetLib.csproj -properties Configuration=Release -symbols
-pause
\ No newline at end of file
diff --git a/SweetLib.sln b/SweetLib.sln
index 170dc46..6673fc1 100644
--- a/SweetLib.sln
+++ b/SweetLib.sln
@@ -7,9 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SweetLib.Demo", "SweetLib.D
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SweetLib.Demo.Console", "SweetLib.Demo.Console\SweetLib.Demo.Console.csproj", "{C8681E08-6F23-45E1-A16F-BBA72003219B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SweetLib.Old", "SweetLib.Old\SweetLib.Old.csproj", "{02C1F8EF-32F2-4E77-A36D-79129402AF37}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SweetLib", "SweetLib\SweetLib.csproj", "{7C15F2F3-2BF2-46FB-B813-9EEC1B41D679}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SweetLib", "SweetLib\SweetLib.csproj", "{7C15F2F3-2BF2-46FB-B813-9EEC1B41D679}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -25,10 +23,6 @@ Global
{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
- {02C1F8EF-32F2-4E77-A36D-79129402AF37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {02C1F8EF-32F2-4E77-A36D-79129402AF37}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {02C1F8EF-32F2-4E77-A36D-79129402AF37}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {02C1F8EF-32F2-4E77-A36D-79129402AF37}.Release|Any CPU.Build.0 = Release|Any CPU
{7C15F2F3-2BF2-46FB-B813-9EEC1B41D679}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C15F2F3-2BF2-46FB-B813-9EEC1B41D679}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C15F2F3-2BF2-46FB-B813-9EEC1B41D679}.Release|Any CPU.ActiveCfg = Release|Any CPU