General refactor.

This commit is contained in:
2018-03-07 18:56:12 +00:00
parent e9f4aae440
commit 967687dfd1
33 changed files with 637 additions and 587 deletions

View File

@@ -32,45 +32,46 @@ namespace Claunia.Encoding.Tests
public class ATASCII
{
const string Punctuations = "!\"#$%&'()*+,-./:;<=>?@[\\]^_|";
readonly byte[] PunctuationsBytes = { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E,
0x3F, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x7C };
const string Digits = "0123456789";
readonly byte[] DigitsBytes = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 };
const string UpperLatin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
readonly byte[] UpperLatinBytes = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
0x55, 0x56, 0x57, 0x58, 0x59, 0x5A };
readonly byte[] PunctuationsBytes =
{
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x3A, 0x3B, 0x3C,
0x3D, 0x3E, 0x3F, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x7C
};
const string Digits = "0123456789";
readonly byte[] DigitsBytes = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39};
const string UpperLatin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
readonly byte[] UpperLatinBytes =
{
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52,
0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A
};
const string LowerLatin = "abcdefghijklmnopqrstuvwxyz";
readonly byte[] LowerLatinBytes = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74,
0x75, 0x76, 0x77, 0x78, 0x79, 0x7A };
readonly byte[] LowerLatinBytes =
{
0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72,
0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A
};
const string Graphics = "├┘┤┐╱╲◢▗◣▝▘▂▖┌─┼●▄▎┬┴▌└";
readonly byte[] GraphicsBytes = { 0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1A};
const string Arrows = "↑↓←→↰◀▶";
readonly byte[] ArrowsBytes = { 0x1C, 0x1D, 0x1E, 0x1F, 0x7D, 0x7E, 0x7F };
const string Decks = "♥♣♦♠";
readonly byte[] DecksBytes = { 0x00, 0x10, 0x60, 0x7B };
readonly byte[] GraphicsBytes =
{
0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, 0x12, 0x13, 0x14, 0x15,
0x16, 0x17, 0x18, 0x19, 0x1A
};
const string Arrows = "↑↓←→↰◀▶";
readonly byte[] ArrowsBytes = {0x1C, 0x1D, 0x1E, 0x1F, 0x7D, 0x7E, 0x7F};
const string Decks = "♥♣♦♠";
readonly byte[] DecksBytes = {0x00, 0x10, 0x60, 0x7B};
[Test]
public void UnicodeToAtari()
public void AtariPangrams()
{
byte[] byteArray;
string testString;
byteArray = Encoding.AtariEncoding.GetBytes(Punctuations);
Assert.AreEqual(PunctuationsBytes, byteArray);
byteArray = Encoding.AtariEncoding.GetBytes(Digits);
Assert.AreEqual(DigitsBytes, byteArray);
byteArray = Encoding.AtariEncoding.GetBytes(UpperLatin);
Assert.AreEqual(UpperLatinBytes, byteArray);
byteArray = Encoding.AtariEncoding.GetBytes(LowerLatin);
Assert.AreEqual(LowerLatinBytes, byteArray);
byteArray = Encoding.AtariEncoding.GetBytes(Graphics);
Assert.AreEqual(GraphicsBytes, byteArray);
byteArray = Encoding.AtariEncoding.GetBytes(Arrows);
Assert.AreEqual(ArrowsBytes, byteArray);
byteArray = Encoding.AtariEncoding.GetBytes(Decks);
Assert.AreEqual(DecksBytes, byteArray);
byteArray = Encoding.AtariEncoding.GetBytes(Pangrams.English);
testString = Encoding.AtariEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.English, testString);
}
[Test]
@@ -96,14 +97,25 @@ namespace Claunia.Encoding.Tests
}
[Test]
public void AtariPangrams()
public void UnicodeToAtari()
{
byte[] byteArray;
string testString;
byteArray = Encoding.AtariEncoding.GetBytes(Pangrams.English);
testString = Encoding.AtariEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.English, testString);
byteArray = Encoding.AtariEncoding.GetBytes(Punctuations);
Assert.AreEqual(PunctuationsBytes, byteArray);
byteArray = Encoding.AtariEncoding.GetBytes(Digits);
Assert.AreEqual(DigitsBytes, byteArray);
byteArray = Encoding.AtariEncoding.GetBytes(UpperLatin);
Assert.AreEqual(UpperLatinBytes, byteArray);
byteArray = Encoding.AtariEncoding.GetBytes(LowerLatin);
Assert.AreEqual(LowerLatinBytes, byteArray);
byteArray = Encoding.AtariEncoding.GetBytes(Graphics);
Assert.AreEqual(GraphicsBytes, byteArray);
byteArray = Encoding.AtariEncoding.GetBytes(Arrows);
Assert.AreEqual(ArrowsBytes, byteArray);
byteArray = Encoding.AtariEncoding.GetBytes(Decks);
Assert.AreEqual(DecksBytes, byteArray);
}
}
}

View File

