Aptivi - Deprecated Manuals
ProjectsWebsiteBlog
Nitrocid KS v0.1.0 Release Candidate - Manual
Nitrocid KS v0.1.0 Release Candidate - Manual
  • 👋Welcome!
  • Versions and Compatibility
    • 🔱Supported Versions
    • 🕘EOL Versions
    • 🗞️Version Release Notes
      • ✨v0.0.1.x series
      • 🌈v0.0.2.x series
      • 👥v0.0.3.x series
      • 🛠️v0.0.4.x series
      • 🕔v0.0.5.x series
        • ⌚v0.0.5.0 Beta Versions
      • 📕v0.0.6.x series
        • 📄v0.0.6.0 Beta Versions
      • 🔌v0.0.7.x series
        • ⚡v0.0.7.0 Beta Versions
      • 🌌v0.0.8.x series
      • 💌v0.0.9.x series
      • 📜v0.0.10.x series
      • ✏️v0.0.11.x series
      • ⚙️v0.0.12.x series
      • 🌐v0.0.13.x series
      • 🏃‍♀️v0.0.14.x series
      • ⏳v0.0.15.x series
      • ⭐v0.0.16.x series
      • 🌃v0.0.17.x series
      • 🥁v0.0.18.x series
      • 🔧v0.0.19.x series
      • 🍀v0.0.20.x series
      • 🧰v0.0.21.x series
      • 📱v0.0.22.x series
      • 🖥️v0.0.23.x series
      • 👾v0.0.24.x series
      • 🔮v0.1.x.x series
        • ⚠️Known issues for 0.1.0 Beta
    • 👍Compatibility Notes for KS API Revisions
      • 🔼Upgrading from API v1.0
      • 🔼Upgrading from API v1.1
      • 🔼Upgrading from API v1.2
      • 🔼Upgrading from API v1.3
      • 🔼Upgrading from API v2.0
      • 🔼Upgrading from API v2.1
      • 🔼Upgrading to API v3.0
        • ⬆️From 0.0.24.x to 0.1.0 Beta 1
        • ⬆️From 0.1.0 Beta 1 to 0.1.0 Beta 2
        • ⬆️From 0.1.0 Beta 2 to 0.1.0 Beta 3
        • ⬆️From 0.1.0 Beta 3 to 0.1.0 RC
        • ⬆️From 0.1.0 RC to 0.1.0 Final
  • Installation and Maintenance
    • 📀Installing the Kernel
      • 💻Windows
      • 🍎macOS
      • 🐧Linux
      • 📱Android
    • ⏫Upgrading the Kernel
      • 💻Windows
      • 🍎macOS
      • 🐧Linux
      • 📱Android
    • 📦Dependency Information
  • Fundamentals
    • 🌽What is the Kernel?
    • 👾What is Nitrocid KS?
    • ⭐Simulated Kernel Features
      • 🌟Extra Features
        • 🌏More Networking
          • 🗃️FTP Client
          • 🔒SFTP Client
          • 📰RSS Client
          • 🌐HTTP Client
          • 📧Mail Client
        • 🎮Games and Amusements
          • 🔤Hangman
          • 🏇BackRace
          • ☄️Meteor
          • 🎰Russian Roulette
          • ☄️ShipDuet
          • 🐍Snaker
          • 🔢Solver
          • ⌨️SpeedPress
          • 🔠Wordle
        • 🖊️More Editors
          • 🖊️JSON Editor
          • 🗄️SQL Editor
        • 🧰Common Programs
          • 📦Archive
          • ☕Caffeine
          • 🗓️Calendar
          • 🔢Calculator
          • 👥Contacts
          • 👩‍💻Git Shell
          • 🎧Music Player
          • 🗒️Notes
          • 🔌SSH Connection
          • ⏰Stopwatch and Timer
          • ☑️To-do List
          • ⚖️Unit Converter
          • ☀️Weather
        • 🖼️Docking
        • 🌏Language Studio
        • 🎨Theme Studio
      • 👤Accounts
        • 👥Groups
        • 🔓Permissions
      • ✏️Editors
        • 📝Text Editor
        • 💾Hex Editor
      • 🐚Shells
        • 📄Commands List
        • 📄Addon Commands List
      • 📂Files and Folders
      • 🌎Networking
      • 🇺🇸Languages
      • 🌌Screensavers
      • 💿Bootable Simulation
  • Advanced and Power Users
    • ⚒️Building the Kernel
      • 🪟Building on Windows
      • 🍎Building on macOS
      • 🐧Building on Linux
      • 📱Building on Android
    • 🧰Kernel Modifications
      • 🧪Building your Mod
      • 📉Analyzers for Mods
      • 📈Analyzer Diagnostics
        • 📉Text - NKS0001
        • 📉ConsoleBase - NKS0002
        • 📉ConsoleBase - NKS0003
        • 📉ConsoleBase - NKS0004
        • 📉ConsoleBase - NKS0005
        • 📉ConsoleBase - NKS0006
        • 📉ConsoleBase - NKS0007
        • 📉ConsoleBase - NKS0008
        • 📉ConsoleBase - NKS0009
        • 📉Files - NKS0010
        • 📉Files - NKS0011
        • 📉Files - NKS0012
        • 📉Files - NKS0013
        • 📉Files - NKS0014
        • 📉Files - NKS0015
        • 📉Files - NKS0016
        • 📉Files - NKS0017
        • 📉Files - NKS0018
        • 📉Files - NKS0019
        • 📉Files - NKS0020
        • 📉Files - NKS0021
        • 📉Files - NKS0022
        • 📉Files - NKS0023
        • 📉Kernel - NKS0024
        • 📉Kernel - NKS0025
        • 📉Kernel - NKS0026
        • 📉Kernel - NKS0027
        • 📉Kernel - NKS0031
        • 📉Kernel - NKS0032
        • 📉Kernel - NKS0033
        • 📉Kernel - NKS0037
        • 📉Kernel - NKS0038
        • 📉Kernel - NKS0039
        • 📉Kernel - NKS0040
        • 📉Kernel - NKS0041
        • 📉Kernel - NKS0042
        • 📉Kernel - NKS0043
        • 📉Kernel - NKS0052
        • 📉Kernel - NKS0053
        • 📉Languages - NKS0044
        • 📉Languages - NKS0045
        • 📉Languages - NKS0046
        • 📉Network - NKS0051
        • 📉Text - NKS0047
        • 📉Text - NKS0048
        • 📉Text - NKS0049
        • 📉Text - NKS0050
        • 📉Text - NKS0054
        • 📉Text - NKS0055
      • 🔧Kernel Modification Management
      • 📞Inter-Mod Communication
      • 📞Inter-Addon Communication
    • 🦠Diagnostics
      • 🔬Debugging
        • 🧬Local Debugging
        • 🛰️Remote Debugging
      • 🧪Testing
      • 💉Other Diagnostics
    • ⚒️Inner Workings
      • 🔧Kernel Settings
        • ⛏️Mechanics of Settings App
        • 🔩Settings Format
        • ⚙️Custom Settings
      • 🐚Shell Structure
        • ❔Help System
        • 🗜️Command Parsing
        • 🔋Command Information
        • ⏲️Command Switch Management
        • 🎚️Command Switch Information
        • ⏳Shell History
        • 📜Shell Scripting
        • 📟Shell Presets
        • 💠Extra Shell Features
      • 🌍Multilingual Kernel
        • 🌐Custom Languages
      • ♦️Inner Essentials
        • 🪧Kernel Placeholders
        • 🔐The Permissions
        • 👥The Users
        • 📞Kernel Threads
        • 🔌Kernel Drivers
        • 🎛️Kernel Arguments
        • 📒Kernel Journaling
        • 📡Remote Procedure
        • 🗃️Nitrocid Filesystem
        • 🌃Screensaver Internals
        • 💦Splash Internals
        • 🖥️Kernel Platform
        • 🎨Theme Internals
        • ⛱️Color Internals
        • 🔏Privacy Consents
        • 🔔System Notifications
        • ✉️MAL and MOTD
        • ⌛Progress Handlers
        • ✒️Assembly Signing
        • 🎰Random Number Generation
        • 🌍Network Tools
      • 🌀Miscellaneous APIs
  • 🧱Project Dependencies
  • Report an issue
  • Source code
  • API Reference
