diff --git a/Claunia.Encoding.Tests/ATASCII.cs b/Claunia.Encoding.Tests/ATASCII.cs index 30b2e13..1048aff 100644 --- a/Claunia.Encoding.Tests/ATASCII.cs +++ b/Claunia.Encoding.Tests/ATASCII.cs @@ -34,29 +34,29 @@ namespace Claunia.Encoding.Tests const string Punctuations = "!\"#$%&'()*+,-./:;<=>?@[\\]^_|"; readonly byte[] PunctuationsBytes = { - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x3A, 0x3B, 0x3C, - 0x3D, 0x3E, 0x3F, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x7C + 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x3A, 0x3B, + 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x7C }; const string Digits = "0123456789"; readonly byte[] DigitsBytes = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39}; const string UpperLatin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; readonly byte[] UpperLatinBytes = { - 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, - 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, + 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A }; const string LowerLatin = "abcdefghijklmnopqrstuvwxyz"; readonly byte[] LowerLatinBytes = { - 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, - 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A + 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, + 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A }; const string Graphics = "├┘┤┐╱╲◢▗◣▝▘▂▖┌─┼●▄▎┬┴▌└"; readonly byte[] GraphicsBytes = { - 0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, 0x12, 0x13, 0x14, 0x15, - 0x16, 0x17, 0x18, 0x19, 0x1A + 0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, 0x12, 0x13, 0x14, + 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A }; const string Arrows = "↑↓←→↰◀▶"; readonly byte[] ArrowsBytes = {0x1C, 0x1D, 0x1E, 0x1F, 0x7D, 0x7E, 0x7F}; diff --git a/Claunia.Encoding.Tests/AtariST.cs b/Claunia.Encoding.Tests/AtariST.cs index 3a8098e..36104e3 100644 --- a/Claunia.Encoding.Tests/AtariST.cs +++ b/Claunia.Encoding.Tests/AtariST.cs @@ -34,22 +34,22 @@ namespace Claunia.Encoding.Tests const string Punctuations = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"; readonly byte[] PunctuationsBytes = { - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x3A, 0x3B, 0x3C, - 0x3D, 0x3E, 0x3F, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x7B, 0x7C, 0x7D, 0x7E + 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x3A, 0x3B, + 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x7B, 0x7C, 0x7D, 0x7E }; const string Digits = "0123456789"; readonly byte[] DigitsBytes = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39}; const string UpperLatin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; readonly byte[] UpperLatinBytes = { - 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, - 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, + 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A }; const string LowerLatin = "abcdefghijklmnopqrstuvwxyz"; readonly byte[] LowerLatinBytes = { - 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, - 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A + 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, + 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A }; const string Spanish = "¡¿áéíóúüñÉÜÑ"; @@ -57,8 +57,8 @@ namespace Claunia.Encoding.Tests const string French = "éÉàèùÀâêîôûëïüÿçÇœŒæÆ"; readonly byte[] FrenchBytes = { - 0x82, 0x90, 0x85, 0x8A, 0x97, 0xB6, 0x83, 0x88, 0x8C, 0x93, 0x96, 0x89, 0x8B, 0x81, 0x98, 0x87, 0x80, 0xB4, - 0xB5, 0x91, 0x92 + 0x82, 0x90, 0x85, 0x8A, 0x97, 0xB6, 0x83, 0x88, 0x8C, 0x93, 0x96, 0x89, 0x8B, 0x81, 0x98, 0x87, 0x80, + 0xB4, 0xB5, 0x91, 0x92 }; const string German = "äöüßÄÖÜ"; readonly byte[] GermanBytes = {0x84, 0x94, 0x81, 0x9E, 0x8E, 0x99, 0x9A}; @@ -66,28 +66,32 @@ namespace Claunia.Encoding.Tests readonly byte[] NorwegianBytes = {0x91, 0xB3, 0x86, 0x92, 0xB2, 0x8F}; const string Portuguese = "áéíóúÉâêôãõÃÕçÇ"; readonly byte[] PortugueseBytes = - {0xA0, 0x82, 0xA1, 0xA2, 0xA3, 0x90, 0x83, 0x88, 0x93, 0xB0, 0xB1, 0xB7, 0xB8, 0x87, 0x80}; + { + 0xA0, 0x82, 0xA1, 0xA2, 0xA3, 0x90, 0x83, 0x88, 0x93, 0xB0, 0xB1, 0xB7, 0xB8, 0x87, 0x80 + }; const string Dutch = "ijIJ"; readonly byte[] DutchBytes = {0xC0, 0xC1}; const string Hebrew = "אבגדהוזחטיכלמנסעפצקרשתןךםףץ"; readonly byte[] HebrewBytes = { - 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, - 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC + 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, + 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC }; const string Greek = "αβΓπΣσµτΦΘΩδ¯"; readonly byte[] GreekBytes = {0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xFF}; const string Typographic = "ªº«»¨´†¶©®™§°∙·"; readonly byte[] TypographicBytes = - {0xA6, 0xA7, 0xAE, 0xAF, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xDD, 0xF8, 0xF9, 0xFA}; + { + 0xA6, 0xA7, 0xAE, 0xAF, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xDD, 0xF8, 0xF9, 0xFA + }; const string Currency = "¢£¥ƒ"; readonly byte[] CurrencyBytes = {0x9B, 0x9C, 0x9D, 0x9F}; const string Mathematics = "⌐¬½¼∧∞∮ϕ∈∩≡±≥≤⌠⌡÷≈√ⁿ²³"; readonly byte[] MathematicsBytes = { - 0xA9, 0xAA, 0xAB, 0xAC, 0xDE, 0xDF, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, - 0xFB, 0xFC, 0xFD, 0xFE + 0xA9, 0xAA, 0xAB, 0xAC, 0xDE, 0xDF, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, + 0xF7, 0xFB, 0xFC, 0xFD, 0xFE }; const string Symbols = "⇧⇩⇨⇦❎✓♪ə"; readonly byte[] SymbolsBytes = {0x01, 0x02, 0x03, 0x04, 0x05, 0x08, 0x0B, 0x1A}; diff --git a/Claunia.Encoding.Tests/LisaRoman.cs b/Claunia.Encoding.Tests/LisaRoman.cs index d896a00..27a4b76 100644 --- a/Claunia.Encoding.Tests/LisaRoman.cs +++ b/Claunia.Encoding.Tests/LisaRoman.cs @@ -34,22 +34,22 @@ namespace Claunia.Encoding.Tests const string Punctuations = "!\"#$%&()*+,-./:;<=>?@[\\]^_{|}~"; readonly byte[] PunctuationsBytes = { - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x3A, 0x3B, 0x3C, 0x3D, - 0x3E, 0x3F, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x7B, 0x7C, 0x7D, 0x7E + 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x3A, 0x3B, 0x3C, + 0x3D, 0x3E, 0x3F, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x7B, 0x7C, 0x7D, 0x7E }; const string Digits = "0123456789"; readonly byte[] DigitsBytes = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39}; const string UpperLatin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; readonly byte[] UpperLatinBytes = { - 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, - 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, + 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A }; const string LowerLatin = "abcdefghijklmnopqrstuvwxyz"; readonly byte[] LowerLatinBytes = { - 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, - 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A + 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, + 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A }; const string Spanish = "¡¿áéíóúüñÉÜÑ"; @@ -57,8 +57,8 @@ namespace Claunia.Encoding.Tests const string French = "éÉàèùÀâêîôûëïüÿçÇœŒæÆ"; readonly byte[] FrenchBytes = { - 0x8E, 0x83, 0x88, 0x8F, 0x9D, 0xCB, 0x89, 0x90, 0x94, 0x99, 0x9E, 0x91, 0x95, 0x9F, 0xD8, 0x8D, 0x82, 0xCF, - 0xCE, 0xBE, 0xAE + 0x8E, 0x83, 0x88, 0x8F, 0x9D, 0xCB, 0x89, 0x90, 0x94, 0x99, 0x9E, 0x91, 0x95, 0x9F, 0xD8, 0x8D, 0x82, + 0xCF, 0xCE, 0xBE, 0xAE }; const string German = "äöüßÄÖÜ"; readonly byte[] GermanBytes = {0x8A, 0x9A, 0x9F, 0xA7, 0x80, 0x85, 0x86}; @@ -66,21 +66,23 @@ namespace Claunia.Encoding.Tests readonly byte[] NorwegianBytes = {0xBE, 0xBF, 0x8C, 0xAE, 0xAF, 0x81}; const string Portuguese = "áéíóúÉâêôãõÃÕçÇ"; readonly byte[] PortugueseBytes = - {0x87, 0x8E, 0x92, 0x97, 0x9C, 0x83, 0x89, 0x90, 0x99, 0x8B, 0x9B, 0xCC, 0xCD, 0x8D, 0x82}; + { + 0x87, 0x8E, 0x92, 0x97, 0x9C, 0x83, 0x89, 0x90, 0x99, 0x8B, 0x9B, 0xCC, 0xCD, 0x8D, 0x82 + }; const string Typographic = "†°•¶®©™´¨ªº«»…–—“”‘’§"; readonly byte[] TypographicBytes = { - 0xA0, 0xA1, 0xA5, 0xA6, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xBB, 0xBC, 0xC7, 0xC8, 0xC9, 0xD0, 0xD1, 0xD2, 0xD3, - 0xD4, 0xD5, 0xA4 + 0xA0, 0xA1, 0xA5, 0xA6, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xBB, 0xBC, 0xC7, 0xC8, 0xC9, 0xD0, 0xD1, 0xD2, + 0xD3, 0xD4, 0xD5, 0xA4 }; const string Currency = "¢£¥"; readonly byte[] CurrencyBytes = {0xA2, 0xA3, 0xB4}; const string Mathematics = "≠∞±≤≥µ∂∑∏π∫Ω¬√ƒ≈∆÷◊"; readonly byte[] MathematicsBytes = { - 0xAD, 0xB0, 0xB1, 0xB2, 0xB3, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBD, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xD6, - 0xD7 + 0xAD, 0xB0, 0xB1, 0xB2, 0xB3, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBD, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, + 0xD6, 0xD7 }; [Test] diff --git a/Claunia.Encoding.Tests/Radix50.cs b/Claunia.Encoding.Tests/Radix50.cs index fed3057..091fdfd 100644 --- a/Claunia.Encoding.Tests/Radix50.cs +++ b/Claunia.Encoding.Tests/Radix50.cs @@ -35,20 +35,22 @@ namespace Claunia.Encoding.Tests readonly byte[] PunctuationsBytes = {0b00000001, 0b11000110, 0b11011101}; const string Digits = "0123456789"; readonly byte[] DigitsBytes = - {0b01111001, 0b11111000, 0b00100001, 0b10001010, 0b00111001, 0b00100101, 0b10011010, 0b01110000}; + { + 0b01111001, 0b11111000, 0b00100001, 0b10001010, 0b00111001, 0b00100101, 0b10011010, 0b01110000 + }; const string UpperLatin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; readonly byte[] UpperLatinBytes = { - 0b00000100, 0b00100000, 0b11000100, 0b00010100, 0b01100001, 0b11001000, 0b00100100, 0b10100010, 0b11001100, - 0b00110100, 0b11100011, 0b11010000, 0b01000101, 0b00100100, 0b11010100, 0b01010101, 0b01100101, 0b11011000, - 0b01100101, 0b10100000 + 0b00000100, 0b00100000, 0b11000100, 0b00010100, 0b01100001, 0b11001000, 0b00100100, 0b10100010, + 0b11001100, 0b00110100, 0b11100011, 0b11010000, 0b01000101, 0b00100100, 0b11010100, 0b01010101, + 0b01100101, 0b11011000, 0b01100101, 0b10100000 }; const string Sentence = "THIS IS A TEST$"; const string SentencePadded = "THIS IS A TEST$ "; // It gets space padded when decoding is not multiple readonly byte[] SentenceBytes = { - 0b01010000, 0b10000010, 0b01010011, 0b00000000, 0b10010100, 0b11000000, 0b00000100, 0b00000101, 0b00000101, - 0b01001101, 0b01000110, 0b11000000 + 0b01010000, 0b10000010, 0b01010011, 0b00000000, 0b10010100, 0b11000000, 0b00000100, 0b00000101, + 0b00000101, 0b01001101, 0b01000110, 0b11000000 }; [Test] diff --git a/Claunia.Encoding/ATASCII.cs b/Claunia.Encoding/ATASCII.cs index b28916a..6c77cae 100644 --- a/Claunia.Encoding/ATASCII.cs +++ b/Claunia.Encoding/ATASCII.cs @@ -230,10 +230,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -312,20 +310,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -388,10 +380,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -467,20 +450,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a ATASCII character to an Unicode character /// /// Unicode character. /// ATASCII character. - static char GetChar(byte character) - { - return ATASCIITable[character]; - } + static char GetChar(byte character) => ATASCIITable[character]; /// /// Converts a Unicode character to an ATASCII character diff --git a/Claunia.Encoding/Apple2.cs b/Claunia.Encoding/Apple2.cs index dc03faf..b611470 100644 --- a/Claunia.Encoding/Apple2.cs +++ b/Claunia.Encoding/Apple2.cs @@ -230,10 +230,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -312,20 +310,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -388,10 +380,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -467,20 +450,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Apple II character to an Unicode character /// /// Unicode character. /// Apple II character. - static char GetChar(byte character) - { - return Apple2Table[character]; - } + static char GetChar(byte character) => Apple2Table[character]; /// /// Converts a Unicode character to an Apple II character diff --git a/Claunia.Encoding/Apple2c.cs b/Claunia.Encoding/Apple2c.cs index fa2c13c..0c56298 100644 --- a/Claunia.Encoding/Apple2c.cs +++ b/Claunia.Encoding/Apple2c.cs @@ -231,10 +231,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -313,20 +311,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -389,10 +381,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -468,20 +451,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Apple IIc character to an Unicode character /// /// Unicode character. /// Apple IIc character. - static char GetChar(byte character) - { - return Apple2cTable[character]; - } + static char GetChar(byte character) => Apple2cTable[character]; /// /// Converts a Unicode character to an Apple IIc character diff --git a/Claunia.Encoding/Apple2e.cs b/Claunia.Encoding/Apple2e.cs index 503af40..6fd3d9c 100644 --- a/Claunia.Encoding/Apple2e.cs +++ b/Claunia.Encoding/Apple2e.cs @@ -230,10 +230,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -312,20 +310,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -388,10 +380,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -467,20 +450,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Apple IIe character to an Unicode character /// /// Unicode character. /// Apple IIe character. - static char GetChar(byte character) - { - return Apple2eTable[character]; - } + static char GetChar(byte character) => Apple2eTable[character]; /// /// Converts a Unicode character to an Apple IIe character diff --git a/Claunia.Encoding/Apple2gs.cs b/Claunia.Encoding/Apple2gs.cs index b1fa0e8..39db57a 100644 --- a/Claunia.Encoding/Apple2gs.cs +++ b/Claunia.Encoding/Apple2gs.cs @@ -231,10 +231,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -313,20 +311,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -389,10 +381,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -468,20 +451,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Apple IIgs character to an Unicode character /// /// Unicode character. /// Apple IIgs character. - static char GetChar(byte character) - { - return Apple2gsTable[character]; - } + static char GetChar(byte character) => Apple2gsTable[character]; /// /// Converts a Unicode character to an Apple IIgs character diff --git a/Claunia.Encoding/AtariST.cs b/Claunia.Encoding/AtariST.cs index ce6d1a6..80d2ca4 100644 --- a/Claunia.Encoding/AtariST.cs +++ b/Claunia.Encoding/AtariST.cs @@ -231,10 +231,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -313,20 +311,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -389,10 +381,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -468,20 +451,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Atari ST character to an Unicode character /// /// Unicode character. /// Atari ST character. - static char GetChar(byte character) - { - return AtariSTTable[character]; - } + static char GetChar(byte character) => AtariSTTable[character]; /// /// Converts a Unicode character to an Atari ST character diff --git a/Claunia.Encoding/Encoding.cs b/Claunia.Encoding/Encoding.cs index ecdb0f3..b03254a 100644 --- a/Claunia.Encoding/Encoding.cs +++ b/Claunia.Encoding/Encoding.cs @@ -130,14 +130,12 @@ namespace Claunia.Encoding /// Returns an array that contains all encodings. /// /// An array that contains all encodings. - public new static IEnumerable GetEncodings() - { - return (from type in Assembly.GetExecutingAssembly().GetTypes() - where type.IsSubclassOf(typeof(Encoding)) - let encoding = (Encoding)type.GetConstructor(new Type[] { }).Invoke(new object[] { }) - select new EncodingInfo(encoding.CodePage, encoding.BodyName, encoding.EncodingName, false, type)) - .ToArray(); - } + public new static IEnumerable GetEncodings() => + (from type in Assembly.GetExecutingAssembly().GetTypes() + where type.IsSubclassOf(typeof(Encoding)) + let encoding = (Encoding)type.GetConstructor(new Type[] { }).Invoke(new object[] { }) + select new EncodingInfo(encoding.CodePage, encoding.BodyName, encoding.EncodingName, false, type)) + .ToArray(); /// /// Returns the encoding associated with the specified code page name. diff --git a/Claunia.Encoding/EncodingInfo.cs b/Claunia.Encoding/EncodingInfo.cs index 7be1773..1734d3f 100644 --- a/Claunia.Encoding/EncodingInfo.cs +++ b/Claunia.Encoding/EncodingInfo.cs @@ -11,8 +11,8 @@ namespace Claunia.Encoding /// public sealed class EncodingInfo { - bool isSystem; - Type thisType; + bool isSystem; + readonly Type thisType; internal EncodingInfo(int codePage, string name, string displayName, bool system = true, Type internalType = null) @@ -49,10 +49,7 @@ namespace Claunia.Encoding /// A object that corresponds to the current /// object. /// - public Encoding GetEncoding() - { - return (Encoding)thisType.GetConstructor(new Type[] { }).Invoke(new object[] { }); - } + public Encoding GetEncoding() => (Encoding)thisType.GetConstructor(new Type[] { }).Invoke(new object[] { }); /// /// Gets a value indicating whether the specified object is equal to the current EncodingInfo object. @@ -62,18 +59,12 @@ namespace Claunia.Encoding /// true if value is a and is equal to the current /// ; otherwise, false. /// - public override bool Equals(object value) - { - return value is EncodingInfo that && CodePage == that.CodePage; - } + public override bool Equals(object value) => value is EncodingInfo that && CodePage == that.CodePage; /// /// Returns the hash code for the current EncodingInfo object. /// /// A 32-bit signed integer hash code. - public override int GetHashCode() - { - return CodePage; - } + public override int GetHashCode() => CodePage; } } \ No newline at end of file diff --git a/Claunia.Encoding/Gem.cs b/Claunia.Encoding/Gem.cs index 53e1365..feb6f2f 100644 --- a/Claunia.Encoding/Gem.cs +++ b/Claunia.Encoding/Gem.cs @@ -231,10 +231,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -313,20 +311,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -389,10 +381,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -468,20 +451,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a GEM character to an Unicode character /// /// Unicode character. /// GEM character. - static char GetChar(byte character) - { - return GemTable[character]; - } + static char GetChar(byte character) => GemTable[character]; /// /// Converts a Unicode character to an GEM character diff --git a/Claunia.Encoding/Geos.cs b/Claunia.Encoding/Geos.cs index 049e40e..8d7b108 100644 --- a/Claunia.Encoding/Geos.cs +++ b/Claunia.Encoding/Geos.cs @@ -232,10 +232,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -314,20 +312,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -390,10 +382,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -469,20 +452,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a GEOS character to an Unicode character /// /// Unicode character. /// GEOS character. - static char GetChar(byte character) - { - return GeosTable[character]; - } + static char GetChar(byte character) => GeosTable[character]; /// /// Converts a Unicode character to an GEOS character diff --git a/Claunia.Encoding/LisaRoman.cs b/Claunia.Encoding/LisaRoman.cs index 195c196..40c0710 100644 --- a/Claunia.Encoding/LisaRoman.cs +++ b/Claunia.Encoding/LisaRoman.cs @@ -231,10 +231,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -313,20 +311,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -389,10 +381,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -468,20 +451,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a LisaRoman character to an Unicode character /// /// Unicode character. /// LisaRoman character. - static char GetChar(byte character) - { - return LisaRomanTable[character]; - } + static char GetChar(byte character) => LisaRomanTable[character]; /// /// Converts a Unicode character to an LisaRoman character diff --git a/Claunia.Encoding/MacArabic.cs b/Claunia.Encoding/MacArabic.cs index ba5355a..e86acdb 100644 --- a/Claunia.Encoding/MacArabic.cs +++ b/Claunia.Encoding/MacArabic.cs @@ -230,10 +230,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -312,20 +310,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -388,10 +380,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -467,20 +450,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Mac Arabic character to an Unicode character /// /// Unicode character. /// Mac Arabic character. - static char GetChar(byte character) - { - return MacArabicTable[character]; - } + static char GetChar(byte character) => MacArabicTable[character]; /// /// Converts a Unicode character to an Mac Arabic character diff --git a/Claunia.Encoding/MacCentralEuropean.cs b/Claunia.Encoding/MacCentralEuropean.cs index 73f6cf2..ab1e99f 100644 --- a/Claunia.Encoding/MacCentralEuropean.cs +++ b/Claunia.Encoding/MacCentralEuropean.cs @@ -230,10 +230,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -312,20 +310,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -388,10 +380,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -467,20 +450,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Mac CentralEuropean character to an Unicode character /// /// Unicode character. /// Mac CentralEuropean character. - static char GetChar(byte character) - { - return MacCentralEuropeanTable[character]; - } + static char GetChar(byte character) => MacCentralEuropeanTable[character]; /// /// Converts a Unicode character to an Mac CentralEuropean character diff --git a/Claunia.Encoding/MacCroatian.cs b/Claunia.Encoding/MacCroatian.cs index 0a17630..d7bd131 100644 --- a/Claunia.Encoding/MacCroatian.cs +++ b/Claunia.Encoding/MacCroatian.cs @@ -230,10 +230,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -312,20 +310,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -388,10 +380,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -467,20 +450,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Mac Croatian character to an Unicode character /// /// Unicode character. /// Mac Croatian character. - static char GetChar(byte character) - { - return MacCroatianTable[character]; - } + static char GetChar(byte character) => MacCroatianTable[character]; /// /// Converts a Unicode character to an Mac Croatian character diff --git a/Claunia.Encoding/MacCyrillic.cs b/Claunia.Encoding/MacCyrillic.cs index 8aebc1c..b2131be 100644 --- a/Claunia.Encoding/MacCyrillic.cs +++ b/Claunia.Encoding/MacCyrillic.cs @@ -230,10 +230,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -312,20 +310,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -388,10 +380,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -467,20 +450,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Mac Cyrillic character to an Unicode character /// /// Unicode character. /// Mac Cyrillic character. - static char GetChar(byte character) - { - return MacCyrillicTable[character]; - } + static char GetChar(byte character) => MacCyrillicTable[character]; /// /// Converts a Unicode character to an Mac Cyrillic character diff --git a/Claunia.Encoding/MacFarsi.cs b/Claunia.Encoding/MacFarsi.cs index e0544aa..454829f 100644 --- a/Claunia.Encoding/MacFarsi.cs +++ b/Claunia.Encoding/MacFarsi.cs @@ -230,10 +230,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -312,20 +310,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -388,10 +380,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -467,20 +450,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Mac Farsi character to an Unicode character /// /// Unicode character. /// Mac Farsi character. - static char GetChar(byte character) - { - return MacFarsiTable[character]; - } + static char GetChar(byte character) => MacFarsiTable[character]; /// /// Converts a Unicode character to an Mac Farsi character diff --git a/Claunia.Encoding/MacGreek.cs b/Claunia.Encoding/MacGreek.cs index 30c9af8..4ab03f5 100644 --- a/Claunia.Encoding/MacGreek.cs +++ b/Claunia.Encoding/MacGreek.cs @@ -230,10 +230,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -312,20 +310,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -388,10 +380,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -467,20 +450,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Mac Greek character to an Unicode character /// /// Unicode character. /// Mac Greek character. - static char GetChar(byte character) - { - return MacGreekTable[character]; - } + static char GetChar(byte character) => MacGreekTable[character]; /// /// Converts a Unicode character to an Mac Greek character diff --git a/Claunia.Encoding/MacHebrew.cs b/Claunia.Encoding/MacHebrew.cs index 8c58507..e7b2517 100644 --- a/Claunia.Encoding/MacHebrew.cs +++ b/Claunia.Encoding/MacHebrew.cs @@ -233,10 +233,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -315,20 +313,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -391,10 +383,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -470,20 +453,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Mac Hebrew character to an Unicode character /// /// Unicode character. /// Mac Hebrew character. - static char GetChar(byte character) - { - return MacHebrewTable[character]; - } + static char GetChar(byte character) => MacHebrewTable[character]; /// /// Converts a Unicode character to an Mac Hebrew character diff --git a/Claunia.Encoding/MacRoman.cs b/Claunia.Encoding/MacRoman.cs index e0857bc..de7e12b 100644 --- a/Claunia.Encoding/MacRoman.cs +++ b/Claunia.Encoding/MacRoman.cs @@ -231,10 +231,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -313,20 +311,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -389,10 +381,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -468,20 +451,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a MacRoman character to an Unicode character /// /// Unicode character. /// MacRoman character. - static char GetChar(byte character) - { - return MacRomanTable[character]; - } + static char GetChar(byte character) => MacRomanTable[character]; /// /// Converts a Unicode character to an MacRoman character diff --git a/Claunia.Encoding/MacRomanian.cs b/Claunia.Encoding/MacRomanian.cs index 201aeda..6e1bbaa 100644 --- a/Claunia.Encoding/MacRomanian.cs +++ b/Claunia.Encoding/MacRomanian.cs @@ -231,10 +231,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -313,20 +311,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -389,10 +381,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -468,20 +451,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a MacRomanian character to an Unicode character /// /// Unicode character. /// MacRomanian character. - static char GetChar(byte character) - { - return MacRomanianTable[character]; - } + static char GetChar(byte character) => MacRomanianTable[character]; /// /// Converts a Unicode character to an MacRomanian character diff --git a/Claunia.Encoding/MacTurkish.cs b/Claunia.Encoding/MacTurkish.cs index 98aa547..9c91d75 100644 --- a/Claunia.Encoding/MacTurkish.cs +++ b/Claunia.Encoding/MacTurkish.cs @@ -230,10 +230,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -312,20 +310,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -388,10 +380,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -467,20 +450,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Mac Turkish character to an Unicode character /// /// Unicode character. /// Mac Turkish character. - static char GetChar(byte character) - { - return MacTurkishTable[character]; - } + static char GetChar(byte character) => MacTurkishTable[character]; /// /// Converts a Unicode character to an Mac Turkish character diff --git a/Claunia.Encoding/MacUkrainian.cs b/Claunia.Encoding/MacUkrainian.cs index 6172e94..f167e00 100644 --- a/Claunia.Encoding/MacUkrainian.cs +++ b/Claunia.Encoding/MacUkrainian.cs @@ -230,10 +230,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -312,20 +310,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -388,10 +380,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -467,20 +450,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Mac Ukrainian character to an Unicode character /// /// Unicode character. /// Mac Ukrainian character. - static char GetChar(byte character) - { - return MacUkrainianTable[character]; - } + static char GetChar(byte character) => MacUkrainianTable[character]; /// /// Converts a Unicode character to an Mac Ukrainian character diff --git a/Claunia.Encoding/PETSCII.cs b/Claunia.Encoding/PETSCII.cs index 5d11082..82f9bfb 100644 --- a/Claunia.Encoding/PETSCII.cs +++ b/Claunia.Encoding/PETSCII.cs @@ -231,10 +231,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -313,20 +311,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -389,10 +381,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -468,20 +451,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a PETSCII character to an Unicode character /// /// Unicode character. /// PETSCII character. - static char GetChar(byte character) - { - return PETSCIITable[character]; - } + static char GetChar(byte character) => PETSCIITable[character]; /// /// Converts a Unicode character to an PETSCII character diff --git a/Claunia.Encoding/Radix50.cs b/Claunia.Encoding/Radix50.cs index 5002a46..ef91b48 100644 --- a/Claunia.Encoding/Radix50.cs +++ b/Claunia.Encoding/Radix50.cs @@ -182,10 +182,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -295,20 +293,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -371,10 +363,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -476,20 +459,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a Apple II character to an Unicode character /// /// Unicode character. /// Apple II character. - static char GetChar(byte character) - { - return Radix50Table[character & 0x3F]; - } + static char GetChar(byte character) => Radix50Table[character & 0x3F]; /// /// Converts a Unicode character to an Apple II character diff --git a/Claunia.Encoding/ZX80.cs b/Claunia.Encoding/ZX80.cs index 2c76a22..1be73bd 100644 --- a/Claunia.Encoding/ZX80.cs +++ b/Claunia.Encoding/ZX80.cs @@ -230,10 +230,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -312,20 +310,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -388,10 +380,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -467,20 +450,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a ZX80 character to an Unicode character /// /// Unicode character. /// ZX80 character. - static char GetChar(byte character) - { - return ZX80Table[character]; - } + static char GetChar(byte character) => ZX80Table[character]; /// /// Converts a Unicode character to an ZX80 character diff --git a/Claunia.Encoding/ZX81.cs b/Claunia.Encoding/ZX81.cs index d1e20dc..3a3bae4 100644 --- a/Claunia.Encoding/ZX81.cs +++ b/Claunia.Encoding/ZX81.cs @@ -230,10 +230,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -312,20 +310,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -388,10 +380,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -467,20 +450,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a ZX81 character to an Unicode character /// /// Unicode character. /// ZX81 character. - static char GetChar(byte character) - { - return ZX81Table[character]; - } + static char GetChar(byte character) => ZX81Table[character]; /// /// Converts a Unicode character to an ZX81 character diff --git a/Claunia.Encoding/ZXSpectrum.cs b/Claunia.Encoding/ZXSpectrum.cs index 3cfb722..5c8159e 100644 --- a/Claunia.Encoding/ZXSpectrum.cs +++ b/Claunia.Encoding/ZXSpectrum.cs @@ -230,10 +230,8 @@ namespace Claunia.Encoding /// The number of characters to encode. /// The byte array to contain the resulting sequence of bytes. /// The index at which to start writing the resulting sequence of bytes. - public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) - { - return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); - } + public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) => + GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex); /// /// Encodes all the characters in the specified string into a sequence of bytes. @@ -312,20 +310,14 @@ namespace Claunia.Encoding /// /// A byte array containing the results of encoding the specified set of characters. /// The character array containing the characters to encode. - public override byte[] GetBytes(char[] chars) - { - return GetBytes(chars, 0, chars.Length); - } + public override byte[] GetBytes(char[] chars) => GetBytes(chars, 0, chars.Length); /// /// Calculates the number of characters produced by decoding all the bytes in the specified byte array. /// /// The number of characters produced by decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override int GetCharCount(byte[] bytes) - { - return GetCharCount(bytes, 0, bytes.Length); - } + public override int GetCharCount(byte[] bytes) => GetCharCount(bytes, 0, bytes.Length); /// /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. @@ -388,10 +380,7 @@ namespace Claunia.Encoding /// /// A character array containing the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override char[] GetChars(byte[] bytes) - { - return GetChars(bytes, 0, bytes.Length); - } + public override char[] GetChars(byte[] bytes) => GetChars(bytes, 0, bytes.Length); /// /// 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. /// /// A byte array of length zero, as a preamble is not required. - public override byte[] GetPreamble() - { - return new byte[0]; - } + public override byte[] GetPreamble() => new byte[0]; /// /// Decodes all the bytes in the specified byte array into a string. /// /// A string that contains the results of decoding the specified sequence of bytes. /// The byte array containing the sequence of bytes to decode. - public override string GetString(byte[] bytes) - { - return GetString(bytes, 0, bytes.Length); - } + public override string GetString(byte[] bytes) => GetString(bytes, 0, bytes.Length); /// /// Decodes a sequence of bytes from the specified byte array into a string. @@ -467,20 +450,15 @@ namespace Claunia.Encoding /// The byte array containing the sequence of bytes to decode. /// The index of the first byte to decode. /// The number of bytes to decode. - public override string GetString(byte[] bytes, int index, int count) - { - return new string(GetChars(bytes, index, count)); - } + public override string GetString(byte[] bytes, int index, int count) => + new string(GetChars(bytes, index, count)); /// /// Converts a ZX Spectrum character to an Unicode character /// /// Unicode character. /// ZX Spectrum character. - static char GetChar(byte character) - { - return ZXSpectrumTable[character]; - } + static char GetChar(byte character) => ZXSpectrumTable[character]; /// /// Converts a Unicode character to an ZX Spectrum character