@@ -25,7 +25,6 @@
// THE SOFTWARE.
using NUnit.Framework;
using System.Runtime.InteropServices;
namespace Claunia.Encoding.Tests
{
@@ -33,44 +32,153 @@ namespace Claunia.Encoding.Tests
public class AtariST
{
const string Punctuations = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
readonly byte[] PunctuationsBytes = { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E,
0x3F, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x7B, 0x7C, 0x7D, 0x7E };
const string Digits = "0123456789";
readonly byte[] DigitsBytes = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 };
const string UpperLatin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
readonly byte[] UpperLatinBytes = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
0x55, 0x56, 0x57, 0x58, 0x59, 0x5A };
readonly byte[] PunctuationsBytes =
{
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x3A, 0x3B, 0x3C,
0x3D, 0x3E, 0x3F, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x7B, 0x7C, 0x7D, 0x7E
};
const string Digits = "0123456789";
readonly byte[] DigitsBytes = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39};
const string UpperLatin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
readonly byte[] UpperLatinBytes =
{
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52,
0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A
};
const string LowerLatin = "abcdefghijklmnopqrstuvwxyz";
readonly byte[] LowerLatinBytes = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74,
0x75, 0x76, 0x77, 0x78, 0x79, 0x7A };
readonly byte[] LowerLatinBytes =
{
0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72,
0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A
};
const string Spanish = "¡¿áéíóúüñÉÜÑ";
readonly byte[] SpanishBytes = { 0xAD, 0xA8, 0xA0, 0x82, 0xA1, 0xA2, 0xA3, 0x81, 0xA4, 0x90, 0x9A, 0xA5 };
const string French = "éÉàèùÀâêîôûëïüÿçÇœŒæÆ";
readonly byte[] FrenchBytes = { 0x82, 0x90, 0x85, 0x8A, 0x97, 0xB6, 0x83, 0x88, 0x8C, 0x93, 0x96, 0x89, 0x8B, 0x81, 0x98, 0x87, 0x80, 0xB4, 0xB5, 0x91, 0x92 };
const string German = "äöüßÄÖÜ";
readonly byte[] GermanBytes = { 0x84, 0x94, 0x81, 0x9E, 0x8E, 0x99, 0x9A };
const string Norwegian = "æøåÆØÅ";
readonly byte[] NorwegianBytes = { 0x91, 0xB3, 0x86, 0x92, 0xB2, 0x8F };
const string Portuguese = "áéíóúÉâêôãõÃÕçÇ";
readonly byte[] PortugueseBytes = { 0xA0, 0x82, 0xA1, 0xA2, 0xA3, 0x90, 0x83, 0x88, 0x93, 0xB0, 0xB1, 0xB7, 0xB8, 0x87, 0x80 };
const string Dutch = "ijIJ";
readonly byte[] DutchBytes = { 0xC0, 0xC1 };
const string Hebrew = "אבגדהוזחטיכלמנסעפצקרשתןךםףץ";
readonly byte[] HebrewBytes = { 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,
0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC};
const string Greek = "αβΓπΣσµτΦΘΩδ¯";
readonly byte[] GreekBytes = { 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xFF };
const string Spanish = "¡¿áéíóúüñÉÜÑ";
readonly byte[] SpanishBytes = {0xAD, 0xA8, 0xA0, 0x82, 0xA1, 0xA2, 0xA3, 0x81, 0xA4, 0x90, 0x9A, 0xA5};
const string French = "éÉàèùÀâêîôûëïüÿçÇœŒæÆ";
readonly byte[] FrenchBytes =
{
0x82, 0x90, 0x85, 0x8A, 0x97, 0xB6, 0x83, 0x88, 0x8C, 0x93, 0x96, 0x89, 0x8B, 0x81, 0x98, 0x87, 0x80, 0xB4,
0xB5, 0x91, 0x92
};
const string German = "äöüßÄÖÜ";
readonly byte[] GermanBytes = {0x84, 0x94, 0x81, 0x9E, 0x8E, 0x99, 0x9A};
const string Norwegian = "æøåÆØÅ";
readonly byte[] NorwegianBytes = {0x91, 0xB3, 0x86, 0x92, 0xB2, 0x8F};
const string Portuguese = "áéíóúÉâêôãõÃÕçÇ";
readonly byte[] PortugueseBytes =
{0xA0, 0x82, 0xA1, 0xA2, 0xA3, 0x90, 0x83, 0x88, 0x93, 0xB0, 0xB1, 0xB7, 0xB8, 0x87, 0x80};
const string Dutch = "ijIJ";
readonly byte[] DutchBytes = {0xC0, 0xC1};
const string Hebrew = "אבגדהוזחטיכלמנסעפצקרשתןךםףץ";
readonly byte[] HebrewBytes =
{
0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3,
0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC
};
const string Greek = "αβΓπΣσµτΦΘΩδ¯";
readonly byte[] GreekBytes = {0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xFF};
const string Typographic = "ªº«»¨´†¶©®™§°∙·";
readonly byte[] TypographicBytes = { 0xA6, 0xA7, 0xAE, 0xAF, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xDD, 0xF8, 0xF9, 0xFA };
const string Currency = "¢£¥ƒ";
readonly byte[] CurrencyBytes = { 0x9B, 0x9C, 0x9D, 0x9F };
const string Mathematics = "⌐¬½¼∧∞∮ϕ∈∩≡±≥≤⌠⌡÷≈√ⁿ²³";
readonly byte[] MathematicsBytes = { 0xA9, 0xAA, 0xAB, 0xAC, 0xDE, 0xDF, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xFB, 0xFC,
0xFD, 0xFE};
const string Symbols = "⇧⇩⇨⇦❎✓♪ə";
readonly byte[] SymbolsBytes = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x08, 0x0B, 0x1A };
readonly byte[] TypographicBytes =
{0xA6, 0xA7, 0xAE, 0xAF, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xDD, 0xF8, 0xF9, 0xFA};
const string Currency = "¢£¥ƒ";
readonly byte[] CurrencyBytes = {0x9B, 0x9C, 0x9D, 0x9F};
const string Mathematics = "⌐¬½¼∧∞∮ϕ∈∩≡±≥≤⌠⌡÷≈√ⁿ²³";
readonly byte[] MathematicsBytes =
{
0xA9, 0xAA, 0xAB, 0xAC, 0xDE, 0xDF, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
0xFB, 0xFC, 0xFD, 0xFE
};
const string Symbols = "⇧⇩⇨⇦❎✓♪ə";
readonly byte[] SymbolsBytes = {0x01, 0x02, 0x03, 0x04, 0x05, 0x08, 0x0B, 0x1A};
[Test]
public void AtariSTPangrams()
{
byte[] byteArray;
string testString;
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Basque);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Basque, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Danish);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Danish, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.English);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.English, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Finnish);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Finnish, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.French);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.French, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Galician);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Galician, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.German);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.German, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Hebrew);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Hebrew, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Norwegian);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Norwegian, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Portuguese);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Portuguese, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Spanish);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Spanish, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Swedish);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Swedish, testString);
}
[Test]
public void AtariSTToUnicode()
{
string testString;
testString = Encoding.AtariSTEncoding.GetString(PunctuationsBytes);
Assert.AreEqual(Punctuations, testString);
testString = Encoding.AtariSTEncoding.GetString(DigitsBytes);
Assert.AreEqual(Digits, testString);
testString = Encoding.AtariSTEncoding.GetString(UpperLatinBytes);
Assert.AreEqual(UpperLatin, testString);
testString = Encoding.AtariSTEncoding.GetString(LowerLatinBytes);
Assert.AreEqual(LowerLatin, testString);
testString = Encoding.AtariSTEncoding.GetString(SpanishBytes);
Assert.AreEqual(Spanish, testString);
testString = Encoding.AtariSTEncoding.GetString(FrenchBytes);
Assert.AreEqual(French, testString);
testString = Encoding.AtariSTEncoding.GetString(GermanBytes);
Assert.AreEqual(German, testString);
testString = Encoding.AtariSTEncoding.GetString(NorwegianBytes);
Assert.AreEqual(Norwegian, testString);
testString = Encoding.AtariSTEncoding.GetString(PortugueseBytes);
Assert.AreEqual(Portuguese, testString);
testString = Encoding.AtariSTEncoding.GetString(DutchBytes);
Assert.AreEqual(Dutch, testString);
testString = Encoding.AtariSTEncoding.GetString(HebrewBytes);
Assert.AreEqual(Hebrew, testString);
testString = Encoding.AtariSTEncoding.GetString(GreekBytes);
Assert.AreEqual(Greek, testString);
testString = Encoding.AtariSTEncoding.GetString(TypographicBytes);
Assert.AreEqual(Typographic, testString);
testString = Encoding.AtariSTEncoding.GetString(CurrencyBytes);
Assert.AreEqual(Currency, testString);
testString = Encoding.AtariSTEncoding.GetString(MathematicsBytes);
Assert.AreEqual(Mathematics, testString);
testString = Encoding.AtariSTEncoding.GetString(SymbolsBytes);
Assert.AreEqual(Symbols, testString);
// TODO: 0x09 => U+1F552, 0x0A => U+1F514
/*testString = Encoding.AtariSTEncoding.GetString(SymbolsUnicode32Bytes);
Assert.AreEqual(SymbolsUnicode32, testString);*/
}
// TODO: 0x09 => U+1F552, 0x0A => U+1F514
/*const string SymbolsUnicode32 = "\ud83d\udd52\ud83d\udd14";
readonly byte[] SymbolsUnicode32Bytes = { 0x09, 0x0A };*/
@@ -118,93 +226,5 @@ namespace Claunia.Encoding.Tests
/*byteArray = Encoding.AtariSTEncoding.GetBytes(SymbolsUnicode32);
Assert.AreEqual(SymbolsUnicode32Bytes, byteArray);*/
}
[Test]
public void AtariSTToUnicode()
{
string testString;
testString = Encoding.AtariSTEncoding.GetString(PunctuationsBytes);
Assert.AreEqual(Punctuations, testString);
testString = Encoding.AtariSTEncoding.GetString(DigitsBytes);
Assert.AreEqual(Digits, testString);
testString = Encoding.AtariSTEncoding.GetString(UpperLatinBytes);
Assert.AreEqual(UpperLatin, testString);
testString = Encoding.AtariSTEncoding.GetString(LowerLatinBytes);
Assert.AreEqual(LowerLatin, testString);
testString = Encoding.AtariSTEncoding.GetString(SpanishBytes);
Assert.AreEqual(Spanish, testString);
testString = Encoding.AtariSTEncoding.GetString(FrenchBytes);
Assert.AreEqual(French, testString);
testString = Encoding.AtariSTEncoding.GetString(GermanBytes);
Assert.AreEqual(German, testString);
testString = Encoding.AtariSTEncoding.GetString(NorwegianBytes);
Assert.AreEqual(Norwegian, testString);
testString = Encoding.AtariSTEncoding.GetString(PortugueseBytes);
Assert.AreEqual(Portuguese, testString);
testString = Encoding.AtariSTEncoding.GetString(DutchBytes);
Assert.AreEqual(Dutch, testString);
testString = Encoding.AtariSTEncoding.GetString(HebrewBytes);
Assert.AreEqual(Hebrew, testString);
testString = Encoding.AtariSTEncoding.GetString(GreekBytes);
Assert.AreEqual(Greek, testString);
testString = Encoding.AtariSTEncoding.GetString(TypographicBytes);
Assert.AreEqual(Typographic, testString);
testString = Encoding.AtariSTEncoding.GetString(CurrencyBytes);
Assert.AreEqual(Currency, testString);
testString = Encoding.AtariSTEncoding.GetString(MathematicsBytes);
Assert.AreEqual(Mathematics, testString);
testString = Encoding.AtariSTEncoding.GetString(SymbolsBytes);
Assert.AreEqual(Symbols, testString);
// TODO: 0x09 => U+1F552, 0x0A => U+1F514
/*testString = Encoding.AtariSTEncoding.GetString(SymbolsUnicode32Bytes);
Assert.AreEqual(SymbolsUnicode32, testString);*/
}
[Test]
public void AtariSTPangrams()
{
byte[] byteArray;
string testString;
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Basque);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Basque, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Danish);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Danish, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.English);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.English, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Finnish);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Finnish, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.French);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.French, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Galician);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Galician, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.German);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.German, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Hebrew);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Hebrew, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Norwegian);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Norwegian, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Portuguese);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Portuguese, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Spanish);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Spanish, testString);
byteArray = Encoding.AtariSTEncoding.GetBytes(Pangrams.Swedish);
testString = Encoding.AtariSTEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Swedish, testString);
}
}
}