Powered by GitBook
On this page
  • Integer tools
  • File size conversion
  • Time tools
  • Time zones
  • Calendar management API
  • Date conversion API
  • Properties and Fields
  • Kernel version information
  • Writing to the console
  • Resetting colors
  • Alarms
  • Array tools
  • JSON Difference
Edit on GitHub
  1. Advanced and Power Users
  2. Inner Workings

Miscellaneous APIs

Other inner workings that don't fit with the inner essentials and might be useful for your mods

In addition to the essential APIs that are provided with the Nitrocid kernel that allow you to make awesome mods ranging from simple ones to the most complicated ones, Nitrocid provides some of the useful APIs that don't fit with the category but can be helpful when developing mods.

The following APIs can be used in your mods:

Integer tools

The Reflection part of the kernel contains a class, IntegerTools, that consists of useful integer tools from short numbers to 128-bit integer numbers to double-precision numbers, like converting literal file sizes in bytes to their human formats.

In addition to that, we've also placed useful extensions, such as converting the number of all kinds, short or long, to different number bases as strings, such as:

  • ToBinary()

  • ToOctal()

  • ToNumber()

  • ToHex()

File size conversion

SizeString() extension functions can be used when importing the Reflection namespace. This allows you to easily convert the file sizes from bytes to their human-readable format.

You can use these functions, once the above namespace is imported, like this:

MyModFuncs.cs
long bytes = 1024L * 1024 * 1024 * 1024;
string humanized = bytes.SizeString();
// Value of humanized: 1 TB

