General reformat.

This commit is contained in:
2019-04-23 23:20:55 +01:00
parent 33e889ed02
commit 60596ec513
31 changed files with 310 additions and 863 deletions

View File

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

View File

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

View File

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

View File

@@ -35,20 +35,22 @@ namespace Claunia.Encoding.Tests
readonly byte[] PunctuationsBytes = {0b00000001, 0b11000110, 0b11011101}; readonly byte[] PunctuationsBytes = {0b00000001, 0b11000110, 0b11011101};
const string Digits = "0123456789"; const string Digits = "0123456789";
readonly byte[] DigitsBytes = readonly byte[] DigitsBytes =
{0b01111001, 0b11111000, 0b00100001, 0b10001010, 0b00111001, 0b00100101, 0b10011010, 0b01110000}; {
0b01111001, 0b11111000, 0b00100001, 0b10001010, 0b00111001, 0b00100101, 0b10011010, 0b01110000
};
const string UpperLatin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const string UpperLatin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
readonly byte[] UpperLatinBytes = readonly byte[] UpperLatinBytes =
{ {
0b00000100, 0b00100000, 0b11000100, 0b00010100, 0b01100001, 0b11001000, 0b00100100, 0b10100010, 0b11001100, 0b00000100, 0b00100000, 0b11000100, 0b00010100, 0b01100001, 0b11001000, 0b00100100, 0b10100010,
0b00110100, 0b11100011, 0b11010000, 0b01000101, 0b00100100, 0b11010100, 0b01010101, 0b01100101, 0b11011000, 0b11001100, 0b00110100, 0b11100011, 0b11010000, 0b01000101, 0b00100100, 0b11010100, 0b01010101,
0b01100101, 0b10100000 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 const string SentencePadded = "THIS IS A TEST$ "; // It gets space padded when decoding is not multiple
readonly byte[] SentenceBytes = readonly byte[] SentenceBytes =
{ {
0b01010000, 0b10000010, 0b01010011, 0b00000000, 0b10010100, 0b11000000, 0b00000100, 0b00000101, 0b00000101, 0b01010000, 0b10000010, 0b01010011, 0b00000000, 0b10010100, 0b11000000, 0b00000100, 0b00000101,
0b01001101, 0b01000110, 0b11000000 0b00000101, 0b01001101, 0b01000110, 0b11000000
}; };
[Test] [Test]

View File

@@ -230,10 +230,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -312,20 +310,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -388,10 +380,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -445,20 +434,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -467,20 +450,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a ATASCII character to an Unicode character /// Converts a ATASCII character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">ATASCII character.</param> /// <param name="character">ATASCII character.</param>
static char GetChar(byte character) static char GetChar(byte character) => ATASCIITable[character];
{
return ATASCIITable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an ATASCII character /// Converts a Unicode character to an ATASCII character

View File

@@ -230,10 +230,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -312,20 +310,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -388,10 +380,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -445,20 +434,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -467,20 +450,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Apple II character to an Unicode character /// Converts a Apple II character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Apple II character.</param> /// <param name="character">Apple II character.</param>
static char GetChar(byte character) static char GetChar(byte character) => Apple2Table[character];
{
return Apple2Table[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Apple II character /// Converts a Unicode character to an Apple II character

View File

@@ -231,10 +231,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -313,20 +311,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -389,10 +381,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -446,20 +435,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -468,20 +451,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Apple IIc character to an Unicode character /// Converts a Apple IIc character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Apple IIc character.</param> /// <param name="character">Apple IIc character.</param>
static char GetChar(byte character) static char GetChar(byte character) => Apple2cTable[character];
{
return Apple2cTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Apple IIc character /// Converts a Unicode character to an Apple IIc character

View File

@@ -230,10 +230,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -312,20 +310,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -388,10 +380,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -445,20 +434,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -467,20 +450,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Apple IIe character to an Unicode character /// Converts a Apple IIe character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Apple IIe character.</param> /// <param name="character">Apple IIe character.</param>
static char GetChar(byte character) static char GetChar(byte character) => Apple2eTable[character];
{
return Apple2eTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Apple IIe character /// Converts a Unicode character to an Apple IIe character

View File

@@ -231,10 +231,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -313,20 +311,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -389,10 +381,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -446,20 +435,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -468,20 +451,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Apple IIgs character to an Unicode character /// Converts a Apple IIgs character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Apple IIgs character.</param> /// <param name="character">Apple IIgs character.</param>
static char GetChar(byte character) static char GetChar(byte character) => Apple2gsTable[character];
{
return Apple2gsTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Apple IIgs character /// Converts a Unicode character to an Apple IIgs character

View File

@@ -231,10 +231,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -313,20 +311,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -389,10 +381,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -446,20 +435,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -468,20 +451,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Atari ST character to an Unicode character /// Converts a Atari ST character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Atari ST character.</param> /// <param name="character">Atari ST character.</param>
static char GetChar(byte character) static char GetChar(byte character) => AtariSTTable[character];
{
return AtariSTTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Atari ST character /// Converts a Unicode character to an Atari ST character

View File

@@ -130,14 +130,12 @@ namespace Claunia.Encoding
/// Returns an array that contains all encodings. /// Returns an array that contains all encodings.
/// </summary> /// </summary>
/// <returns>An array that contains all encodings.</returns> /// <returns>An array that contains all encodings.</returns>
public new static IEnumerable<EncodingInfo> GetEncodings() public new static IEnumerable<EncodingInfo> GetEncodings() =>
{ (from type in Assembly.GetExecutingAssembly().GetTypes()
return (from type in Assembly.GetExecutingAssembly().GetTypes()
where type.IsSubclassOf(typeof(Encoding)) where type.IsSubclassOf(typeof(Encoding))
let encoding = (Encoding)type.GetConstructor(new Type[] { }).Invoke(new object[] { }) let encoding = (Encoding)type.GetConstructor(new Type[] { }).Invoke(new object[] { })
select new EncodingInfo(encoding.CodePage, encoding.BodyName, encoding.EncodingName, false, type)) select new EncodingInfo(encoding.CodePage, encoding.BodyName, encoding.EncodingName, false, type))
.ToArray(); .ToArray();
}
/// <summary> /// <summary>
/// Returns the encoding associated with the specified code page name. /// Returns the encoding associated with the specified code page name.

View File

@@ -12,7 +12,7 @@ namespace Claunia.Encoding
public sealed class EncodingInfo public sealed class EncodingInfo
{ {
bool isSystem; bool isSystem;
Type thisType; readonly 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) Type internalType = null)
@@ -49,10 +49,7 @@ namespace Claunia.Encoding
/// A <see cref="T:Claunia.Encoding.Encoding" /> object that corresponds to the current /// A <see cref="T:Claunia.Encoding.Encoding" /> object that corresponds to the current
/// <see cref="T:Claunia.Encoding.EncodingInfo" /> object. /// <see cref="T:Claunia.Encoding.EncodingInfo" /> object.
/// </returns> /// </returns>
public Encoding GetEncoding() public Encoding GetEncoding() => (Encoding)thisType.GetConstructor(new Type[] { }).Invoke(new object[] { });
{
return (Encoding)thisType.GetConstructor(new Type[] { }).Invoke(new object[] { });
}
/// <summary> /// <summary>
/// Gets a value indicating whether the specified object is equal to the current EncodingInfo object. /// Gets a value indicating whether the specified object is equal to the current EncodingInfo object.
@@ -62,18 +59,12 @@ namespace Claunia.Encoding
/// <c>true</c> if value is a <see cref="T:Claunia.Encoding.EncodingInfo" /> and is equal to the current /// <c>true</c> if value is a <see cref="T:Claunia.Encoding.EncodingInfo" /> and is equal to the current
/// <see cref="T:Claunia.Encoding.EncodingInfo" />; otherwise, <c>false</c>. /// <see cref="T:Claunia.Encoding.EncodingInfo" />; otherwise, <c>false</c>.
/// </returns> /// </returns>
public override bool Equals(object value) public override bool Equals(object value) => value is EncodingInfo that && CodePage == that.CodePage;
{
return value is EncodingInfo that && CodePage == that.CodePage;
}
/// <summary> /// <summary>
/// Returns the hash code for the current EncodingInfo object. /// Returns the hash code for the current EncodingInfo object.
/// </summary> /// </summary>
/// <returns>A 32-bit signed integer hash code.</returns> /// <returns>A 32-bit signed integer hash code.</returns>
public override int GetHashCode() public override int GetHashCode() => CodePage;
{
return CodePage;
}
} }
} }

View File

@@ -231,10 +231,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -313,20 +311,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -389,10 +381,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -446,20 +435,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -468,20 +451,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a GEM character to an Unicode character /// Converts a GEM character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">GEM character.</param> /// <param name="character">GEM character.</param>
static char GetChar(byte character) static char GetChar(byte character) => GemTable[character];
{
return GemTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an GEM character /// Converts a Unicode character to an GEM character

View File

@@ -232,10 +232,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -314,20 +312,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -390,10 +382,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -447,20 +436,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -469,20 +452,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a GEOS character to an Unicode character /// Converts a GEOS character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">GEOS character.</param> /// <param name="character">GEOS character.</param>
static char GetChar(byte character) static char GetChar(byte character) => GeosTable[character];
{
return GeosTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an GEOS character /// Converts a Unicode character to an GEOS character

View File

@@ -231,10 +231,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -313,20 +311,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -389,10 +381,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -446,20 +435,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -468,20 +451,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a LisaRoman character to an Unicode character /// Converts a LisaRoman character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">LisaRoman character.</param> /// <param name="character">LisaRoman character.</param>
static char GetChar(byte character) static char GetChar(byte character) => LisaRomanTable[character];
{
return LisaRomanTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an LisaRoman character /// Converts a Unicode character to an LisaRoman character

View File

@@ -230,10 +230,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -312,20 +310,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -388,10 +380,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -445,20 +434,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -467,20 +450,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Mac Arabic character to an Unicode character /// Converts a Mac Arabic character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Mac Arabic character.</param> /// <param name="character">Mac Arabic character.</param>
static char GetChar(byte character) static char GetChar(byte character) => MacArabicTable[character];
{
return MacArabicTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Mac Arabic character /// Converts a Unicode character to an Mac Arabic character

View File

@@ -230,10 +230,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -312,20 +310,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -388,10 +380,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -445,20 +434,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -467,20 +450,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Mac CentralEuropean character to an Unicode character /// Converts a Mac CentralEuropean character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Mac CentralEuropean character.</param> /// <param name="character">Mac CentralEuropean character.</param>
static char GetChar(byte character) static char GetChar(byte character) => MacCentralEuropeanTable[character];
{
return MacCentralEuropeanTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Mac CentralEuropean character /// Converts a Unicode character to an Mac CentralEuropean character

View File

@@ -230,10 +230,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -312,20 +310,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -388,10 +380,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -445,20 +434,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -467,20 +450,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Mac Croatian character to an Unicode character /// Converts a Mac Croatian character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Mac Croatian character.</param> /// <param name="character">Mac Croatian character.</param>
static char GetChar(byte character) static char GetChar(byte character) => MacCroatianTable[character];
{
return MacCroatianTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Mac Croatian character /// Converts a Unicode character to an Mac Croatian character

View File

@@ -230,10 +230,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -312,20 +310,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -388,10 +380,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -445,20 +434,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -467,20 +450,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Mac Cyrillic character to an Unicode character /// Converts a Mac Cyrillic character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Mac Cyrillic character.</param> /// <param name="character">Mac Cyrillic character.</param>
static char GetChar(byte character) static char GetChar(byte character) => MacCyrillicTable[character];
{
return MacCyrillicTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Mac Cyrillic character /// Converts a Unicode character to an Mac Cyrillic character

View File

@@ -230,10 +230,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -312,20 +310,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -388,10 +380,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -445,20 +434,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -467,20 +450,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Mac Farsi character to an Unicode character /// Converts a Mac Farsi character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Mac Farsi character.</param> /// <param name="character">Mac Farsi character.</param>
static char GetChar(byte character) static char GetChar(byte character) => MacFarsiTable[character];
{
return MacFarsiTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Mac Farsi character /// Converts a Unicode character to an Mac Farsi character

View File

@@ -230,10 +230,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -312,20 +310,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -388,10 +380,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -445,20 +434,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -467,20 +450,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Mac Greek character to an Unicode character /// Converts a Mac Greek character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Mac Greek character.</param> /// <param name="character">Mac Greek character.</param>
static char GetChar(byte character) static char GetChar(byte character) => MacGreekTable[character];
{
return MacGreekTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Mac Greek character /// Converts a Unicode character to an Mac Greek character

View File

@@ -233,10 +233,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -315,20 +313,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -391,10 +383,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -448,20 +437,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -470,20 +453,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Mac Hebrew character to an Unicode character /// Converts a Mac Hebrew character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Mac Hebrew character.</param> /// <param name="character">Mac Hebrew character.</param>
static char GetChar(byte character) static char GetChar(byte character) => MacHebrewTable[character];
{
return MacHebrewTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Mac Hebrew character /// Converts a Unicode character to an Mac Hebrew character

View File

@@ -231,10 +231,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -313,20 +311,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -389,10 +381,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -446,20 +435,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -468,20 +451,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a MacRoman character to an Unicode character /// Converts a MacRoman character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">MacRoman character.</param> /// <param name="character">MacRoman character.</param>
static char GetChar(byte character) static char GetChar(byte character) => MacRomanTable[character];
{
return MacRomanTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an MacRoman character /// Converts a Unicode character to an MacRoman character

View File

@@ -231,10 +231,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -313,20 +311,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -389,10 +381,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -446,20 +435,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -468,20 +451,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a MacRomanian character to an Unicode character /// Converts a MacRomanian character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">MacRomanian character.</param> /// <param name="character">MacRomanian character.</param>
static char GetChar(byte character) static char GetChar(byte character) => MacRomanianTable[character];
{
return MacRomanianTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an MacRomanian character /// Converts a Unicode character to an MacRomanian character

View File

@@ -230,10 +230,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -312,20 +310,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -388,10 +380,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -445,20 +434,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -467,20 +450,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Mac Turkish character to an Unicode character /// Converts a Mac Turkish character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Mac Turkish character.</param> /// <param name="character">Mac Turkish character.</param>
static char GetChar(byte character) static char GetChar(byte character) => MacTurkishTable[character];
{
return MacTurkishTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Mac Turkish character /// Converts a Unicode character to an Mac Turkish character

View File

@@ -230,10 +230,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -312,20 +310,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -388,10 +380,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -445,20 +434,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -467,20 +450,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Mac Ukrainian character to an Unicode character /// Converts a Mac Ukrainian character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Mac Ukrainian character.</param> /// <param name="character">Mac Ukrainian character.</param>
static char GetChar(byte character) static char GetChar(byte character) => MacUkrainianTable[character];
{
return MacUkrainianTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Mac Ukrainian character /// Converts a Unicode character to an Mac Ukrainian character

View File

@@ -231,10 +231,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -313,20 +311,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -389,10 +381,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -446,20 +435,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -468,20 +451,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a PETSCII character to an Unicode character /// Converts a PETSCII character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">PETSCII character.</param> /// <param name="character">PETSCII character.</param>
static char GetChar(byte character) static char GetChar(byte character) => PETSCIITable[character];
{
return PETSCIITable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an PETSCII character /// Converts a Unicode character to an PETSCII character

View File

@@ -182,10 +182,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -295,20 +293,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -371,10 +363,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -454,20 +443,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -476,20 +459,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a Apple II character to an Unicode character /// Converts a Apple II character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">Apple II character.</param> /// <param name="character">Apple II character.</param>
static char GetChar(byte character) static char GetChar(byte character) => Radix50Table[character & 0x3F];
{
return Radix50Table[character & 0x3F];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an Apple II character /// Converts a Unicode character to an Apple II character

View File

@@ -230,10 +230,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -312,20 +310,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -388,10 +380,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -445,20 +434,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -467,20 +450,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a ZX80 character to an Unicode character /// Converts a ZX80 character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">ZX80 character.</param> /// <param name="character">ZX80 character.</param>
static char GetChar(byte character) static char GetChar(byte character) => ZX80Table[character];
{
return ZX80Table[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an ZX80 character /// Converts a Unicode character to an ZX80 character

View File

@@ -230,10 +230,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -312,20 +310,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -388,10 +380,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -445,20 +434,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -467,20 +450,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a ZX81 character to an Unicode character /// Converts a ZX81 character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">ZX81 character.</param> /// <param name="character">ZX81 character.</param>
static char GetChar(byte character) static char GetChar(byte character) => ZX81Table[character];
{
return ZX81Table[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an ZX81 character /// Converts a Unicode character to an ZX81 character

View File

@@ -230,10 +230,8 @@ namespace Claunia.Encoding
/// <param name="charCount">The number of characters to encode.</param> /// <param name="charCount">The number of characters to encode.</param>
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param> /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param> /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) =>
{ GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
}
/// <summary> /// <summary>
/// Encodes all the characters in the specified string into a sequence of bytes. /// Encodes all the characters in the specified string into a sequence of bytes.
@@ -312,20 +310,14 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns> /// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
/// <param name="chars">The character array containing the characters to encode.</param> /// <param name="chars">The character array containing the characters to encode.</param>
public override byte[] GetBytes(char[] chars) public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length);
{
return GetBytes(chars, 0, chars.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// Calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// </summary> /// </summary>
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns> /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override int GetCharCount(byte[] bytes) public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length);
{
return GetCharCount(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
@@ -388,10 +380,7 @@ namespace Claunia.Encoding
/// </summary> /// </summary>
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns> /// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override char[] GetChars(byte[] bytes) public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length);
{
return GetChars(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a set of characters. /// Decodes a sequence of bytes from the specified byte array into a set of characters.
@@ -445,20 +434,14 @@ namespace Claunia.Encoding
/// Returns a sequence of bytes that specifies the encoding used. /// Returns a sequence of bytes that specifies the encoding used.
/// </summary> /// </summary>
/// <returns>A byte array of length zero, as a preamble is not required.</returns> /// <returns>A byte array of length zero, as a preamble is not required.</returns>
public override byte[] GetPreamble() public override byte[] GetPreamble() => new byte[0];
{
return new byte[0];
}
/// <summary> /// <summary>
/// Decodes all the bytes in the specified byte array into a string. /// Decodes all the bytes in the specified byte array into a string.
/// </summary> /// </summary>
/// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns> /// <returns>A string that contains the results of decoding the specified sequence of bytes.</returns>
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
public override string GetString(byte[] bytes) public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length);
{
return GetString(bytes, 0, bytes.Length);
}
/// <summary> /// <summary>
/// Decodes a sequence of bytes from the specified byte array into a string. /// Decodes a sequence of bytes from the specified byte array into a string.
@@ -467,20 +450,15 @@ namespace Claunia.Encoding
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param> /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
/// <param name="index">The index of the first byte to decode.</param> /// <param name="index">The index of the first byte to decode.</param>
/// <param name="count">The number of bytes to decode.</param> /// <param name="count">The number of bytes to decode.</param>
public override string GetString(byte[] bytes, int index, int count) public override string GetString(byte[] bytes, int index, int count) =>
{ new string(GetChars(bytes, index, count));
return new string(GetChars(bytes, index, count));
}
/// <summary> /// <summary>
/// Converts a ZX Spectrum character to an Unicode character /// Converts a ZX Spectrum character to an Unicode character
/// </summary> /// </summary>
/// <returns>Unicode character.</returns> /// <returns>Unicode character.</returns>
/// <param name="character">ZX Spectrum character.</param> /// <param name="character">ZX Spectrum character.</param>
static char GetChar(byte character) static char GetChar(byte character) => ZXSpectrumTable[character];
{
return ZXSpectrumTable[character];
}
/// <summary> /// <summary>
/// Converts a Unicode character to an ZX Spectrum character /// Converts a Unicode character to an ZX Spectrum character