commit 73e1fabe0b8e495a349dcce22afbd15e84bec65c Author: Daniel Date: Thu Oct 26 20:02:44 2017 +0200 Initial Home page diff --git a/Home.md b/Home.md new file mode 100644 index 0000000..e6b7478 --- /dev/null +++ b/Home.md @@ -0,0 +1,477 @@ +# SweetLib + + + + + + + + + + + + + + + + + + + + + + + + +
RegistryStorerExceptionIniFileStorer
IStorerRegistryStorer
LoggerLogLevel
ILogMemoryLogMessage
LogMessageFormatterSweetUtils
+ + +## RegistryStorerException + +Exception thrown by SweetLib.Classes.Storer.RegistryStorer. + +### Constructor + +Creates a new RegistryStorerException. + +### Constructor(message) + +Creates a new RegistryStorerException. + +| Name | Description | +| ---- | ----------- | +| message | *System.String*
Exception message. | + + +## IniFileStorer + +Implementation of an IStorer interface which stores the data inside an ini file. + +### Constructor(fileName) + +Creates a new instance of IniFileStorer with a specified file name. + +| Name | Description | +| ---- | ----------- | +| fileName | *System.String*
The file name of the ini file. | + +### FileName + +Ini file path. + + +## IStorer + +Interface, which provides several methods to store simple data. + +### DeleteKey(section, key) + +Deletes a key inside a section. + +| Name | Description | +| ---- | ----------- | +| section | *System.String*
Represents the section in which the data is stored. | +| key | *System.String*
Represents the key to be deleted. | + +### DeleteSection(section) + +Deletes a section with all its keys. + +| Name | Description | +| ---- | ----------- | +| section | *System.String*
Represents the section to be deleted. | + +### HasKey(section, key) + +Checks, if a key exists inside a section. + +| Name | Description | +| ---- | ----------- | +| section | *System.String*
Represents the section in which the data is stored. | +| key | *System.String*
Represents the key of the stored data. | + +#### Returns + +True, if key is found inside section. + +### ReadBool(section, key, defaultValue) + +Reads a bool value. + +| Name | Description | +| ---- | ----------- | +| section | *System.String*
Represents the section in which the data is stored. | +| key | *System.String*
Represents the key of the stored data. | +| defaultValue | *System.Boolean*
Default value, if this value does not exist. | + +#### Returns + +Value of the key in section. + +### ReadInteger(section, key, defaultValue) + +Reads an integer value. + +| Name | Description | +| ---- | ----------- | +| section | *System.String*
Represents the section in which the data is stored. | +| key | *System.String*
Represents the key of the stored data. | +| defaultValue | *System.Int32*
Default value, if this value does not exist. | + +#### Returns + +Value of the key in section. + +### ReadString(section, key, defaultValue) + +Reads a string value. + +| Name | Description | +| ---- | ----------- | +| section | *System.String*
Represents the section in which the data is stored. | +| key | *System.String*
Represents the key of the stored data. | +| defaultValue | *System.String*
Default value, if this value does not exist. | + +#### Returns + +Value of the key in section. + +### WriteBool(section, key, value) + +Writes a bool value. + +| Name | Description | +| ---- | ----------- | +| section | *System.String*
Represents the section in which the data is stored. | +| key | *System.String*
Represents the key of the stored data. | +| value | *System.Boolean*
Value to be stored. | + +### WriteInteger(section, key, value) + +Writes an integer value. + +| Name | Description | +| ---- | ----------- | +| section | *System.String*
Represents the section in which the data is stored. | +| key | *System.String*
Represents the key of the stored data. | +| value | *System.Int32*
Value to be stored. | + +### WriteString(section, key, value) + +Writes a string value. + +| Name | Description | +| ---- | ----------- | +| section | *System.String*
Represents the section in which the data is stored. | +| key | *System.String*
Represents the key of the stored data. | +| value | *System.String*
Value to be stored. | + + +## RegistryStorer + +Implementation of an IStorer interface which stores the data inside the registry. + +#### Remarks + +Sections will be interpreted as subkeys on registry level. + +### Constructor(baseRegistryKey, appName) + +Creates a new instance of RegistryStorer with a specified application name. + +| Name | Description | +| ---- | ----------- | +| baseRegistryKey | *Microsoft.Win32.RegistryKey*
Provide a key of Microsoft.Win32.Registry, e.G. . | +| appName | *System.String*
The applications base name. This will be used as name for a sub key inside the software key below the base key. | + +### Constructor(appName) + +Creates a new instance of RegistryStorer with a specified application name. + +| Name | Description | +| ---- | ----------- | +| appName | *System.String*
The applications base name. This will be used as name for a sub key inside the software key below the base key. | + +#### Remarks + +This will use current user as the base key. + +### OperatingRegistryKey + +The base registry key in which will be operated. + + +## Logger + +Global logger class providing several methods to log events by the application. + +#### Remarks + +As Logger.DefaultLogMemory a Memory.ArchivableConsoleLogMemory will be used. You can change this to any other implementation at any time while runtime. Default log levels are set as bitflags in Logger.GlobalLogLevel. + +### Debug(message) + +Will log a message with the LogLevel.Debug log level. + +| Name | Description | +| ---- | ----------- | +| message | *System.String*
Message to log. | + +### DefaultLogMemory + +The default Memory.ILogMemory which will be used for any logging action, if no custom Memory.ILogMemory is set as parameter. + +### Error(message) + +Will log a message with the LogLevel.Error log level. + +| Name | Description | +| ---- | ----------- | +| message | *System.String*
Message to log. | + +### GlobalLogLevel + +The global log level. Only messages with the set LogLevel will be procedered. + +### Info(message) + +Will log a message with the LogLevel.Info log level. + +| Name | Description | +| ---- | ----------- | +| message | *System.String*
Message to log. | + +### Log(logLevel, message, logMemory) + +Will log a message into the provided logMemory. + +| Name | Description | +| ---- | ----------- | +| logLevel | *SweetLib.Utils.Logger.LogLevel*
The log level of this message. | + /// +| Name | Description | +| ---- | ----------- | +| message | *System.String*
The message to log. | +| logMemory | *SweetLib.Utils.Logger.Memory.ILogMemory*
The Memory.ILogMemory to store the message into. | + +### Log(logLevel, message) + +Will log a message into the global Logger.DefaultLogMemory. + +| Name | Description | +| ---- | ----------- | +| logLevel | *SweetLib.Utils.Logger.LogLevel*
The log level of this message. | +| message | *System.String*
The message to log. | + +### Log(message, logMemory) + +Will log a message into the provided logMemory. + +| Name | Description | +| ---- | ----------- | +| message | *SweetLib.Utils.Logger.Message.LogMessage*
A Message.LogMessage object to store. | +| logMemory | *SweetLib.Utils.Logger.Memory.ILogMemory*
The Memory.ILogMemory to store the message into. | + +#### Remarks + +In general use cases you should either use one of the Logger.Log(SweetLib.Utils.Logger.LogLevel,System.String) or Logger.Log(SweetLib.Utils.Logger.LogLevel,System.String) methods which will generate a call to this method. + +### Trace(message) + +Will log a message with the LogLevel.Trace log level. + +| Name | Description | +| ---- | ----------- | +| message | *System.String*
Message to log. | + +### Warn(message) + +Will log a message with the LogLevel.Warn log level. + +| Name | Description | +| ---- | ----------- | +| message | *System.String*
Message to log. | + + +## LogLevel + +Enum which contains the several log levels. + + +## ILogMemory + +Interface for a class to store and proceed SweetLib.Utils.Logger.Message.LogMessage objects. + +### Archive(fullFileName) + +Saves all remembered SweetLib.Utils.Logger.Message.LogMessage objects into a persistent file. + +| Name | Description | +| ---- | ----------- | +| fullFileName | *System.String*
File name to store the SweetLib.Utils.Logger.Message.LogMessage objects. | + +### Forget(message) + +Removes a message from the ILogMemory. + +| Name | Description | +| ---- | ----------- | +| message | *SweetLib.Utils.Logger.Message.LogMessage*
SweetLib.Utils.Logger.Message.LogMessage to be removed. | + +#### Remarks + +This might not have any effect depending on the ILogMemory implementation. + +### Remember(message) + +Adds a message into the ILogMemory. + +| Name | Description | +| ---- | ----------- | +| message | *SweetLib.Utils.Logger.Message.LogMessage*
SweetLib.Utils.Logger.Message.LogMessage to be stored. | + + +## LogMessage + +LogMessage contains all event log data which should be logged in as a single log message. + +### Constructor(logLevel, message, logDateTime) + +Creates a new LogMessage instance. + +| Name | Description | +| ---- | ----------- | +| logLevel | *SweetLib.Utils.Logger.LogLevel*
The log level of this event log. | +| message | *System.String*
The message of this event log. | +| logDateTime | *System.DateTime*
The System.DateTime of this event log. | + +### Constructor(logLevel, message) + +Creates a new LogMessage instance. System.DateTime.Now will be the LogMessage.LogDateTime. + +| Name | Description | +| ---- | ----------- | +| logLevel | *SweetLib.Utils.Logger.LogLevel*
The log level of this event log. | +| message | *System.String*
The message of this event log. | + +### LogDateTime + +The date and time of this event log. + +### LogLevel + +The LogMessage.LogLevel of this event log. + +### Message + +The message of this event log. + +### ToString + +Generates a formatted System.String of this event log. LogMessageFormatter.DefaultFormatString will be used to format this event log. + +#### Returns + +A formated System.String of this event log. + +### ToString(format, formatProvider) + +Generates a formatted System.String of this event log with a given format. + +| Name | Description | +| ---- | ----------- | +| format | *System.String*
The format to be used. See LogMessageFormatter for more format information. | +| formatProvider | *System.IFormatProvider*
Optional, an System.IFormatProvider interface to be used while formatting if needed. | + +#### Returns + +A formated System.String of this event log. + + +## LogMessageFormatter + +A System.ICustomFormatter which is used to format LogMessage objects. + +#### Remarks + +This class implements a singleton pattern. + +### Format(format, arg, formatProvider) + +Formats a LogMessage object. + +| Name | Description | +| ---- | ----------- | +| format | *System.String*
The format string. If null, LogMessageFormatter.DefaultFormatString will be used. | +| arg | *System.Object*
The LogMessage object to be formatted. | +| formatProvider | *System.IFormatProvider*
Optional, an System.IFormatProvider interface to be used while formatting if needed. | + +#### Returns + +A formatted System.String of the LogMessage. + +#### Remarks + +If arg is not a LogMessage object, it will either be returned the formatted string implemented by the type of arg, if System.IFormattable is implemented by it, or the arg.ToString() result." + +### FormatterInstance + +Accesses the global instance of the LogMessageFormatter. + +### Instance + +The default format string which is used to format LogMessage objects, if no custom format string is provided. + + +## SweetUtils + +A generic class containing useful methods. + +### DateTimeToUnixTimeStamp(date) + +Converts a System.DateTime into an Unix timestamp. + +| Name | Description | +| ---- | ----------- | +| date | *System.DateTime*
System.DateTime to convert into Unix timestamp. | + +#### Returns + +Converted Unix timestamp. + +### LegalizeFilename(fileName, replaceChar) + +Legalizes a file name by a given replace character. + +| Name | Description | +| ---- | ----------- | +| fileName | *System.String*
File name to legalize. | +| replaceChar | *System.Char*
Character to be used as replace character. | + +#### Returns + +Legalized file name. + +### LegalizeFilename(fileName) + +Legalizes a file name with the SweetUtils.DefaultFileNameReplaceChar character. + +| Name | Description | +| ---- | ----------- | +| fileName | *System.String*
File name to legalize. | + +#### Returns + +Legalized file name. + +### UnixTimestampToDateTime(timestamp) + +Converts an Unix timestamp into a System.DateTime. + +| Name | Description | +| ---- | ----------- | +| timestamp | *System.Double*
Unix timestamp to convert. | + +#### Returns + +Converted System.DateTime.