You can't use this function for enormous sizes, like 1 zettabytes, because of the limitation of the long integers. However, you shouldn't worry about this situation, since this is used generally for file sizes, and a single file in the world hasn't reached this size yet.

Time tools

Nitrocid KS provides you with various APIs that allow you to manage time and date and their components. Here are the following tools that you can use:

Time zones

Nitrocid KS provides a built-in timezone API that allows you to get information about a timezone and convert the time to the equivalent time using the specific timezone.

This API is found in the TimeZones class.

If the kernel-wide time zone is enabled, the current kernel time and date changes, depending on your selected kernel-wide time zone. Otherwise, the kernel uses the operating system time and date.

One of the functions that the above class implements is GetZoneTimeString() and its sibling functions, GetZoneTimeTimeString() and GetZoneTimeDateString().

  • The first function returns the full date and time using the specified time zone.

  • The second function returns the time using the specified time zone.

  • The third function returns the date using the specified time zone.

Calendar management API

In addition to providing the calendar command in the addon, the base Nitrocid API provides some of the calendar management APIs to make access to them easier than before. You can now get the calendar straight from the calendar type or its name using the GetCalendar() function from the CalendarTools class.

Additionally, the time and date renderers can be used with the base calendar class instance obtained from the above function.

While the events can be configured to be a yearly event, such as the Nitrocid KS release anniversary, such events have to be created by hand until the event commands are updated.

Date conversion API

Nitrocid API provides date conversion tools that allow you to change how the date and the time are being represented. For instance, you can translate the date and the time to UNIX time and vice versa.

As for the calendars, you can use the GetDateFromCalendar() function, provided that you have a calendar instance from the GetCalendar() function.

Alternatively, you can use the GetDateFromCalendarNoCulture() function for calendars with overridden Calendar property.

Properties and Fields

The Reflection part of the Nitrocid API provides you with options to access public properties and fields that are declared in the public classes dynamically.

  • PropertyManager manages properties, such as getting and setting property values.

  • FieldManager manages fields, such as getting and setting field values.

In addition to the functions available in the above two classes, you can get all fields and properties defined in all the kernel types using the following functions:

  • GetAllFields()

  • GetAllFieldsNoEvaluation()

  • GetAllProperties()

  • GetAllPropertiesNoEvaluation()

Kernel version information

You can get the kernel version information using the following properties from the KernelMain class:

  • Version: Gets the kernel version without the build specifiers

  • VersionFull: Gets the kernel version with the build specifiers (essentially the same as the GitHub tag for the release)

  • ApiVersion: Gets the kernel API version.

Writing to the console

The Writers namespace of the Nitrocid-specific ConsoleBase namespace contains the following three writer types:

  • TextWriters: Provides you with all the normal console writers with kernel color types.

  • TextFancyWriters: Provides you with all the fancy writers with kernel color types.

  • TextMiscWriters: Provides you with all the miscellaneous writers with kernel color types.

If you want to either plainly write text or with a custom color of your choice, consult the Terminaux guide for more information:

Resetting colors

If you need to reset the colors for further text to be written to the console in its natural colors, you can use the ResetColors() function in the ConsoleTools class to reset the foreground and the background colors to their defaults.

public static void ResetColors(bool useKernelColors = false)

Additionally, if you pass true to the useKernelColors parameter, the colors will be reset to the neutral text color for the foreground color and the kernel background color for the background color.

Alarms

When it comes to alarms, they are useful to alarm you for something at a specified time. This service and its tools can be accessed via the AlarmTools class.

public static class AlarmTools

You can start an alarm using the StartAlarm() function that lets you specify your alarm ID, your alarm name, and your alarm interval in seconds.

public static void StartAlarm(string alarmId, string alarmName, int alarmValue)

Additionally, you can stop an alarm before it's up using a function defined below:

public static void StopAlarm(int alarmIdx)
public static void StopAlarm(string alarmId)

Array tools

The array tools class provides you a wide range of tools for manipulating with arrays, such as array randomization, array sorting, and more.

To randomize arrays, the below two functions that do exactly the same thing under different implementations are available:

JSON Difference

The JSON difference finding tool can be accessed using the FindDifferences() function found in the JsonTools class. This allows you to find differences in addition and deletion of any JSON object. The difference tool returns the difference in the following format:

  • A JSON object with either a plus (+), an asterisk (*), or a minus (-) sign if the target object is an object.

  • A JSON object with either a plus (+) or a minus (-) sign listing differences in addition and deletion of array elements if the target object is an array.

  • A JSON object with a plus (+) sign indicating the target object and a minus (-) sign indicating the source object.

Last updated 1 year ago

RandomizeArray(): Uses the to randomly sort the array.

RandomizeArraySystem(): Uses the .NET 8.0 function from to randomly sort the array.

You can consult the for more array tools.

⚒️
🌀
Schwartzian transform
Shuffle()
Random
Nitrocid API Reference
Console WritersWe need to write to the console