DigitalData.Modules.Base
Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
BaseClass that sets up a Logger.
https://stackoverflow.com/questions/10168240/encrypting-decrypting-a-string-in-c-sharp
TODO: Deprecate
Checks a Row value for three different `null` values,
Nothing, Empty String, DBNull
Returns the original value if the value is not null, or `defaultValue`
The type of the value
The DataRow that contains the value
The column name
The default value
The original value or the default value
Reads the file at `FilePath` and computes a SHA256 Hash from its contents
Adds file version string to given filename `Destination` if that file already exists.
Filepath to check
Versioned string
Adds file version string to given filename `Destination` if that file already exists.
Filepath to check
Custom action to check for file existence
Versioned string
Split String at version separator to:
check if string is already versioned,
get the string version of an already versioned string
Examples:
test1.pdf --> test1 --> ['test1'] --> no fileversion
test1~2.pdf --> test1~2 --> ['test1', '2'] --> version 2
test1~12345~2.pdf --> test1~12345~2 --> ['test1', '12345', '2'] --> still version 2
somestring~3 --> somestring~3 --> ['somestring', '3'] --> version 3
The string to versioned
Tuple of string and version
Removes files in a directory filtered by filename, extension and last write date
The directory in which files will be deleted
Only delete files which are older than x days. Must be between 0 and 1000 days.
A filename filter which will be checked
A file extension which will be checked
Should the function continue with deleting when a file could not be deleted?
True if all files were deleted or if no files were deleted, otherwise false
Copied from https://docs.microsoft.com/en-us/dotnet/standard/io/how-to-copy-directories
Tries to create a directory and returns its path.
Returns a temp path if `DirectoryPath` can not be created or written to.
The directory to create
Should a write access test be performed?
The used path
Checks if a file is locked, ie. in use by another process.
https://docs.microsoft.com/en-us/dotnet/standard/io/handling-io-errors
https://stackoverflow.com/questions/876473/is-there-a-way-to-check-if-a-file-is-in-use
Checks the size of the supplied file.
This may fire twice for a single save operation,
see: https://blogs.msdn.microsoft.com/oldnewthing/20140507-00/?p=1053/
Built-in filters for FileWatcher that are useful for correctly detecting changes on Office documents (currently Office 2016)
Base Filter that all filters must inherit from
Provides two functions that may be overridden and some useful file extension lists
Simple Filter that filters changes made on temporary files
Filter to detect changes on Office files
Truncates a string to the specified length if it exceeds that length.
The string
The maximum string length
The truncated string
Replaces single quotes in text for SQL Commands.
The string
The escaped string.
Converts a string to boolean. Accepts true and 1 as truthy values
The input string
True if input is true or 1, otherwise false.
Checks if a string is null or empty
The input string
True string is null or empty, otherwise false.
Checks if a string is NOT null or empty
The input string
True string is null or empty, otherwise false.
Reads the file at `FilePath` and computes a SHA256 Hash from its contents
Returns a Dictionary path in the form of [Base]\[Year]\[Month]\[Day]
The basedirectory
The date to be used
The final directory path
Returns a Dictionary path in the form of [Base]\[Year]\[Month]\[Day] based on the current date
The basedirectory
The final directory path
Creates a Dictionary in the form of [Base]\[Year]\[Month]\[Day]
The basedirectory
The date to be used
The created path. If the directory cannot be created, Nothing.
Creates a Dictionary in the form of [Base]\[Year]\[Month]\[Day] based on the current date
The basedirectory
The created path. If the directory cannot be created, Nothing.
Checks a value for three different `null` values,
Nothing, Empty String, DBNull
Returns the original value if the value is not null, or `defaultValue`
The type of the value
The value
The default Value
The original value or the default value
Converts a String value to the given Enum
The Enum Type
The string value to convert
Converts an Integer value to the given Enum
The Enum Type
The integer value to convert
Converts a Long value to the given Enum
The Enum Type
The long value to convert
Returns the brightness of a color as a number between 0 and 1
The color to check
Low values for dark colors, high values for bright colors.
Returns a foreground/text color of either black or white, depending on the brightness of `pOtherColor`
The Background color whose brightness is determined
A text color which is either white or black
Functions relating to i18n, Cultures, Translations
Sets the Language of the current thread by setting CurrentCulture and CurrentUICulture
A Logger instance
A language code in the form of 'de-DE'
A custom date pattern
Logs the culture settings of the current thread
A Logger instance
Checks if a point is Visible on any screen
Checks if Size is not negative
Checks if Location is not negative
Creates a "slug" from text that can be used as part of a valid URL.
Invalid characters are converted to hyphens. Punctuation that Is
perfect valid in a URL Is also converted to hyphens to keep the
result mostly text. Steps are taken to prevent leading, trailing,
And consecutive hyphens.
The string to convert
Removes Invalid characters from a string, suitable for file and path names
Removed characters are:
* Illegal File-characters
* Illegal Path-characters
* Unicode characters that classify as Emoji
* All characters above codepoint U+10000
See:
https://stackoverflow.com/questions/46905176/detecting-all-emojis
https://stackoverflow.com/questions/28023682/how-do-i-remove-emoji-characters-from-a-string
Generates a random short (8 characters) guid
The generated guid as a String
Checks if string contains invalid characters
Creates a hash using the SHA256 algorithm and returns it
Any string