Initial Home page
commit
73e1fabe0b
477
Home.md
Normal file
477
Home.md
Normal file
|
@ -0,0 +1,477 @@
|
|||
# SweetLib
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="#registrystorerexception">RegistryStorerException</a></td>
|
||||
<td><a href="#inifilestorer">IniFileStorer</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#istorer">IStorer</a></td>
|
||||
<td><a href="#registrystorer">RegistryStorer</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#logger">Logger</a></td>
|
||||
<td><a href="#loglevel">LogLevel</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#ilogmemory">ILogMemory</a></td>
|
||||
<td><a href="#logmessage">LogMessage</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#logmessageformatter">LogMessageFormatter</a></td>
|
||||
<td><a href="#sweetutils">SweetUtils</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
## RegistryStorerException
|
||||
|
||||
Exception thrown by <a href="#sweetlib.classes.storer.registrystorer">SweetLib.Classes.Storer.RegistryStorer</a>.
|
||||
|
||||
### Constructor
|
||||
|
||||
Creates a new <a href="#registrystorerexception">RegistryStorerException</a>.
|
||||
|
||||
### Constructor(message)
|
||||
|
||||
Creates a new <a href="#registrystorerexception">RegistryStorerException</a>.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| message | *System.String*<br>Exception message. |
|
||||
|
||||
|
||||
## IniFileStorer
|
||||
|
||||
Implementation of an <a href="#istorer">IStorer</a> interface which stores the data inside an ini file.
|
||||
|
||||
### Constructor(fileName)
|
||||
|
||||
Creates a new instance of <a href="#inifilestorer">IniFileStorer</a> with a specified file name.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| fileName | *System.String*<br>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 <a href="#section">section</a>.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| section | *System.String*<br>Represents the section in which the data is stored. |
|
||||
| key | *System.String*<br>Represents the key to be deleted. |
|
||||
|
||||
### DeleteSection(section)
|
||||
|
||||
Deletes a section with all its keys.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| section | *System.String*<br>Represents the section to be deleted. |
|
||||
|
||||
### HasKey(section, key)
|
||||
|
||||
Checks, if a key exists inside a section.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| section | *System.String*<br>Represents the section in which the data is stored. |
|
||||
| key | *System.String*<br>Represents the key of the stored data. |
|
||||
|
||||
#### Returns
|
||||
|
||||
True, if <a href="#key">key</a> is found inside <a href="#section">section</a>.
|
||||
|
||||
### ReadBool(section, key, defaultValue)
|
||||
|
||||
Reads a bool value.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| section | *System.String*<br>Represents the section in which the data is stored. |
|
||||
| key | *System.String*<br>Represents the key of the stored data. |
|
||||
| defaultValue | *System.Boolean*<br>Default value, if this value does not exist. |
|
||||
|
||||
#### Returns
|
||||
|
||||
Value of the <a href="#key">key</a> in <a href="#section">section</a>.
|
||||
|
||||
### ReadInteger(section, key, defaultValue)
|
||||
|
||||
Reads an integer value.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| section | *System.String*<br>Represents the section in which the data is stored. |
|
||||
| key | *System.String*<br>Represents the key of the stored data. |
|
||||
| defaultValue | *System.Int32*<br>Default value, if this value does not exist. |
|
||||
|
||||
#### Returns
|
||||
|
||||
Value of the <a href="#key">key</a> in <a href="#section">section</a>.
|
||||
|
||||
### ReadString(section, key, defaultValue)
|
||||
|
||||
Reads a string value.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| section | *System.String*<br>Represents the section in which the data is stored. |
|
||||
| key | *System.String*<br>Represents the key of the stored data. |
|
||||
| defaultValue | *System.String*<br>Default value, if this value does not exist. |
|
||||
|
||||
#### Returns
|
||||
|
||||
Value of the <a href="#key">key</a> in <a href="#section">section</a>.
|
||||
|
||||
### WriteBool(section, key, value)
|
||||
|
||||
Writes a bool value.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| section | *System.String*<br>Represents the section in which the data is stored. |
|
||||
| key | *System.String*<br>Represents the key of the stored data. |
|
||||
| value | *System.Boolean*<br>Value to be stored. |
|
||||
|
||||
### WriteInteger(section, key, value)
|
||||
|
||||
Writes an integer value.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| section | *System.String*<br>Represents the section in which the data is stored. |
|
||||
| key | *System.String*<br>Represents the key of the stored data. |
|
||||
| value | *System.Int32*<br>Value to be stored. |
|
||||
|
||||
### WriteString(section, key, value)
|
||||
|
||||
Writes a string value.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| section | *System.String*<br>Represents the section in which the data is stored. |
|
||||
| key | *System.String*<br>Represents the key of the stored data. |
|
||||
| value | *System.String*<br>Value to be stored. |
|
||||
|
||||
|
||||
## RegistryStorer
|
||||
|
||||
Implementation of an <a href="#istorer">IStorer</a> 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 <a href="#registrystorer">RegistryStorer</a> with a specified application name.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| baseRegistryKey | *Microsoft.Win32.RegistryKey*<br>Provide a key of <a href="#microsoft.win32.registry">Microsoft.Win32.Registry</a>, e.G. . |
|
||||
| appName | *System.String*<br>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 <a href="#registrystorer">RegistryStorer</a> with a specified application name.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| appName | *System.String*<br>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 <a href="#logger.defaultlogmemory">Logger.DefaultLogMemory</a> a <a href="#memory.archivableconsolelogmemory">Memory.ArchivableConsoleLogMemory</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 <a href="#logger.globalloglevel">Logger.GlobalLogLevel</a>.
|
||||
|
||||
### Debug(message)
|
||||
|
||||
Will log a message with the <a href="#loglevel.debug">LogLevel.Debug</a> log level.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| message | *System.String*<br>Message to log. |
|
||||
|
||||
### DefaultLogMemory
|
||||
|
||||
The default <a href="#memory.ilogmemory">Memory.ILogMemory</a> which will be used for any logging action, if no custom <a href="#memory.ilogmemory">Memory.ILogMemory</a> is set as parameter.
|
||||
|
||||
### Error(message)
|
||||
|
||||
Will log a message with the <a href="#loglevel.error">LogLevel.Error</a> log level.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| message | *System.String*<br>Message to log. |
|
||||
|
||||
### GlobalLogLevel
|
||||
|
||||
The global log level. Only messages with the set <a href="#loglevel">LogLevel</a> will be procedered.
|
||||
|
||||
### Info(message)
|
||||
|
||||
Will log a message with the <a href="#loglevel.info">LogLevel.Info</a> log level.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| message | *System.String*<br>Message to log. |
|
||||
|
||||
### Log(logLevel, message, logMemory)
|
||||
|
||||
Will log a message into the provided <a href="#logmemory">logMemory</a>.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| logLevel | *SweetLib.Utils.Logger.LogLevel*<br>The log level of this message. |
|
||||
///
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| message | *System.String*<br>The message to log. |
|
||||
| logMemory | *SweetLib.Utils.Logger.Memory.ILogMemory*<br>The <a href="#memory.ilogmemory">Memory.ILogMemory</a> to store the <a href="#message">message</a> into. |
|
||||
|
||||
### Log(logLevel, message)
|
||||
|
||||
Will log a message into the global <a href="#logger.defaultlogmemory">Logger.DefaultLogMemory</a>.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| logLevel | *SweetLib.Utils.Logger.LogLevel*<br>The log level of this message. |
|
||||
| message | *System.String*<br>The message to log. |
|
||||
|
||||
### Log(message, logMemory)
|
||||
|
||||
Will log a message into the provided <a href="#logmemory">logMemory</a>.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| message | *SweetLib.Utils.Logger.Message.LogMessage*<br>A <a href="#message.logmessage">Message.LogMessage</a> object to store. |
|
||||
| logMemory | *SweetLib.Utils.Logger.Memory.ILogMemory*<br>The <a href="#memory.ilogmemory">Memory.ILogMemory</a> to store the <a href="#message">message</a> into. |
|
||||
|
||||
#### Remarks
|
||||
|
||||
In general use cases you should either use one of the <a href="#logger.log(sweetlib.utils.logger.loglevel,system.string)">Logger.Log(SweetLib.Utils.Logger.LogLevel,System.String)</a> or <a href="#logger.log(sweetlib.utils.logger.loglevel,system.string)">Logger.Log(SweetLib.Utils.Logger.LogLevel,System.String)</a> methods which will generate a call to this method.
|
||||
|
||||
### Trace(message)
|
||||
|
||||
Will log a message with the <a href="#loglevel.trace">LogLevel.Trace</a> log level.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| message | *System.String*<br>Message to log. |
|
||||
|
||||
### Warn(message)
|
||||
|
||||
Will log a message with the <a href="#loglevel.warn">LogLevel.Warn</a> log level.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| message | *System.String*<br>Message to log. |
|
||||
|
||||
|
||||
## LogLevel
|
||||
|
||||
Enum which contains the several log levels.
|
||||
|
||||
|
||||
## ILogMemory
|
||||
|
||||
Interface for a class to store and proceed <a href="#sweetlib.utils.logger.message.logmessage">SweetLib.Utils.Logger.Message.LogMessage</a> objects.
|
||||
|
||||
### Archive(fullFileName)
|
||||
|
||||
Saves all remembered <a href="#sweetlib.utils.logger.message.logmessage">SweetLib.Utils.Logger.Message.LogMessage</a> objects into a persistent file.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| fullFileName | *System.String*<br>File name to store the <a href="#sweetlib.utils.logger.message.logmessage">SweetLib.Utils.Logger.Message.LogMessage</a> objects. |
|
||||
|
||||
### Forget(message)
|
||||
|
||||
Removes a <a href="#message">message</a> from the <a href="#ilogmemory">ILogMemory</a>.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| message | *SweetLib.Utils.Logger.Message.LogMessage*<br><a href="#sweetlib.utils.logger.message.logmessage">SweetLib.Utils.Logger.Message.LogMessage</a> to be removed. |
|
||||
|
||||
#### Remarks
|
||||
|
||||
This might not have any effect depending on the <a href="#ilogmemory">ILogMemory</a> implementation.
|
||||
|
||||
### Remember(message)
|
||||
|
||||
Adds a <a href="#message">message</a> into the <a href="#ilogmemory">ILogMemory</a>.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| message | *SweetLib.Utils.Logger.Message.LogMessage*<br><a href="#sweetlib.utils.logger.message.logmessage">SweetLib.Utils.Logger.Message.LogMessage</a> to be stored. |
|
||||
|
||||
|
||||
## LogMessage
|
||||
|
||||
<a href="#logmessage">LogMessage</a> contains all event log data which should be logged in as a single log message.
|
||||
|
||||
### Constructor(logLevel, message, logDateTime)
|
||||
|
||||
Creates a new <a href="#logmessage">LogMessage</a> instance.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| logLevel | *SweetLib.Utils.Logger.LogLevel*<br>The log level of this event log. |
|
||||
| message | *System.String*<br>The message of this event log. |
|
||||
| logDateTime | *System.DateTime*<br>The <a href="#system.datetime">System.DateTime</a> of this event log. |
|
||||
|
||||
### Constructor(logLevel, message)
|
||||
|
||||
Creates a new <a href="#logmessage">LogMessage</a> instance. <a href="#system.datetime.now">System.DateTime.Now</a> will be the <a href="#logmessage.logdatetime">LogMessage.LogDateTime</a>.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| logLevel | *SweetLib.Utils.Logger.LogLevel*<br>The log level of this event log. |
|
||||
| message | *System.String*<br>The message of this event log. |
|
||||
|
||||
### LogDateTime
|
||||
|
||||
The date and time of this event log.
|
||||
|
||||
### LogLevel
|
||||
|
||||
The <a href="#logmessage.loglevel">LogMessage.LogLevel</a> of this event log.
|
||||
|
||||
### Message
|
||||
|
||||
The message of this event log.
|
||||
|
||||
### ToString
|
||||
|
||||
Generates a formatted <a href="#system.string">System.String</a> of this event log. <a href="#logmessageformatter.defaultformatstring">LogMessageFormatter.DefaultFormatString</a> will be used to format this event log.
|
||||
|
||||
#### Returns
|
||||
|
||||
A formated <a href="#system.string">System.String</a> of this event log.
|
||||
|
||||
### ToString(format, formatProvider)
|
||||
|
||||
Generates a formatted <a href="#system.string">System.String</a> of this event log with a given format.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| format | *System.String*<br>The format to be used. See <a href="#logmessageformatter">LogMessageFormatter</a> for more format information. |
|
||||
| formatProvider | *System.IFormatProvider*<br>Optional, an <a href="#system.iformatprovider">System.IFormatProvider</a> interface to be used while formatting if needed. |
|
||||
|
||||
#### Returns
|
||||
|
||||
A formated <a href="#system.string">System.String</a> of this event log.
|
||||
|
||||
|
||||
## LogMessageFormatter
|
||||
|
||||
A <a href="#system.icustomformatter">System.ICustomFormatter</a> which is used to format <a href="#logmessage">LogMessage</a> objects.
|
||||
|
||||
#### Remarks
|
||||
|
||||
This class implements a singleton pattern.
|
||||
|
||||
### Format(format, arg, formatProvider)
|
||||
|
||||
Formats a <a href="#logmessage">LogMessage</a> object.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| format | *System.String*<br>The format string. If <a href="#null">null</a>, <a href="#logmessageformatter.defaultformatstring">LogMessageFormatter.DefaultFormatString</a> will be used. |
|
||||
| arg | *System.Object*<br>The <a href="#logmessage">LogMessage</a> object to be formatted. |
|
||||
| formatProvider | *System.IFormatProvider*<br>Optional, an <a href="#system.iformatprovider">System.IFormatProvider</a> interface to be used while formatting if needed. |
|
||||
|
||||
#### Returns
|
||||
|
||||
A formatted <a href="#system.string">System.String</a> of the <a href="#logmessage">LogMessage</a>.
|
||||
|
||||
#### Remarks
|
||||
|
||||
If <a href="#arg">arg</a> is not a <a href="#logmessage">LogMessage</a> object, it will either be returned the formatted string implemented by the type of <a href="#arg">arg</a>, if <a href="#system.iformattable">System.IFormattable</a> is implemented by it, or the <a href="#arg.tostring()">arg.ToString()</a> result."
|
||||
|
||||
### FormatterInstance
|
||||
|
||||
Accesses the global instance of the <a href="#logmessageformatter">LogMessageFormatter</a>.
|
||||
|
||||
### Instance
|
||||
|
||||
The default format string which is used to format <a href="#logmessage">LogMessage</a> objects, if no custom format string is provided.
|
||||
|
||||
|
||||
## SweetUtils
|
||||
|
||||
A generic class containing useful methods.
|
||||
|
||||
### DateTimeToUnixTimeStamp(date)
|
||||
|
||||
Converts a <a href="#system.datetime">System.DateTime</a> into an Unix timestamp.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| date | *System.DateTime*<br><a href="#system.datetime">System.DateTime</a> 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*<br>File name to legalize. |
|
||||
| replaceChar | *System.Char*<br>Character to be used as replace character. |
|
||||
|
||||
#### Returns
|
||||
|
||||
Legalized file name.
|
||||
|
||||
### LegalizeFilename(fileName)
|
||||
|
||||
Legalizes a file name with the <a href="#sweetutils.defaultfilenamereplacechar">SweetUtils.DefaultFileNameReplaceChar</a> character.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| fileName | *System.String*<br>File name to legalize. |
|
||||
|
||||
#### Returns
|
||||
|
||||
Legalized file name.
|
||||
|
||||
### UnixTimestampToDateTime(timestamp)
|
||||
|
||||
Converts an Unix timestamp into a <a href="#system.datetime">System.DateTime</a>.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| timestamp | *System.Double*<br>Unix timestamp to convert. |
|
||||
|
||||
#### Returns
|
||||
|
||||
Converted <a href="#system.datetime">System.DateTime</a>.
|
Loading…
Reference in a new issue