View File

@@ -23,48 +23,49 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using NUnit.Framework;
namespace Claunia.Encoding.Tests
{
[TestFixture]
public class GetEncs
[TestFixture]
public class GetEncs
{
[Test]
// Well basically this is taken from MSDN's documentation :p
public void GetAllEncs()
[Test]
// Well basically this is taken from MSDN's documentation :p
public void GetAllEncs()
{
// Print the header.
Console.Write("CodePage identifier and name ");
Console.Write("BrDisp BrSave ");
Console.Write("MNDisp MNSave ");
Console.WriteLine("1-Byte ReadOnly ");
// Print the header.
Console.Write("CodePage identifier and name ");
Console.Write("BrDisp BrSave ");
Console.Write("MNDisp MNSave ");
Console.WriteLine("1-Byte ReadOnly ");
// For every encoding, get the property values.
foreach(EncodingInfo ei in Encoding.GetEncodings())
// For every encoding, get the property values.
foreach(EncodingInfo ei in Encoding.GetEncodings())
{
Encoding e = ei.GetEncoding();
Encoding e = ei.GetEncoding();
Console.Write("{0,-6} {1,-25} ", ei.CodePage, ei.Name);
Console.Write("{0,-8} {1,-8} ", e.IsBrowserDisplay, e.IsBrowserSave);
Console.Write("{0,-8} {1,-8} ", e.IsMailNewsDisplay, e.IsMailNewsSave);
Console.WriteLine("{0,-8} {1,-8} ", e.IsSingleByte, e.IsReadOnly);
Console.Write("{0,-6} {1,-25} ", ei.CodePage, ei.Name);
Console.Write("{0,-8} {1,-8} ", e.IsBrowserDisplay, e.IsBrowserSave);
Console.Write("{0,-8} {1,-8} ", e.IsMailNewsDisplay, e.IsMailNewsSave);
Console.WriteLine("{0,-8} {1,-8} ", e.IsSingleByte, e.IsReadOnly);
}
}
[Test]
// Well basically this is taken from MSDN's documentation :p
public void GetInternalEncoding()
{
System.Text.Encoding e = Encoding.GetEncoding("lisa");
}
[Test]
// Well basically this is taken from MSDN's documentation :p
public void GetExternalEncoding()
{
System.Text.Encoding e = Encoding.GetEncoding("shift_jis");
}
}
[Test]
// Well basically this is taken from MSDN's documentation :p
public void GetInternalEncoding()
{
System.Text.Encoding e = Encoding.GetEncoding("lisa");
}
}
}

