Nusstudios.Core

A general purpose library


This library contains the most common functions I use while programming C#.

It has a simple B encode / B decode static class.
It has a JSON parser with 4 major functions: Query, Update, Delete, Exists.
You can query deep clones/references of managed types, and also reference returns aka aliases for unmanaged primitives.
Every built-in basic primitive type is converted to the library's managed equivalent though.
That means if you query a reference to an integral type or string instead of an alias, you can use an instance method to update the primitive type they encapsulate.
The Update function will either put the reference/deep clone of the variable into the JSON container.
Delete, Update, Query will each accept compound paths to any node inside the hierarchy.
It contains an IO library with a function that walks directory structures reporting every node (files and directories).

It also has a more general dynamic hierarchy manager, which enables you to add to and query from the hierarchy literally any type that inherits from class object.

This library is highly object-oriented. My generic Map class is a remake of the reference implementation of the built in generic dictionary.
A Map object is encapsulated by 3 concrete specialised classes: StringContainer, ArrayContainer, NumericContainer.
StringContainer is sort of a dictionary with alphanumeric (string)keys and object values.
ArrayContainer has integer keys and they must follow an array-like order.
NumericContainer also has integer keys, but they are not bound to follow an array-like order.
These 3 container types all inherit from the abstract Container class. You can either query values by specifying an object key, or you pass a key as argument to one of the generic instance functions.
Either way is used, it is verified whether the type of the specified key matches the key type required by the current concrete type assigned to that abstract Container.
Container also implements the IEnumerable interface so that it can be used with foreach compound statements.
JValue is an abstract class with a static Parse function. The JContainer and JLeaf abstract classes inherit from it directly.
JObject and JArray are conrete direct successors of JContainer. They encapsulate the aforementioned StringtContainer and ArrayContainer classes, respectively.
JLeaf is inherited by the abstract class ManagedNumber, concrete classes ManagedString, ManagedBoolean and ManagedNull.
ManagedNumber is inherited by the abstract classes ManagedInteger and ManagedRational.
ManagedInteger is then inherited by abstract classes ManagedSignedInteger and ManagedUnsignedInteger.
These 2 classes are then inherited by concrete classes ManagedInt32, ManagedUInt8, etc...
ManagedRational is inherited by ManagedDouble, ManagedBigRational, etc...
The abstract classes provide seamless conversion between each type. If a conversion is possibly lossy, then it is essentially explicit. Otherwise the conversion is implicit.

It has a Unicode parser that can encode code points and decode code units. Supports every Unicode version, UTF-8, UTF-16, UTF-32, and it is endianness aware.
It also has an UnicodeStream class which functions like a StringBuilder except that it encapsulates an array of code points instead of chars. The number of characters is equal to the length of the UnicodeStream, unlike in case of strings. There is seamless conversion between strings and UnicodeStreams.
There are other additional functions that resemble the additional string functions you have: you can determine whether an UnicodeStream is numeric, alphanumeric, hexadecimal; you can convert a UnicodeStream to integral and fraction, etc...
There are some type-specific utilities for arrays and strings. You can for example find the first and last index of a subarray inside an array and stuff like that. You will find generic quicksort, mergesort and heapsort, KMP is different falvours.
It contains StringMath, a very basic math library for string variables.
It has a base converter that converts a fraction from a base into another (up to base 16).
There is a byte array to integer/double and integer/double to byte array converter class that you can configure with endianness. It can read variable encoded unsigned integers as well.
For every method there are 2 approaches: one that calculates the return value by maths, and the one which strictly uses bit shiftings.
There is a Console class that registers each writing to the console, marks them as required and clears/updates them without unexpected behaviour.
It is really reliable given that the console window is not resized (Please no resize!).
Contains all the reference implementations of hash functions of .NET. And extends it with the new born Keccak. You can choose to use the original or the standardized padding.
And finally there is a bit handling utility which you can use to quickly access certain bits in a byte. A function will return a sequence of bits from a byte array given a byte position, bit position (little endian-like), requested number of bits, and whether you are reading towards the most or the least singificant bit. There is a write function with similar parameters to insert a sequence of bits into a byte array.
It also includes an Object extension which enables deep cloning of any object. Please note this one is not my work, I just copied it.

Downloads


Source
Release

About


Language, target platform & version

C# .NET Standard 2.1 library. Version 1.1.