L.MorseCodeTranslator 1.0.2.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package L.MorseCodeTranslator --version 1.0.2.2                
NuGet\Install-Package L.MorseCodeTranslator -Version 1.0.2.2                
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="L.MorseCodeTranslator" Version="1.0.2.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add L.MorseCodeTranslator --version 1.0.2.2                
#r "nuget: L.MorseCodeTranslator, 1.0.2.2"                
#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 L.MorseCodeTranslator as a Cake Addin
#addin nuget:?package=L.MorseCodeTranslator&version=1.0.2.2

// Install L.MorseCodeTranslator as a Cake Tool
#tool nuget:?package=L.MorseCodeTranslator&version=1.0.2.2                

C#

MorseCode-Translator

A small morsecode translator written in C# for general morsecode translation for a console app.

Description

This is the first version of version of my MorseCode-Translator containing simple convertions. It makes use of a flexible MorseCharCollection in which you can chose from plenty of characters to display. You can either start with the whole alphabet, only a few of them or completely new ones that are not defined yet (e.g dollar sign $).

The library offers:

  • Basic alphabet convertions from text-to-morse/morse-to-text
  • Basic alphabet soundfile creation aswell as output to console
  • Custom morsecharacter convertions from text-to-morse/morse-to-text
  • Custom morsecharacter soundfile creation aswell as output to console

Whats still in my toDo:

  • Morse-soundfile-to-text-conversion (Soundfile → MorseChar)

Installation

To install the library, you can use the NuGet-package market through visual studio or per NuGet package installer:

dotnet add package MorseCodeTranslator --version xxx

Or the build in version in Visual Studio:

NuGet\Install-Package MorseCodeTranslator -Version xxx

Newest version is listed here: https://www.nuget.org/packages/L.MorseCodeTranslator/

Usage

Depending on what you want to use you can go different routes.

Getting started

To make complete use of the MorseCode-Translator start by creating an instance of a MorseCodeTranslator:

MorseCodeTranslator translator = new MorseCodeTranslator();

The constructor with no parameters initializes all MorseChars from the alphabet inside of a MorseCharCollection. Alternatively you can create only a handful of MorseChars with custom MorseRepresentations:

List<MorseChar> morseList = new List<MorseChar>
{
    new MorseChar('n', "..."),
    new MorseChar('a',".--"),
    new MorseChar('h',".-.-")
};

MorseCharCollection morseCharCollection = new MorseCharCollection(morseList);
MorseCodeTranslator translator = new MorseCodeTranslator(morseCharCollection);
//use translator and or the collection from here on...

Once you've created a collection or a translator, you can now start using their methods for MorseConvertions or SoundFile convertions Keep in minde that if you chose to use only a handful of MorseChars, the MorseCodeTranslator wont have access to the specific soundfiles of the alphabet.

However, if there are only e.g. 3 chars inside the MorseCodeTranslator and you use any kind of convertion method, the MorseCodeTranslator refers back to the original MorseRepresentations (See examples).

MorseConvertions

First of all, you can convert the whole MorseCharCollection back into its MorseRepresentations and use it for example like so:

string[] morseRepresentations = morseCharCollection.ConvertToMorseCharRepresentation();
for (int i = 0; i < morseRepresentations.Length; i++)
{
    Console.WriteLine(morseRepresentations[i]);
}	
//Output with example MorseCharCollection from before
//...
//.--
//.-.-

Moreover, you can use the translator to for example read a string input and convert it to the MorseCharRepresentations:

while (true)
{
    Console.WriteLine("Type in some text: ");
    string input = Console.ReadLine();
    try
    {
        string[] inputToMorse = translator.ConvertStringToMorse(input);
        for (int i = 0; i < inputToMorse.Length; i++)
        {
            Console.WriteLine(inputToMorse[i]);
        }
    }
    catch (MorseCharNotFoundException ex)
    {
        Console.WriteLine("Wrong input: " + ex.Message);
    }
}
//input: Hello World
//

todo

Product Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.7.2

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.0 103 5/20/2024
1.1.1 374 2/2/2024
1.1.0 379 1/27/2024
1.0.2.4 403 1/21/2024
1.0.2.3 431 1/20/2024
1.0.2.2 395 1/20/2024
1.0.2.1 369 1/20/2024

Added documentation