View File

@@ -32,66 +32,102 @@ namespace Claunia.Encoding.Tests
public class LisaRoman
{
const string Punctuations = "!\"#$%&()*+,-./:;<=>?@[\\]^_{|}~";
readonly byte[] PunctuationsBytes = { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E,
0x3F, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x7B, 0x7C, 0x7D, 0x7E };
const string Digits = "0123456789";
readonly byte[] DigitsBytes = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 };
const string UpperLatin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
readonly byte[] UpperLatinBytes = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
0x55, 0x56, 0x57, 0x58, 0x59, 0x5A };
readonly byte[] PunctuationsBytes =
{
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x3A, 0x3B, 0x3C, 0x3D,
0x3E, 0x3F, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x7B, 0x7C, 0x7D, 0x7E
};
const string Digits = "0123456789";
readonly byte[] DigitsBytes = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39};
const string UpperLatin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
readonly byte[] UpperLatinBytes =
{
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52,
0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A
};
const string LowerLatin = "abcdefghijklmnopqrstuvwxyz";
readonly byte[] LowerLatinBytes = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74,
0x75, 0x76, 0x77, 0x78, 0x79, 0x7A };
readonly byte[] LowerLatinBytes =
{
0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72,
0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A
};
const string Spanish = "¡¿áéíóúüñÉÜÑ";
readonly byte[] SpanishBytes = { 0xC1, 0xC0, 0x87, 0x8E, 0x92, 0x97, 0x9C, 0x9F, 0x96, 0x83, 0x86, 0x84 };
const string French = "éÉàèùÀâêîôûëïüÿçÇœŒæÆ";
readonly byte[] FrenchBytes = { 0x8E, 0x83, 0x88, 0x8F, 0x9D, 0xCB, 0x89, 0x90, 0x94, 0x99, 0x9E, 0x91, 0x95, 0x9F, 0xD8, 0x8D, 0x82, 0xCF, 0xCE, 0xBE, 0xAE };
const string German = "äöüßÄÖÜ";
readonly byte[] GermanBytes = { 0x8A, 0x9A, 0x9F, 0xA7, 0x80, 0x85, 0x86 };
const string Norwegian = "æøåÆØÅ";
readonly byte[] NorwegianBytes = { 0xBE, 0xBF, 0x8C, 0xAE, 0xAF, 0x81 };
const string Portuguese = "áéíóúÉâêôãõÃÕçÇ";
readonly byte[] PortugueseBytes = { 0x87, 0x8E, 0x92, 0x97, 0x9C, 0x83, 0x89, 0x90, 0x99, 0x8B, 0x9B, 0xCC, 0xCD, 0x8D, 0x82 };
const string Spanish = "¡¿áéíóúüñÉÜÑ";
readonly byte[] SpanishBytes = {0xC1, 0xC0, 0x87, 0x8E, 0x92, 0x97, 0x9C, 0x9F, 0x96, 0x83, 0x86, 0x84};
const string French = "éÉàèùÀâêîôûëïüÿçÇœŒæÆ";
readonly byte[] FrenchBytes =
{
0x8E, 0x83, 0x88, 0x8F, 0x9D, 0xCB, 0x89, 0x90, 0x94, 0x99, 0x9E, 0x91, 0x95, 0x9F, 0xD8, 0x8D, 0x82, 0xCF,
0xCE, 0xBE, 0xAE
};
const string German = "äöüßÄÖÜ";
readonly byte[] GermanBytes = {0x8A, 0x9A, 0x9F, 0xA7, 0x80, 0x85, 0x86};
const string Norwegian = "æøåÆØÅ";
readonly byte[] NorwegianBytes = {0xBE, 0xBF, 0x8C, 0xAE, 0xAF, 0x81};
const string Portuguese = "áéíóúÉâêôãõÃÕçÇ";
readonly byte[] PortugueseBytes =
{0x87, 0x8E, 0x92, 0x97, 0x9C, 0x83, 0x89, 0x90, 0x99, 0x8B, 0x9B, 0xCC, 0xCD, 0x8D, 0x82};
const string Typographic = "†°•¶®©™´¨ªº«»…–—“”‘’§";
readonly byte[] TypographicBytes = { 0xA0, 0xA1, 0xA5, 0xA6, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xBB, 0xBC, 0xC7, 0xC8, 0xC9, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xA4};
const string Currency = "¢£¥";
readonly byte[] CurrencyBytes = { 0xA2, 0xA3, 0xB4 };
const string Mathematics = "≠∞±≤≥µ∂∑∏π∫Ω¬√ƒ≈∆÷◊";
readonly byte[] MathematicsBytes = { 0xAD, 0xB0, 0xB1, 0xB2, 0xB3, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBD, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xD6, 0xD7 };
readonly byte[] TypographicBytes =
{
0xA0, 0xA1, 0xA5, 0xA6, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xBB, 0xBC, 0xC7, 0xC8, 0xC9, 0xD0, 0xD1, 0xD2, 0xD3,
0xD4, 0xD5, 0xA4
};
const string Currency = "¢£¥";
readonly byte[] CurrencyBytes = {0xA2, 0xA3, 0xB4};
const string Mathematics = "≠∞±≤≥µ∂∑∏π∫Ω¬√ƒ≈∆÷◊";
readonly byte[] MathematicsBytes =
{
0xAD, 0xB0, 0xB1, 0xB2, 0xB3, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBD, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xD6,
0xD7
};
[Test]
public void UnicodeToLisa()
public void LisaPangrams()
{
byte[] byteArray;
string testString;
byteArray = Encoding.LisaEncoding.GetBytes(Punctuations);
Assert.AreEqual(PunctuationsBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Digits);
Assert.AreEqual(DigitsBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(UpperLatin);
Assert.AreEqual(UpperLatinBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(LowerLatin);
Assert.AreEqual(LowerLatinBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Spanish);
Assert.AreEqual(SpanishBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(French);
Assert.AreEqual(FrenchBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(German);
Assert.AreEqual(GermanBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Norwegian);
Assert.AreEqual(NorwegianBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Portuguese);
Assert.AreEqual(PortugueseBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Typographic);
Assert.AreEqual(TypographicBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Currency);
Assert.AreEqual(CurrencyBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Mathematics);
Assert.AreEqual(MathematicsBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Basque);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Basque, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Breton);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Breton, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Danish);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Danish, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Dutch);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Dutch, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.English);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.English, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Finnish);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Finnish, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.French);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.French, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Galician);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Galician, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.German);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.German, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Norwegian);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Norwegian, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Portuguese);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Portuguese, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Spanish);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Spanish, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Swedish);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Swedish, testString);
}
[Test]
@@ -128,50 +164,36 @@ namespace Claunia.Encoding.Tests
}
[Test]
public void LisaPangrams()
public void UnicodeToLisa()
{
byte[] byteArray;
string testString;
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Basque);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Basque, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Breton);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Breton, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Danish);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Danish, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Dutch);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Dutch, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.English);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.English, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Finnish);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Finnish, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.French);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.French, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Galician);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Galician, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.German);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.German, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Norwegian);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Norwegian, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Portuguese);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Portuguese, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Spanish);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Spanish, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Pangrams.Swedish);
testString = Encoding.LisaEncoding.GetString(byteArray);
Assert.AreEqual(Pangrams.Swedish, testString);
byteArray = Encoding.LisaEncoding.GetBytes(Punctuations);
Assert.AreEqual(PunctuationsBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Digits);
Assert.AreEqual(DigitsBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(UpperLatin);
Assert.AreEqual(UpperLatinBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(LowerLatin);
Assert.AreEqual(LowerLatinBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Spanish);
Assert.AreEqual(SpanishBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(French);
Assert.AreEqual(FrenchBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(German);
Assert.AreEqual(GermanBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Norwegian);
Assert.AreEqual(NorwegianBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Portuguese);
Assert.AreEqual(PortugueseBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Typographic);
Assert.AreEqual(TypographicBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Currency);
Assert.AreEqual(CurrencyBytes, byteArray);
byteArray = Encoding.LisaEncoding.GetBytes(Mathematics);
Assert.AreEqual(MathematicsBytes, byteArray);
}
}
}

View File

@@ -31,9 +31,9 @@ namespace Claunia.Encoding.Tests
[TestFixture]
public class Radix50
{
const string Punctuations = " .$%";
const string Punctuations = " .$%";
readonly byte[] PunctuationsBytes = {0b00000001, 0b11000110, 0b11011101};
const string Digits = "0123456789";
const string Digits = "0123456789";
readonly byte[] DigitsBytes =
{0b01111001, 0b11111000, 0b00100001, 0b10001010, 0b00111001, 0b00100101, 0b10011010, 0b01110000};
const string UpperLatin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -43,7 +43,7 @@ namespace Claunia.Encoding.Tests
0b00110100, 0b11100011, 0b11010000, 0b01000101, 0b00100100, 0b11010100, 0b01010101, 0b01100101, 0b11011000,
0b01100101, 0b10100000
};
const string Sentence = "THIS IS A TEST$";
const string Sentence = "THIS IS A TEST$";
const string SentencePadded = "THIS IS A TEST$ "; // It gets space padded when decoding is not multiple
readonly byte[] SentenceBytes =
{

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class ATASCII : Encoding
{
const string _bodyname = "atascii";
const int _codepage = 0;
const string _encodingname = "Atari Standard Code for Information Interchange";
const string _headername = "atascii";
const string _webname = "";
const int _windowsCodepage = 0;
const string _bodyname = "atascii";
const int _codepage = 0;
const string _encodingname = "Atari Standard Code for Information Interchange";
const string _headername = "atascii";
const string _webname = "";
const int _windowsCodepage = 0;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
/// <summary>
/// The ATASCII to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class Apple2 : Encoding
{
const string _bodyname = "apple2";
const int _codepage = 0;
const string _encodingname = "Western European (Apple II)";
const string _headername = "apple2";
const string _webname = "";
const int _windowsCodepage = 0;
const string _bodyname = "apple2";
const int _codepage = 0;
const string _encodingname = "Western European (Apple II)";
const string _headername = "apple2";
const string _webname = "";
const int _windowsCodepage = 0;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
/// <summary>
/// The Apple II to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class Apple2c : Encoding
{
const string _bodyname = "apple2c";
const int _codepage = 0;
const string _encodingname = "Western European (Apple IIc)";
const string _headername = "apple2c";
const string _webname = "";
const int _windowsCodepage = 0;
const string _bodyname = "apple2c";
const int _codepage = 0;
const string _encodingname = "Western European (Apple IIc)";
const string _headername = "apple2c";
const string _webname = "";
const int _windowsCodepage = 0;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
/// <summary>
/// The Apple IIc to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class Apple2e : Encoding
{
const string _bodyname = "apple2e";
const int _codepage = 0;
const string _encodingname = "Western European (Apple IIe)";
const string _headername = "apple2e";
const string _webname = "";
const int _windowsCodepage = 0;
const string _bodyname = "apple2e";
const int _codepage = 0;
const string _encodingname = "Western European (Apple IIe)";
const string _headername = "apple2e";
const string _webname = "";
const int _windowsCodepage = 0;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
/// <summary>
/// The Apple IIe to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class Apple2gs : Encoding
{
const string _bodyname = "apple2gs";
const int _codepage = 0;
const string _encodingname = "Western European (Apple IIgs)";
const string _headername = "apple2gs";
const string _webname = "";
const int _windowsCodepage = 0;
const string _bodyname = "apple2gs";
const int _codepage = 0;
const string _encodingname = "Western European (Apple IIgs)";
const string _headername = "apple2gs";
const string _webname = "";
const int _windowsCodepage = 0;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
/// <summary>
/// The Apple IIgs to Unicode character map.

View File

@@ -34,19 +34,19 @@ namespace Claunia.Encoding
// TODO: 0x09 => U+1F552, 0x0A => U+1F514
public class AtariST : Encoding
{
const string _bodyname = "atarist";
const int _codepage = 0;
const string _encodingname = "Western European (Atari ST)";
const string _headername = "atarist";
const string _webname = "";
const int _windowsCodepage = 0;
const string _bodyname = "atarist";
const int _codepage = 0;
const string _encodingname = "Western European (Atari ST)";
const string _headername = "atarist";
const string _webname = "";
const int _windowsCodepage = 0;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
/// <summary>
/// The Atari ST to Unicode character map.

View File

@@ -132,7 +132,7 @@ namespace Claunia.Encoding
where type.IsSubclassOf(typeof(Encoding))
let encoding = (Encoding)type.GetConstructor(new Type[] { }).Invoke(new object[] { })
select new EncodingInfo(encoding.CodePage, encoding.BodyName, encoding.EncodingName, false, type))
.ToArray();
.ToArray();
}
/// <summary>

View File

@@ -14,14 +14,14 @@ namespace Claunia.Encoding
bool isSystem;
Type thisType;
internal EncodingInfo(int codePage, string name, string displayName, bool system = true,
internal EncodingInfo(int codePage, string name, string displayName, bool system = true,
Type internalType = null)
{
CodePage = codePage;
Name = name;
CodePage = codePage;
Name = name;
DisplayName = displayName;
isSystem = system;
thisType = internalType;
isSystem = system;
thisType = internalType;
}
/// <summary>

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class Gem : Encoding
{
const string _bodyname = "gem";
const int _codepage = 0;
const string _encodingname = "Western European (GEM)";
const string _headername = "gem";
const string _webname = "";
const int _windowsCodepage = 0;
const string _bodyname = "gem";
const int _codepage = 0;
const string _encodingname = "Western European (GEM)";
const string _headername = "gem";
const string _webname = "";
const int _windowsCodepage = 0;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
/// <summary>
/// The GEM to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class LisaRoman : Encoding
{
const string _bodyname = "lisa";
const int _codepage = 0;
const string _encodingname = "Western European (Apple Lisa)";
const string _headername = "lisa";
const string _webname = "";
const int _windowsCodepage = 10000;
const string _bodyname = "lisa";
const int _codepage = 0;
const string _encodingname = "Western European (Apple Lisa)";
const string _headername = "lisa";
const string _webname = "";
const int _windowsCodepage = 10000;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
/// <summary>
/// The Lisa to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class MacArabic : Encoding
{
const string _bodyname = "x-mac-arabic";
const int _codepage = 10004;
const string _encodingname = "Arabic (Mac)";
const string _headername = "x-mac-arabic";
const string _webname = "x-mac-arabic";
const int _windowsCodepage = 10004;
const string _bodyname = "x-mac-arabic";
const int _codepage = 10004;
const string _encodingname = "Arabic (Mac)";
const string _headername = "x-mac-arabic";
const string _webname = "x-mac-arabic";
const int _windowsCodepage = 10004;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
/// <summary>
/// The Macintosh Arabic to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class MacCentralEuropean : Encoding
{
const string _bodyname = "x-mac-ce";
const int _codepage = 10029;
const string _encodingname = "Central European (Mac)";
const string _headername = "x-mac-ce";
const string _webname = "x-mac-ce";
const int _windowsCodepage = 10029;
const string _bodyname = "x-mac-ce";
const int _codepage = 10029;
const string _encodingname = "Central European (Mac)";
const string _headername = "x-mac-ce";
const string _webname = "x-mac-ce";
const int _windowsCodepage = 10029;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
/// <summary>
/// The Macintosh CentralEuropean to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class MacCroatian : Encoding
{
const string _bodyname = "x-mac-croatian";
const int _codepage = 10082;
const string _encodingname = "Croatian (Mac)";
const string _headername = "x-mac-croatian";
const string _webname = "x-mac-croatian";
const int _windowsCodepage = 10082;
const string _bodyname = "x-mac-croatian";
const int _codepage = 10082;
const string _encodingname = "Croatian (Mac)";
const string _headername = "x-mac-croatian";
const string _webname = "x-mac-croatian";
const int _windowsCodepage = 10082;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
/// <summary>
/// The Macintosh Croatian to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class MacCyrillic : Encoding
{
const string _bodyname = "x-mac-cyrillic";
const int _codepage = 10007;
const string _encodingname = "Cyrillic (Mac)";
const string _headername = "x-mac-cyrillic";
const string _webname = "x-mac-cyrillic";
const int _windowsCodepage = 10007;
const string _bodyname = "x-mac-cyrillic";
const int _codepage = 10007;
const string _encodingname = "Cyrillic (Mac)";
const string _headername = "x-mac-cyrillic";
const string _webname = "x-mac-cyrillic";
const int _windowsCodepage = 10007;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
/// <summary>
/// The Macintosh Cyrillic to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class MacFarsi : Encoding
{
const string _bodyname = "x-mac-farsi";
const int _codepage = 10014;
const string _encodingname = "Farsi (Mac)";
const string _headername = "x-mac-farsi";
const string _webname = "x-mac-farsi";
const int _windowsCodepage = 10014;
const string _bodyname = "x-mac-farsi";
const int _codepage = 10014;
const string _encodingname = "Farsi (Mac)";
const string _headername = "x-mac-farsi";
const string _webname = "x-mac-farsi";
const int _windowsCodepage = 10014;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
/// <summary>
/// The Macintosh Farsi to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class MacGreek : Encoding
{
const string _bodyname = "x-mac-greek";
const int _codepage = 10006;
const string _encodingname = "Greek (Mac)";
const string _headername = "x-mac-greek";
const string _webname = "x-mac-greek";
const int _windowsCodepage = 10006;
const string _bodyname = "x-mac-greek";
const int _codepage = 10006;
const string _encodingname = "Greek (Mac)";
const string _headername = "x-mac-greek";
const string _webname = "x-mac-greek";
const int _windowsCodepage = 10006;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
/// <summary>
/// The Macintosh Greek to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class MacHebrew : Encoding
{
const string _bodyname = "x-mac-hebrew";
const int _codepage = 10005;
const string _encodingname = "Hebrew (Mac)";
const string _headername = "x-mac-hebrew";
const string _webname = "x-mac-hebrew";
const int _windowsCodepage = 10005;
const string _bodyname = "x-mac-hebrew";
const int _codepage = 10005;
const string _encodingname = "Hebrew (Mac)";
const string _headername = "x-mac-hebrew";
const string _webname = "x-mac-hebrew";
const int _windowsCodepage = 10005;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
/// <summary>
/// The Macintosh Hebrew to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class MacRoman : Encoding
{
const string _bodyname = "macintosh";
const int _codepage = 10000;
const string _encodingname = "Western European (Mac)";
const string _headername = "macintosh";
const string _webname = "macintosh";
const int _windowsCodepage = 10000;
const string _bodyname = "macintosh";
const int _codepage = 10000;
const string _encodingname = "Western European (Mac)";
const string _headername = "macintosh";
const string _webname = "macintosh";
const int _windowsCodepage = 10000;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
/// <summary>
/// The Mac to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class MacRomanian : Encoding
{
const string _bodyname = "x-mac-romanian";
const int _codepage = 10010;
const string _encodingname = "Romanianian (Mac)";
const string _headername = "x-mac-romanian";
const string _webname = "x-mac-romanian";
const int _windowsCodepage = 10010;
const string _bodyname = "x-mac-romanian";
const int _codepage = 10010;
const string _encodingname = "Romanianian (Mac)";
const string _headername = "x-mac-romanian";
const string _webname = "x-mac-romanian";
const int _windowsCodepage = 10010;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
/// <summary>
/// The Mac to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class MacTurkish : Encoding
{
const string _bodyname = "x-mac-turkish";
const int _codepage = 10081;
const string _encodingname = "Turkish (Mac)";
const string _headername = "x-mac-turkish";
const string _webname = "x-mac-turkish";
const int _windowsCodepage = 10081;
const string _bodyname = "x-mac-turkish";
const int _codepage = 10081;
const string _encodingname = "Turkish (Mac)";
const string _headername = "x-mac-turkish";
const string _webname = "x-mac-turkish";
const int _windowsCodepage = 10081;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
/// <summary>
/// The Macintosh Turkish to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class MacUkrainian : Encoding
{
const string _bodyname = "x-mac-ukrainian";
const int _codepage = 10017;
const string _encodingname = "Ukrainian (Mac)";
const string _headername = "x-mac-ukrainian";
const string _webname = "x-mac-ukrainian";
const int _windowsCodepage = 10017;
const string _bodyname = "x-mac-ukrainian";
const int _codepage = 10017;
const string _encodingname = "Ukrainian (Mac)";
const string _headername = "x-mac-ukrainian";
const string _webname = "x-mac-ukrainian";
const int _windowsCodepage = 10017;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = true;
const bool singleByte = true;
/// <summary>
/// The Macintosh Ukrainian to Unicode character map.

View File

@@ -34,19 +34,19 @@ namespace Claunia.Encoding
/// </summary>
public class PETSCII : Encoding
{
const string _bodyname = "petscii";
const int _codepage = 0;
const string _encodingname = "Commodore PET Standard Code for Information Interchange";
const string _headername = "petscii";
const string _webname = "";
const int _windowsCodepage = 0;
const string _bodyname = "petscii";
const int _codepage = 0;
const string _encodingname = "Commodore PET Standard Code for Information Interchange";
const string _headername = "petscii";
const string _webname = "";
const int _windowsCodepage = 0;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
/// <summary>
/// The PETSCII to Unicode character map, unshifted (default) variant.
@@ -494,7 +494,8 @@ namespace Claunia.Encoding
for(int i = 0; i < 256; i++)
// TODO: convert this to a gigantic switch statement too?
if(PETSCIITable[i] == character) return (byte)i;
if(PETSCIITable[i] == character)
return (byte)i;
// Fallback to '?'
return 0x3F;

View File

@@ -68,12 +68,10 @@ namespace Claunia.Encoding
public const string Estonian = "Põdur Zagrebi tšellomängija-följetonist Ciqo külmetas kehvas garaažis.";
/// <summary>A pangram that contains all (or most) Finnish characters.</summary>
public const string Finnish =
"Fahrenheit ja Celsius yrjösivät Åsan backgammon-peliin, Volkswagenissa, daiquirin ja ZX81:n yhteisvaikutuksesta."
;
"Fahrenheit ja Celsius yrjösivät Åsan backgammon-peliin, Volkswagenissa, daiquirin ja ZX81:n yhteisvaikutuksesta.";
/// <summary>A pangram that contains all (or most) French characters.</summary>
public const string French =
"Le cœur déçu mais l'âme plutôt naïve, Louÿs rêva de crapaüter en canoë au delà des îles, près du mälströn où brûlent les novæ."
;
"Le cœur déçu mais l'âme plutôt naïve, Louÿs rêva de crapaüter en canoë au delà des îles, près du mälströn où brûlent les novæ.";
/// <summary>A pangram that contains all (or most) Galician characters.</summary>
public const string Galician =
"Necesitamos unha tipografía chuliña de cor kiwi, que lle zorregue unha labazada visual á xente.";
@@ -81,12 +79,10 @@ namespace Claunia.Encoding
public const string German = "Falsches Üben von Xylophonmusik quält jeden größeren Zwerg.";
/// <summary>A pangram that contains all (or most) Greek characters.</summary>
public const string Greek =
"Ταχίστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός Takhístè alôpèx vaphês psèménè gè, draskelízei ypér nòthroý kynós."
;
"Ταχίστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός Takhístè alôpèx vaphês psèménè gè, draskelízei ypér nòthroý kynós.";
/// <summary>A pangram that contains all (or most) Hebrew characters.</summary>
public const string Hebrew =
"לכן חכו לי נאם יהוה ליום קומי לעד, כי משפטי לאסף גוים לקבצי ממלכות, לשפך עליהם זעמי כל חרון אפי, כי באש קנאתי תאכל כל הארץ"
;
"לכן חכו לי נאם יהוה ליום קומי לעד, כי משפטי לאסף גוים לקבצי ממלכות, לשפך עליהם זעמי כל חרון אפי, כי באש קנאתי תאכל כל הארץ";
/// <summary>A pangram that contains all (or most) Hungarian characters.</summary>
public const string Hungarian = "Jó foxim és don Quijote húszwattos lámpánál ülve egy pár bűvös cipőt készít.";
/// <summary>A pangram that contains all (or most) Icelandic characters.</summary>
@@ -111,8 +107,7 @@ namespace Claunia.Encoding
public const string Polish = "Jeżu klątw, spłódź Finom część gry hańb!";
/// <summary>A pangram that contains all (or most) Portuguese characters.</summary>
public const string Portuguese =
"À noite, vovô Kowalsky vê o ímã cair no pé do pingüim queixoso e vovó põe açúcar no chá de tâmaras do jabuti feliz."
;
"À noite, vovô Kowalsky vê o ímã cair no pé do pingüim queixoso e vovó põe açúcar no chá de tâmaras do jabuti feliz.";
/// <summary>A pangram that contains all (or most) Romanian characters.</summary>
public const string Romanian = "Înjurând pițigăiat, zoofobul comandă vexat whisky și tequila.";
/// <summary>A pangram that contains all (or most) Russian characters.</summary>
@@ -129,8 +124,7 @@ namespace Claunia.Encoding
public const string Slovenian = "Besni dirkač iz formule žuga cehu poštarjev.";
/// <summary>A pangram that contains all (or most) Spanish characters.</summary>
public const string Spanish =
"El veloz murciélago hindú comía feliz cardillo y kiwi. La cigüeña tocaba el saxofón detrás del palenque de paja."
;
"El veloz murciélago hindú comía feliz cardillo y kiwi. La cigüeña tocaba el saxofón detrás del palenque de paja.";
/// <summary>A pangram that contains all (or most) Swedish characters.</summary>
public const string Swedish = "Flygande bäckasiner söka hwila på mjuka tuvor.";
/// <summary>A pangram that contains all (or most) Turkish characters.</summary>

View File

@@ -25,30 +25,29 @@
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("Claunia.Encoding")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("Claunia.com")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("© Natalia Portillo")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
[assembly: AssemblyTitle("Claunia.Encoding")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Claunia.com")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("© Natalia Portillo")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.4.*")]
[assembly: AssemblyVersion("1.4.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class Radix50 : Encoding
{
const string _bodyname = "radix50";
const int _codepage = 0;
const string _encodingname = "Western European (Radix-50)";
const string _headername = "radix50";
const string _webname = "";
const int _windowsCodepage = 0;
const string _bodyname = "radix50";
const int _codepage = 0;
const string _encodingname = "Western European (Radix-50)";
const string _headername = "radix50";
const string _webname = "";
const int _windowsCodepage = 0;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = false;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = false;
/// <summary>
/// The Radix-50 to Unicode character map, when bits are shifted right
@@ -252,8 +252,8 @@ namespace Claunia.Encoding
if(count + index > chars.Length) throw new ArgumentOutOfRangeException(nameof(count));
byte[] bytes = new byte[count * 6 % 8 > 0 ? count * 6 / 8 + 1 : count * 6 / 8];
int outPos = 0;
byte[] bytes = new byte[count * 6 % 8 > 0 ? count * 6 / 8 + 1 : count * 6 / 8];
int outPos = 0;
for(int i = 0; i < count; i++)
{
@@ -269,20 +269,20 @@ namespace Claunia.Encoding
case 1:
if(outPos + 1 >= bytes.Length) break;
bytes[outPos] += (byte)((thisByte & 0x30) >> 4);
bytes[outPos + 1] = (byte)((thisByte & 0xF) << 4);
bytes[outPos] += (byte)((thisByte & 0x30) >> 4);
bytes[outPos + 1] = (byte)((thisByte & 0xF) << 4);
break;
case 2:
if(outPos + 2 >= bytes.Length) break;
bytes[outPos + 1] += (byte)((thisByte & 0x3C) >> 2);
bytes[outPos + 2] = (byte)((thisByte & 0x3) << 6);
bytes[outPos + 2] = (byte)((thisByte & 0x3) << 6);
break;
case 3:
if(outPos + 2 >= bytes.Length) break;
bytes[outPos + 2] += (byte)(thisByte & 0x3F);
outPos += 3;
outPos += 3;
break;
}
}
@@ -404,20 +404,21 @@ namespace Claunia.Encoding
switch(i % 3)
{
case 0:
rd50 = (byte)((bytes[index + i] & 0xFC) >> 2);
rd50 = (byte)((bytes[index + i] & 0xFC) >> 2);
chars[outPos] = GetChar(rd50);
outPos++;
break;
case 1:
rd50 = (byte)(((bytes[index + i - 1] & 0x03) << 4) + ((bytes[index + i] & 0xF0) >> 4));
rd50 = (byte)(((bytes[index + i - 1] & 0x03) << 4) + ((bytes[index + i] & 0xF0) >> 4));
chars[outPos] = GetChar(rd50);
outPos++;
break;
case 2:
rd50 = (byte)(((bytes[index + i - 1] & 0x0F) << 2) + ((bytes[index + i] & 0xC0) >> 6));
chars[outPos] = GetChar(rd50);
chars[outPos + 1] = GetChar((byte)(bytes[index + i] & 0x3F));
outPos += 2;
rd50 =
(byte)(((bytes[index + i - 1] & 0x0F) << 2) + ((bytes[index + i] & 0xC0) >> 6));
chars[outPos] = GetChar(rd50);
chars[outPos + 1] = GetChar((byte)(bytes[index + i] & 0x3F));
outPos += 2;
break;
}
}

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class ZX80 : Encoding
{
const string _bodyname = "zx80";
const int _codepage = 0;
const string _encodingname = "Sinclair ZX80 character set";
const string _headername = "zx80";
const string _webname = "";
const int _windowsCodepage = 0;
const string _bodyname = "zx80";
const int _codepage = 0;
const string _encodingname = "Sinclair ZX80 character set";
const string _headername = "zx80";
const string _webname = "";
const int _windowsCodepage = 0;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
/// <summary>
/// The ZX80 to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class ZX81 : Encoding
{
const string _bodyname = "zx81";
const int _codepage = 0;
const string _encodingname = "Sinclair ZX81 character set";
const string _headername = "zx81";
const string _webname = "";
const int _windowsCodepage = 0;
const string _bodyname = "zx81";
const int _codepage = 0;
const string _encodingname = "Sinclair ZX81 character set";
const string _headername = "zx81";
const string _webname = "";
const int _windowsCodepage = 0;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
/// <summary>
/// The ZX81 to Unicode character map.

View File

@@ -33,19 +33,19 @@ namespace Claunia.Encoding
/// </summary>
public class ZXSpectrum : Encoding
{
const string _bodyname = "spectrum";
const int _codepage = 0;
const string _encodingname = "Sinclair ZX Spectrum character set";
const string _headername = "spectrum";
const string _webname = "";
const int _windowsCodepage = 0;
const string _bodyname = "spectrum";
const int _codepage = 0;
const string _encodingname = "Sinclair ZX Spectrum character set";
const string _headername = "spectrum";
const string _webname = "";
const int _windowsCodepage = 0;
const bool browserDisplay = false;
const bool browserSave = false;
const bool browserDisplay = false;
const bool browserSave = false;
const bool mailNewsDisplay = false;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
const bool mailNewsSave = false;
const bool readOnly = false;
const bool singleByte = true;
/// <summary>
/// The ZX Spectrum to Unicode character map.