mirror of
https://github.com/jstoddard/CWLibrary.git
synced 2025-12-06 03:02:00 +01:00
Added support for prosigns and a few more characters.
This commit is contained in:
parent
8e3e24de75
commit
0de0e9ac21
|
|
@ -48,10 +48,29 @@ namespace CWLibrary
|
|||
{ ".", ".-.-.-" },
|
||||
{ ",", "--..--" },
|
||||
{ "?", "..--.." },
|
||||
{ "'", ".----." },
|
||||
{ "/", "-..-." },
|
||||
{ "<AR>", ".-.-." },
|
||||
{ "<BK>", "-...-.-" },
|
||||
{ "<SK>", "...-.-" }
|
||||
{ "(", "-.--." },
|
||||
{ ")", "-.--.-" },
|
||||
{ ":", "---..." },
|
||||
{ ";", "-.-.-." },
|
||||
{ "=", "-...-" },
|
||||
{ "+", ".-.-." },
|
||||
{ "-", "-....-" },
|
||||
{ "\"", ".-..-." },
|
||||
{ "@", ".--.-." },
|
||||
// Prosigns -- see
|
||||
// http://en.wikipedia.org/wiki/Prosigns_for_Morse_code
|
||||
{ "<aa>", ".-.-" }, // Space down one line (new line)
|
||||
{ "<ar>", ".-.-." }, // Stop copying (end of message)
|
||||
{ "<as>", ".-..." }, // Stand by
|
||||
{ "<bk>", "-...-.-" }, // Break
|
||||
{ "<bt>", "-...-" }, // Space down two lines
|
||||
{ "<cl>", "-.-..-.." }, // Clear (going off the air)
|
||||
{ "<ct>", "-.-.-" }, // Start copying
|
||||
{ "<kn>", "-.--." }, // Go only
|
||||
{ "<sk>", "...-.-" }, // Silent key (going off the air)
|
||||
{ "<sn>", "...-." } // Understood
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,19 @@ namespace CWLibrary
|
|||
{
|
||||
if (i > 0)
|
||||
data.AddRange(GetInterCharSpace());
|
||||
data.AddRange(GetCharacter(word[i].ToString()));
|
||||
if (word[i] == '<')
|
||||
{
|
||||
// Prosign
|
||||
int end = word.IndexOf('>', i);
|
||||
if (end < 0)
|
||||
throw new ArgumentException();
|
||||
data.AddRange(GetCharacter(word.Substring(i, end + 1 - i)));
|
||||
i = end;
|
||||
}
|
||||
else
|
||||
{
|
||||
data.AddRange(GetCharacter(word[i].ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
return data.ToArray<short>();
|
||||
|
|
|
|||
Loading…
Reference in a new issue