From e6bf21f9bc9a256e2f0ae6a510674cb2e9c08057 Mon Sep 17 00:00:00 2001 From: Peter Occil Date: Mon, 18 Dec 2023 03:48:32 -0500 Subject: [PATCH] remove Base64Padding property --- CBOR.nuspec | 2 +- CBOR/PeterO/Cbor/JSONOptions.cs | 98 +++++++++------------------------ 2 files changed, 26 insertions(+), 74 deletions(-) diff --git a/CBOR.nuspec b/CBOR.nuspec index e8846015..3aa8a91b 100644 --- a/CBOR.nuspec +++ b/CBOR.nuspec @@ -14,4 +14,4 @@ Version 4.5: - Add support for deserializing CBOR objects to IReadOnlyList, IReadOnlyCollection, and ReadOnlyDictionary Note that after version 4.5x, the CBOR library's repository will stop including special projects for .NET 2.0 and .NET 4.0, leaving the .NET-Standard project for building the library.CC0-1.0https://github.com/peteroupc/CBORPeter OccilA C# implementation of Concise Binary Object Representation (CBOR), a general-purpose binary data format defined in RFC 8949.Peter OccilCBOR (Concise Binary Object Representation)cbor data serialization binary json \ No newline at end of file +> diff --git a/CBOR/PeterO/Cbor/JSONOptions.cs b/CBOR/PeterO/Cbor/JSONOptions.cs index cabb2fd5..3231860c 100644 --- a/CBOR/PeterO/Cbor/JSONOptions.cs +++ b/CBOR/PeterO/Cbor/JSONOptions.cs @@ -101,35 +101,6 @@ public enum ConversionMode public JSONOptions() : this(String.Empty) { } - /// Initializes a new instance of the - /// class with the given value - /// for the Base64Padding option. - /// Whether padding is included when - /// writing data in base64url or traditional base64 format to - /// JSON. - [Obsolete("Use the more readable string constructor instead.")] - public JSONOptions(bool base64Padding) - : this("base64Padding=" + (base64Padding ? "1" : "0")) { - } - - /// Initializes a new instance of the - /// class with the given values - /// for the options. - /// Whether padding is included when - /// writing data in base64url or traditional base64 format to - /// JSON. - /// Whether surrogate code points not - /// part of a surrogate pair (which consists of two consecutive - /// char s forming one Unicode code point) are each replaced - /// with a replacement character (U+FFFD). The default is false; an - /// exception is thrown when such code points are encountered. -#pragma warning disable CS0618 - [Obsolete("Use the more readable string constructor instead.")] - public JSONOptions(bool base64Padding, bool replaceSurrogates) - : this("base64Padding=" + (base64Padding ? "1" : "0") + - ";replacesurrogates=" + (replaceSurrogates ? "1" : "0")) { - } - /// Initializes a new instance of the /// class. /// A string setting forth the options to @@ -139,35 +110,34 @@ public JSONOptions(bool base64Padding, bool replaceSurrogates) /// semicolons or between the equal signs, nor may the string begin or /// end with whitespace. The string can be empty, but cannot be null. /// The following is an example of this parameter: - /// base64padding=false;replacesurrogates=true. The key can be - /// any one of the following where the letters can be any combination - /// of basic upper-case and/or basic lower-case letters: - /// base64padding, replacesurrogates, - /// allowduplicatekeys, preservenegativezero, - /// numberconversion, writebasic, keepkeyorder. - /// Other keys are ignored in this version of the CBOR library. (Keys - /// are compared using a basic case-insensitive comparison, in which - /// two strings are equal if they match after converting the basic - /// upper-case letters A to Z (U+0041 to U+005A) in both strings to - /// basic lower-case letters.) If two or more key/value pairs have - /// equal keys (in a basic case-insensitive comparison), the value - /// given for the last such key is used. The first four keys just given - /// can have a value of 1, true, yes, or - /// on (where the letters can be any combination of basic - /// upper-case and/or basic lower-case letters), which means true, and - /// any other value meaning false. The last key, - /// numberconversion, can have a value of any name given in the - /// JSONOptions.ConversionMode enumeration (where the letters - /// can be any combination of basic upper-case and/or basic lower-case - /// letters), and any other value is unrecognized. (If the + /// writebasic=false;replacesurrogates=true. The key can be any + /// one of the following where the letters can be any combination of + /// basic upper-case and/or basic lower-case letters: + /// replacesurrogates, allowduplicatekeys, + /// preservenegativezero, numberconversion, + /// writebasic, keepkeyorder. Other keys are ignored in + /// this version of the CBOR library. (Keys are compared using a basic + /// case-insensitive comparison, in which two strings are equal if they + /// match after converting the basic upper-case letters A to Z (U+0041 + /// to U+005A) in both strings to basic lower-case letters.) If two or + /// more key/value pairs have equal keys (in a basic case-insensitive + /// comparison), the value given for the last such key is used. The + /// first four keys just given can have a value of 1, + /// true, yes, or on (where the letters can be + /// any combination of basic upper-case and/or basic lower-case + /// letters), which means true, and any other value meaning false. The + /// last key, numberconversion, can have a value of any name + /// given in the JSONOptions.ConversionMode enumeration (where + /// the letters can be any combination of basic upper-case and/or basic + /// lower-case letters), and any other value is unrecognized. (If the /// numberconversion key is not given, its value is treated as /// intorfloat (formerly full in versions earlier than /// 5.0). If that key is given, but has an unrecognized value, an - /// exception is thrown.) For example, base64padding=Yes and - /// base64padding=1 both set the Base64Padding property - /// to true, and numberconversion=double sets the - /// NumberConversion property to ConversionMode.Double - /// . + /// exception is thrown.) For example, allowduplicatekeys=Yes + /// and allowduplicatekeys=1 both set the + /// AllowDuplicateKeys property to true, and + /// numberconversion=double sets the NumberConversion + /// property to ConversionMode.Double. /// The parameter is null. In the future, this class may allow /// other keys to store other kinds of values, not just true or @@ -188,7 +158,6 @@ public JSONOptions(string paramString) { this.KeepKeyOrder = parser.GetBoolean( "keepkeyorder", false); - this.Base64Padding = parser.GetBoolean("base64padding", true); this.ReplaceSurrogates = parser.GetBoolean( "replacesurrogates", false); @@ -207,7 +176,6 @@ public JSONOptions(string paramString) { /// one described in the String constructor for this class. public override string ToString() { return new StringBuilder() - .Append("base64padding=").Append(this.Base64Padding ? "true" : "false") .Append(";replacesurrogates=") .Append(this.ReplaceSurrogates ? "true" : "false") .Append(";preservenegativezero=") @@ -224,22 +192,6 @@ public override string ToString() { /// JSON. public static readonly JSONOptions Default = new JSONOptions(); - /// Gets a value indicating whether the Base64Padding property - /// is true. This property has no effect; in previous versions, this - /// property meant that padding was written out when writing base64url - /// or traditional base64 to JSON. - /// A value indicating whether the Base64Padding property is - /// true. - [Obsolete("This property now has no effect. This library now includes " + -"\u0020necessary padding when writing traditional base64 to JSON and" + -"\u0020includes no padding when writing base64url to JSON, in " + -"\u0020accordance with the revision of the CBOR specification.")] - public bool Base64Padding - { - get; - private set; - } - private string FromNumberConversion() { ConversionMode kind = this.NumberConversion; return kind == ConversionMode.Full ? "full" :