UnicodeEmojiNet 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package UnicodeEmojiNet --version 1.1.0
NuGet\Install-Package UnicodeEmojiNet -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="UnicodeEmojiNet" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add UnicodeEmojiNet --version 1.1.0
#r "nuget: UnicodeEmojiNet, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install UnicodeEmojiNet as a Cake Addin
#addin nuget:?package=UnicodeEmojiNet&version=1.1.0

// Install UnicodeEmojiNet as a Cake Tool
#tool nuget:?package=UnicodeEmojiNet&version=1.1.0

UnicodeEmojiNet

Introduction

UnicodeEmojiNet allows to simply retrieve all Unicode emojis with their name and categories in C# either get them as a JSON string or as custom objects in a List.

Features ⭐

  • Retrieve Emojis: Retrieve emojis from the Unicode website.
    • As JSON string or as custom objects in a list
  • Retrieve emoji categories: Get all available categories (main and sub)
    • As custom objects in a list

Usage 🔧

Constructor

Initialize the EmojiManager using the constructor:

EmojiManager emojiManager = new EmojiManager(string operatingFolder, bool skipAdditional);
What is skipAdditional?

If skipAdditional is true, only the main-list will be queried and processed (https://unicode.org/emoji/charts/full-emoji-list.html) the other list(s) won't be used because they "only" contain variations like all skin tones, the main list only contains the yellow tone.

Code

Here are all available things you can do right now:

Check if the html files are present in the operatingFolder:

This method checks if the needed html files are present so it returns true or false.

bool AreHtmlFilesPresent = emojiManager.AreSourcesPresent();
Download html files and process those:

To download the needed emoji files and process them, you need to call this before you do anything else (or ensure the files are available). If this was called once and the files are present, it doesn't have to be run again.

emojiManager.DownloadAndProcessFiles();
Get all emoji categories as list:

Get all "MainCategories" (like "Animals" etc.) and their "SubCategories" (like "marine" etc.) which are inside the main ones.

List<EmojiCategory> AllCategories = emojiManager.GetAllCategories();
Give the JSON back as string:

Get the JSON as string object.

string EmojiListAsJson = emojiManager.GetEmojiListAsJsonString();
Give the json back as List<EmojiInfo>:

Get the emojis as List<EmojiInfo>.

List<EmojiInfo> EmojiList = emojiManager.GetEmojiList();
Example code:

Here is a example snippet to use the code.

static async Task Main(string[] args)
{
    const string workingDir = "/Users/WhAreYou/Desktop/";
    EmojiManager man = new EmojiManager(workingDir, false);

    if (man.AreSourcesPresent())
    {
        // Has to be called to fill all variables in the background
        await man.DownloadAndProcessFiles();

        List<EmojiInfo> emojis = await man.GetEmojiList();
        List<EmojiCategory> categories = await man.GetAllCategories();
    }
}

How to skip/speed-up source download:

  • You can download them yourself and put them in a folder
  • You can download them, pack them in a binary and copy them in a certain folder

.. you get it..

Types 🔖

  • EmojiInfo: The emoji itself

    • Id (a running number given by unicode) - int
    • Value (the emoji character) - string
    • Name (the name) - string
    • IsRecentlyAdded (is it a newly added emoji?) - bool
    • MainCategory (like animals) - string
    • SubCategory (like marine-animals) - string
  • EmojiCategory: A category in which emojis are sorted in

    • CategoryName (this is the name of the main-category) - string
    • SubCategories (the names of all sub-categories under this main-category) - string[]

FAQ

Q: How do you expect me to use this when it needs to download the html files?

A: I will think of something to make it easier, but for now you could download them yourself and them deliver them with your file and copy them to a "operatingFolder".

To-Do

  • Implement some caching and/or a faster way to download everything

License 📜

UnicodeEmojiNet is licensed under the GNU General Public License v3.0.

You can read the full license details of the GNU General Public License v3.0 here.

Icon

The icon was created by uxwing.com, found here: https://uxwing.com/smiling-line-icon/

Disclaimer and Acceptance ⚠️

By using this library, you acknowledge that you have read and understood the full disclaimer in the DISCLAIMER.md file and accept its terms. Additionally, you agree to abide by the GNU General Public License v3.0 under which UnicodeEmojiNet is licensed, regardless of whether you have read the license text.

Please be aware that the author of the project and the project itself are not endorsed by Unicode and do not reflect the views or opinions of Unicode or any individuals officially involved with the project. The author of this library is not responsible for any incorrect or inappropriate usage. Please ensure that you use this library in accordance with its intended purpose and guidelines.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.1 82 4/30/2024
1.2.0 73 4/29/2024
1.1.0 76 4/26/2024
1.0.0 86 4/25/2024

Added the main- and sub-categories, now they are sort- and filterable! Also I changed a few names and removed the creation of the JSON-file since it was useless.