From 1bef17c7a0571c10e165c36a7f4711d851b5571b Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 12 Oct 2017 21:11:04 +0100 Subject: [PATCH] Added code to get a list of available encodings. --- .../Claunia.Encoding.Tests.csproj | 1 + Claunia.Encoding.Tests/GetEncs.cs | 56 ++++++++++++ Claunia.Encoding/ATASCII.cs | 24 ++--- Claunia.Encoding/AtariST.cs | 24 ++--- Claunia.Encoding/Claunia.Encoding.csproj | 11 +-- Claunia.Encoding/Encoding.cs | 85 ++++++++++++++++- Claunia.Encoding/EncodingInfo.cs | 91 +++++++++++++++++++ Claunia.Encoding/LisaRoman.cs | 24 ++--- Claunia.Encoding/PETSCII.cs | 24 ++--- Claunia.Encoding/ZX80.cs | 24 ++--- Claunia.Encoding/ZX81.cs | 24 ++--- Claunia.Encoding/ZXSpectrum.cs | 24 ++--- 12 files changed, 319 insertions(+), 93 deletions(-) create mode 100644 Claunia.Encoding.Tests/GetEncs.cs create mode 100644 Claunia.Encoding/EncodingInfo.cs diff --git a/Claunia.Encoding.Tests/Claunia.Encoding.Tests.csproj b/Claunia.Encoding.Tests/Claunia.Encoding.Tests.csproj index 69ff951..8b9eff7 100644 --- a/Claunia.Encoding.Tests/Claunia.Encoding.Tests.csproj +++ b/Claunia.Encoding.Tests/Claunia.Encoding.Tests.csproj @@ -37,6 +37,7 @@ + diff --git a/Claunia.Encoding.Tests/GetEncs.cs b/Claunia.Encoding.Tests/GetEncs.cs new file mode 100644 index 0000000..b086823 --- /dev/null +++ b/Claunia.Encoding.Tests/GetEncs.cs @@ -0,0 +1,56 @@ +// +// GetEncs.cs +// +// Author: +// Natalia Portillo +// +// Copyright (c) 2017 Copyright © Claunia.com +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using NUnit.Framework; + +namespace Claunia.Encoding.Tests +{ + [TestFixture] + public class GetEncs + { + [Test] + // Well basically this is taken from MSDN's documentation :p + public void GetAllEncs() + { + // Print the header. + Console.Write("CodePage identifier and name "); + Console.Write("BrDisp BrSave "); + Console.Write("MNDisp MNSave "); + Console.WriteLine("1-Byte ReadOnly "); + + // For every encoding, get the property values. + foreach(EncodingInfo ei in Encoding.GetEncodings()) + { + Encoding e = ei.GetEncoding(); + + Console.Write("{0,-6} {1,-25} ", ei.CodePage, ei.Name); + Console.Write("{0,-8} {1,-8} ", e.IsBrowserDisplay, e.IsBrowserSave); + Console.Write("{0,-8} {1,-8} ", e.IsMailNewsDisplay, e.IsMailNewsSave); + Console.WriteLine("{0,-8} {1,-8} ", e.IsSingleByte, e.IsReadOnly); + } + } + } +} diff --git a/Claunia.Encoding/ATASCII.cs b/Claunia.Encoding/ATASCII.cs index 397f0f2..9745d84 100644 --- a/Claunia.Encoding/ATASCII.cs +++ b/Claunia.Encoding/ATASCII.cs @@ -31,7 +31,7 @@ namespace Claunia.Encoding /// /// Represents an ATARI Standard Code for Information Interchange character encoding of Unicode characters. /// - public class ATASCII : System.Text.Encoding + public class ATASCII : Encoding { const string _bodyname = "atascii"; const int _codepage = 0; @@ -50,28 +50,28 @@ namespace Claunia.Encoding /// /// Gets a value indicating whether the current encoding can be used by browser clients for displaying content. /// - public bool IsBrowserDisplay { + public override bool IsBrowserDisplay { get { return browserDisplay; } } /// /// Gets a value indicating whether the current encoding can be used by browser clients for saving content. /// - public bool IsBrowserSave { + public override bool IsBrowserSave { get { return browserSave; } } /// /// Gets a value indicating whether the current encoding can be used by mail and news clients for displaying content. /// - public bool IsMailNewsDisplay { + public override bool IsMailNewsDisplay { get { return mailNewsDisplay; } } /// /// Gets a value indicating whether the current encoding can be used by mail and news clients for saving content. /// - public bool IsMailNewsSave { + public override bool IsMailNewsSave { get { return mailNewsSave; } } @@ -79,35 +79,35 @@ namespace Claunia.Encoding /// Gets a value indicating whether the current encoding is read-only. /// /// The is single byte. - public bool IsReadOnly { + public override bool IsReadOnly { get { return readOnly; } } /// /// Gets a value indicating whether the current encoding uses single-byte code points. /// - public bool IsSingleByte { + public override bool IsSingleByte { get { return singleByte; } } /// /// Gets the code page identifier of the current Encoding. /// - public int CodePage { + public override int CodePage { get { return _codepage; } } /// /// Gets a name for the current encoding that can be used with mail agent body tags /// - public string BodyName { + public override string BodyName { get { return _bodyname; } } /// /// Gets a name for the current encoding that can be used with mail agent header tags /// - public string HeaderName { + public override string HeaderName { get { return _headername; } } @@ -121,14 +121,14 @@ namespace Claunia.Encoding /// /// Gets the human-readable description of the current encoding. /// - public string EncodingName { + public override string EncodingName { get { return _encodingname; } } /// /// Gets the Windows operating system code page that most closely corresponds to the current encoding. /// - public int WindowsCodePage { + public override int WindowsCodePage { get { return _windowsCodepage; } } diff --git a/Claunia.Encoding/AtariST.cs b/Claunia.Encoding/AtariST.cs index 704fbfd..504f33e 100644 --- a/Claunia.Encoding/AtariST.cs +++ b/Claunia.Encoding/AtariST.cs @@ -32,7 +32,7 @@ namespace Claunia.Encoding /// Represents an Atari ST character encoding of Unicode characters. /// // TODO: 0x09 => U+1F552, 0x0A => U+1F514 - public class AtariST : System.Text.Encoding + public class AtariST : Encoding { const string _bodyname = "atarist"; const int _codepage = 0; @@ -51,28 +51,28 @@ namespace Claunia.Encoding /// /// Gets a value indicating whether the current encoding can be used by browser clients for displaying content. /// - public bool IsBrowserDisplay { + public override bool IsBrowserDisplay { get { return browserDisplay; } } /// /// Gets a value indicating whether the current encoding can be used by browser clients for saving content. /// - public bool IsBrowserSave { + public override bool IsBrowserSave { get { return browserSave; } } /// /// Gets a value indicating whether the current encoding can be used by mail and news clients for displaying content. /// - public bool IsMailNewsDisplay { + public override bool IsMailNewsDisplay { get { return mailNewsDisplay; } } /// /// Gets a value indicating whether the current encoding can be used by mail and news clients for saving content. /// - public bool IsMailNewsSave { + public override bool IsMailNewsSave { get { return mailNewsSave; } } @@ -80,35 +80,35 @@ namespace Claunia.Encoding /// Gets a value indicating whether the current encoding is read-only. /// /// The is single byte. - public bool IsReadOnly { + public override bool IsReadOnly { get { return readOnly; } } /// /// Gets a value indicating whether the current encoding uses single-byte code points. /// - public bool IsSingleByte { + public override bool IsSingleByte { get { return singleByte; } } /// /// Gets the code page identifier of the current Encoding. /// - public int CodePage { + public override int CodePage { get { return _codepage; } } /// /// Gets a name for the current encoding that can be used with mail agent body tags /// - public string BodyName { + public override string BodyName { get { return _bodyname; } } /// /// Gets a name for the current encoding that can be used with mail agent header tags /// - public string HeaderName { + public override string HeaderName { get { return _headername; } } @@ -122,14 +122,14 @@ namespace Claunia.Encoding /// /// Gets the human-readable description of the current encoding. /// - public string EncodingName { + public override string EncodingName { get { return _encodingname; } } /// /// Gets the Windows operating system code page that most closely corresponds to the current encoding. /// - public int WindowsCodePage { + public override int WindowsCodePage { get { return _windowsCodepage; } } diff --git a/Claunia.Encoding/Claunia.Encoding.csproj b/Claunia.Encoding/Claunia.Encoding.csproj index 634bf5f..12dc059 100644 --- a/Claunia.Encoding/Claunia.Encoding.csproj +++ b/Claunia.Encoding/Claunia.Encoding.csproj @@ -54,6 +54,7 @@ + @@ -73,14 +74,8 @@ - - - - - - - - + + diff --git a/Claunia.Encoding/Encoding.cs b/Claunia.Encoding/Encoding.cs index 52f062a..d5a8165 100644 --- a/Claunia.Encoding/Encoding.cs +++ b/Claunia.Encoding/Encoding.cs @@ -24,12 +24,16 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +using System; +using System.Collections.Generic; +using System.Reflection; + namespace Claunia.Encoding { /// /// This class contains static instances of the supported encodings. /// - public static class Encoding + public abstract class Encoding : System.Text.Encoding { /// /// Static instance for the LisaRoman encoding @@ -47,6 +51,85 @@ namespace Claunia.Encoding /// Static instance for the PETSCII encoding /// public static System.Text.Encoding PETEncoding = new PETSCII(); + + /// + /// Returns an array that contains all encodings. + /// + /// An array that contains all encodings. + public static EncodingInfo[] GetEncodings() + { + List encodings = new List(); + + foreach(Type type in Assembly.GetExecutingAssembly().GetTypes()) { + if(type.IsSubclassOf(typeof(Encoding))) { + Encoding filter = (Encoding)type.GetConstructor(new Type[] {}).Invoke(new object[] { }); + encodings.Add(new EncodingInfo(filter.CodePage, filter.BodyName, filter.EncodingName, false, type)); + } + } + + return encodings.ToArray(); + } + + /// + /// Gets a value indicating whether the current encoding can be used by browser clients for displaying content. + /// + public abstract bool IsBrowserDisplay { get; } + + /// + /// Gets a value indicating whether the current encoding can be used by browser clients for saving content. + /// + public abstract bool IsBrowserSave{ get; } + + /// + /// Gets a value indicating whether the current encoding can be used by mail and news clients for displaying content. + /// + public abstract bool IsMailNewsDisplay{ get; } + + /// + /// Gets a value indicating whether the current encoding can be used by mail and news clients for saving content. + /// + public abstract bool IsMailNewsSave{ get; } + + /// + /// Gets a value indicating whether the current encoding is read-only. + /// + /// The is single byte. + public abstract bool IsReadOnly{ get; } + + /// + /// Gets a value indicating whether the current encoding uses single-byte code points. + /// + public abstract bool IsSingleByte{ get; } + + /// + /// Gets the code page identifier of the current Encoding. + /// + public abstract int CodePage{ get; } + + /// + /// Gets a name for the current encoding that can be used with mail agent body tags + /// + public abstract string BodyName{ get; } + + /// + /// Gets a name for the current encoding that can be used with mail agent header tags + /// + public abstract string HeaderName{ get; } + + /// + /// Ggets the name registered with the Internet Assigned Numbers Authority (IANA) for the current encoding. + /// + public abstract override string WebName{ get; } + + /// + /// Gets the human-readable description of the current encoding. + /// + public abstract string EncodingName{ get; } + + /// + /// Gets the Windows operating system code page that most closely corresponds to the current encoding. + /// + public abstract int WindowsCodePage{ get; } } } diff --git a/Claunia.Encoding/EncodingInfo.cs b/Claunia.Encoding/EncodingInfo.cs new file mode 100644 index 0000000..f7866fe --- /dev/null +++ b/Claunia.Encoding/EncodingInfo.cs @@ -0,0 +1,91 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace Claunia.Encoding +{ + /// + /// Provides basic information about an encoding. + /// + public sealed class EncodingInfo + { + private int iCodePage; // Code Page # + private string strEncodingName; // Short name (web name) + private string strDisplayName; // Full localized name + private bool isSystem; + private Type thisType; + + internal EncodingInfo(int codePage, string name, string displayName, bool system = true, Type internalType = null) + { + iCodePage = codePage; + strEncodingName = name; + strDisplayName = displayName; + isSystem = system; + thisType = internalType; + } + + /// + /// Gets the code page identifier of the encoding. + /// + /// The code page identifier of the encoding. + public int CodePage { + get { + return iCodePage; + } + } + + /// + /// Gets the name registered with the Internet Assigned Numbers Authority (IANA) for the encoding. + /// + /// The IANA name for the encoding. For more information about the IANA, see www.iana.org. + public string Name { + get { + return strEncodingName; + } + } + + /// + /// Gets the human-readable description of the encoding. + /// + /// The human-readable description of the encoding. + public string DisplayName { + get { + return strDisplayName; + } + } + + /// + /// Returns a Encoding object that corresponds to the current EncodingInfo object. + /// + /// A object that corresponds to the current object. + public Encoding GetEncoding() + { + return (Encoding)thisType.GetConstructor(new Type[] { }).Invoke(new object[] { }); + } + + /// + /// Gets a value indicating whether the specified object is equal to the current EncodingInfo object. + /// + /// An object to compare to the current object. + /// true if value is a and is equal to the current ; otherwise, false. + public override bool Equals(Object value) + { + EncodingInfo that = value as EncodingInfo; + if(that != null) { + return (this.CodePage == that.CodePage); + } + return (false); + } + + /// + /// Returns the hash code for the current EncodingInfo object. + /// + /// A 32-bit signed integer hash code. + public override int GetHashCode() + { + return this.CodePage; + } + } +} \ No newline at end of file diff --git a/Claunia.Encoding/LisaRoman.cs b/Claunia.Encoding/LisaRoman.cs index 5f65d55..295b693 100644 --- a/Claunia.Encoding/LisaRoman.cs +++ b/Claunia.Encoding/LisaRoman.cs @@ -31,7 +31,7 @@ namespace Claunia.Encoding /// /// Represents an Apple Lisa character encoding of Unicode characters. /// - public class LisaRoman : System.Text.Encoding + public class LisaRoman : Encoding { const string _bodyname = "lisa"; const int _codepage = 0; @@ -50,28 +50,28 @@ namespace Claunia.Encoding /// /// Gets a value indicating whether the current encoding can be used by browser clients for displaying content. /// - public bool IsBrowserDisplay { + public override bool IsBrowserDisplay { get { return browserDisplay; } } /// /// Gets a value indicating whether the current encoding can be used by browser clients for saving content. /// - public bool IsBrowserSave { + public override bool IsBrowserSave { get { return browserSave; } } /// /// Gets a value indicating whether the current encoding can be used by mail and news clients for displaying content. /// - public bool IsMailNewsDisplay { + public override bool IsMailNewsDisplay { get { return mailNewsDisplay; } } /// /// Gets a value indicating whether the current encoding can be used by mail and news clients for saving content. /// - public bool IsMailNewsSave { + public override bool IsMailNewsSave { get { return mailNewsSave; } } @@ -79,35 +79,35 @@ namespace Claunia.Encoding /// Gets a value indicating whether the current encoding is read-only. /// /// The is single byte. - public bool IsReadOnly { + public override bool IsReadOnly { get { return readOnly; } } /// /// Gets a value indicating whether the current encoding uses single-byte code points. /// - public bool IsSingleByte { + public override bool IsSingleByte { get { return singleByte; } } /// /// Gets the code page identifier of the current Encoding. /// - public int CodePage { + public override int CodePage { get { return _codepage; } } /// /// Gets a name for the current encoding that can be used with mail agent body tags /// - public string BodyName { + public override string BodyName { get { return _bodyname; } } /// /// Gets a name for the current encoding that can be used with mail agent header tags /// - public string HeaderName { + public override string HeaderName { get { return _headername; } } @@ -121,14 +121,14 @@ namespace Claunia.Encoding /// /// Gets the human-readable description of the current encoding. /// - public string EncodingName { + public override string EncodingName { get { return _encodingname; } } /// /// Gets the Windows operating system code page that most closely corresponds to the current encoding. /// - public int WindowsCodePage { + public override int WindowsCodePage { get { return _windowsCodepage; } } diff --git a/Claunia.Encoding/PETSCII.cs b/Claunia.Encoding/PETSCII.cs index 4687794..f3b0aa6 100644 --- a/Claunia.Encoding/PETSCII.cs +++ b/Claunia.Encoding/PETSCII.cs @@ -31,7 +31,7 @@ namespace Claunia.Encoding /// /// Represents an Commodore PET Standard Code for Information Interchange (aka CBM ASCII) character encoding of Unicode characters. /// - public class PETSCII : System.Text.Encoding + public class PETSCII : Encoding { const string _bodyname = "petscii"; const int _codepage = 0; @@ -50,7 +50,7 @@ namespace Claunia.Encoding /// /// Gets a value indicating whether the current encoding can be used by browser clients for displaying content. /// - public bool IsBrowserDisplay + public override bool IsBrowserDisplay { get { return browserDisplay; } } @@ -58,7 +58,7 @@ namespace Claunia.Encoding /// /// Gets a value indicating whether the current encoding can be used by browser clients for saving content. /// - public bool IsBrowserSave + public override bool IsBrowserSave { get { return browserSave; } } @@ -66,7 +66,7 @@ namespace Claunia.Encoding /// /// Gets a value indicating whether the current encoding can be used by mail and news clients for displaying content. /// - public bool IsMailNewsDisplay + public override bool IsMailNewsDisplay { get { return mailNewsDisplay; } } @@ -74,7 +74,7 @@ namespace Claunia.Encoding /// /// Gets a value indicating whether the current encoding can be used by mail and news clients for saving content. /// - public bool IsMailNewsSave + public override bool IsMailNewsSave { get { return mailNewsSave; } } @@ -82,7 +82,7 @@ namespace Claunia.Encoding /// /// Gets a value indicating whether the current encoding is read-only. /// - public bool IsReadOnly + public override bool IsReadOnly { get { return readOnly; } } @@ -90,7 +90,7 @@ namespace Claunia.Encoding /// /// Gets a value indicating whether the current encoding uses single-byte code points. /// - public bool IsSingleByte + public override bool IsSingleByte { get { return singleByte; } } @@ -98,7 +98,7 @@ namespace Claunia.Encoding /// /// Gets the code page identifier of the current Encoding. /// - public int CodePage + public override int CodePage { get { return _codepage; } } @@ -106,7 +106,7 @@ namespace Claunia.Encoding /// /// Gets a name for the current encoding that can be used with mail agent body tags /// - public string BodyName + public override string BodyName { get { return _bodyname; } } @@ -114,7 +114,7 @@ namespace Claunia.Encoding /// /// Gets a name for the current encoding that can be used with mail agent header tags /// - public string HeaderName + public override string HeaderName { get { return _headername; } } @@ -130,7 +130,7 @@ namespace Claunia.Encoding /// /// Gets the human-readable description of the current encoding. /// - public string EncodingName + public override string EncodingName { get { return _encodingname; } } @@ -138,7 +138,7 @@ namespace Claunia.Encoding /// /// Gets the Windows operating system code page that most closely corresponds to the current encoding. /// - public int WindowsCodePage + public override int WindowsCodePage { get { return _windowsCodepage; } } diff --git a/Claunia.Encoding/ZX80.cs b/Claunia.Encoding/ZX80.cs index 77e22f6..e818453 100644 --- a/Claunia.Encoding/ZX80.cs +++ b/Claunia.Encoding/ZX80.cs @@ -31,7 +31,7 @@ namespace Claunia.Encoding /// /// Represents a ZX80 character encoding of Unicode characters. /// - public class ZX80 : System.Text.Encoding + public class ZX80 : Encoding { const string _bodyname = "zx80"; const int _codepage = 0; @@ -50,28 +50,28 @@ namespace Claunia.Encoding /// /// Gets a value indicating whether the current encoding can be used by browser clients for displaying content. /// - public bool IsBrowserDisplay { + public override bool IsBrowserDisplay { get { return browserDisplay; } } /// /// Gets a value indicating whether the current encoding can be used by browser clients for saving content. /// - public bool IsBrowserSave { + public override bool IsBrowserSave { get { return browserSave; } } /// /// Gets a value indicating whether the current encoding can be used by mail and news clients for displaying content. /// - public bool IsMailNewsDisplay { + public override bool IsMailNewsDisplay { get { return mailNewsDisplay; } } /// /// Gets a value indicating whether the current encoding can be used by mail and news clients for saving content. /// - public bool IsMailNewsSave { + public override bool IsMailNewsSave { get { return mailNewsSave; } } @@ -79,35 +79,35 @@ namespace Claunia.Encoding /// Gets a value indicating whether the current encoding is read-only. /// /// The is single byte. - public bool IsReadOnly { + public override bool IsReadOnly { get { return readOnly; } } /// /// Gets a value indicating whether the current encoding uses single-byte code points. /// - public bool IsSingleByte { + public override bool IsSingleByte { get { return singleByte; } } /// /// Gets the code page identifier of the current Encoding. /// - public int CodePage { + public override int CodePage { get { return _codepage; } } /// /// Gets a name for the current encoding that can be used with mail agent body tags /// - public string BodyName { + public override string BodyName { get { return _bodyname; } } /// /// Gets a name for the current encoding that can be used with mail agent header tags /// - public string HeaderName { + public override string HeaderName { get { return _headername; } } @@ -121,14 +121,14 @@ namespace Claunia.Encoding /// /// Gets the human-readable description of the current encoding. /// - public string EncodingName { + public override string EncodingName { get { return _encodingname; } } /// /// Gets the Windows operating system code page that most closely corresponds to the current encoding. /// - public int WindowsCodePage { + public override int WindowsCodePage { get { return _windowsCodepage; } } diff --git a/Claunia.Encoding/ZX81.cs b/Claunia.Encoding/ZX81.cs index a0fd3a8..244212b 100644 --- a/Claunia.Encoding/ZX81.cs +++ b/Claunia.Encoding/ZX81.cs @@ -31,7 +31,7 @@ namespace Claunia.Encoding /// /// Represents a ZX81 character encoding of Unicode characters. /// - public class ZX81 : System.Text.Encoding + public class ZX81 : Encoding { const string _bodyname = "zx81"; const int _codepage = 0; @@ -50,28 +50,28 @@ namespace Claunia.Encoding /// /// Gets a value indicating whether the current encoding can be used by browser clients for displaying content. /// - public bool IsBrowserDisplay { + public override bool IsBrowserDisplay { get { return browserDisplay; } } /// /// Gets a value indicating whether the current encoding can be used by browser clients for saving content. /// - public bool IsBrowserSave { + public override bool IsBrowserSave { get { return browserSave; } } /// /// Gets a value indicating whether the current encoding can be used by mail and news clients for displaying content. /// - public bool IsMailNewsDisplay { + public override bool IsMailNewsDisplay { get { return mailNewsDisplay; } } /// /// Gets a value indicating whether the current encoding can be used by mail and news clients for saving content. /// - public bool IsMailNewsSave { + public override bool IsMailNewsSave { get { return mailNewsSave; } } @@ -79,35 +79,35 @@ namespace Claunia.Encoding /// Gets a value indicating whether the current encoding is read-only. /// /// The is single byte. - public bool IsReadOnly { + public override bool IsReadOnly { get { return readOnly; } } /// /// Gets a value indicating whether the current encoding uses single-byte code points. /// - public bool IsSingleByte { + public override bool IsSingleByte { get { return singleByte; } } /// /// Gets the code page identifier of the current Encoding. /// - public int CodePage { + public override int CodePage { get { return _codepage; } } /// /// Gets a name for the current encoding that can be used with mail agent body tags /// - public string BodyName { + public override string BodyName { get { return _bodyname; } } /// /// Gets a name for the current encoding that can be used with mail agent header tags /// - public string HeaderName { + public override string HeaderName { get { return _headername; } } @@ -121,14 +121,14 @@ namespace Claunia.Encoding /// /// Gets the human-readable description of the current encoding. /// - public string EncodingName { + public override string EncodingName { get { return _encodingname; } } /// /// Gets the Windows operating system code page that most closely corresponds to the current encoding. /// - public int WindowsCodePage { + public override int WindowsCodePage { get { return _windowsCodepage; } } diff --git a/Claunia.Encoding/ZXSpectrum.cs b/Claunia.Encoding/ZXSpectrum.cs index 54d0ae0..dad531b 100644 --- a/Claunia.Encoding/ZXSpectrum.cs +++ b/Claunia.Encoding/ZXSpectrum.cs @@ -31,7 +31,7 @@ namespace Claunia.Encoding /// /// Represents an ZX Spectrum character encoding of Unicode characters. /// - public class ZXSpectrum : System.Text.Encoding + public class ZXSpectrum : Encoding { const string _bodyname = "spectrum"; const int _codepage = 0; @@ -50,28 +50,28 @@ namespace Claunia.Encoding /// /// Gets a value indicating whether the current encoding can be used by browser clients for displaying content. /// - public bool IsBrowserDisplay { + public override bool IsBrowserDisplay { get { return browserDisplay; } } /// /// Gets a value indicating whether the current encoding can be used by browser clients for saving content. /// - public bool IsBrowserSave { + public override bool IsBrowserSave { get { return browserSave; } } /// /// Gets a value indicating whether the current encoding can be used by mail and news clients for displaying content. /// - public bool IsMailNewsDisplay { + public override bool IsMailNewsDisplay { get { return mailNewsDisplay; } } /// /// Gets a value indicating whether the current encoding can be used by mail and news clients for saving content. /// - public bool IsMailNewsSave { + public override bool IsMailNewsSave { get { return mailNewsSave; } } @@ -79,35 +79,35 @@ namespace Claunia.Encoding /// Gets a value indicating whether the current encoding is read-only. /// /// The is single byte. - public bool IsReadOnly { + public override bool IsReadOnly { get { return readOnly; } } /// /// Gets a value indicating whether the current encoding uses single-byte code points. /// - public bool IsSingleByte { + public override bool IsSingleByte { get { return singleByte; } } /// /// Gets the code page identifier of the current Encoding. /// - public int CodePage { + public override int CodePage { get { return _codepage; } } /// /// Gets a name for the current encoding that can be used with mail agent body tags /// - public string BodyName { + public override string BodyName { get { return _bodyname; } } /// /// Gets a name for the current encoding that can be used with mail agent header tags /// - public string HeaderName { + public override string HeaderName { get { return _headername; } } @@ -121,14 +121,14 @@ namespace Claunia.Encoding /// /// Gets the human-readable description of the current encoding. /// - public string EncodingName { + public override string EncodingName { get { return _encodingname; } } /// /// Gets the Windows operating system code page that most closely corresponds to the current encoding. /// - public int WindowsCodePage { + public override int WindowsCodePage { get { return _windowsCodepage; } }