diff --git a/CBOR.nuspec b/CBOR.nuspec index 2a7357b9..3e9d18c1 100644 --- a/CBOR.nuspec +++ b/CBOR.nuspec @@ -1,12 +1,8 @@ 3.2.1PeterO.CborfalseVersion 3.2.1 +>3.3.0PeterO.CborfalseVersion 3.3: -- Add .NET Framework 4.0 targeted assembly to avoid compiler warnings that can appear when this package is added to a project that targets .NET Framework 4.0 or later. - -Version 3.2 - -- Added build targeting the .NET Framework 2.0 -- Obsoleted much of the existing API in CBOREncodeOptions and added new APIs to replace it. -- Documentation for some CBORObject methods now points to the use of CBOREncodeOptions.Default -- Documentation edited in other placeshttp://creativecommons.org/publicdomain/zero/1.0/https://github.com/peteroupc/CBORPeter OccilA C# implementation of Concise Binary Object Representation (CBOR), a general-purpose binary data format defined in RFC 7049.Peter OccilCBOR (Concise Binary Object Representation)cbor data serialization binary json numbers arithmetic +- Added Clear, RemoveAt and Remove(object) methods to CBORObject class. Formerly, it was very hard with existing methods to remove items from CBOR maps and arrays. +- Added CodePointLength and ToUpperCaseAscii methods to DataUtilities class. +- Added WriteValue family of methods to CBORObject class. This can be used for lower-level encoding of CBOR objects. Examples on its use were included in the documentation. +- Bug fixes.http://creativecommons.org/publicdomain/zero/1.0/https://github.com/peteroupc/CBORPeter OccilA C# implementation of Concise Binary Object Representation (CBOR), a general-purpose binary data format defined in RFC 7049.Peter OccilCBOR (Concise Binary Object Representation)cbor data serialization binary json numbers arithmetic \ No newline at end of file diff --git a/CBOR/CBOR.csproj b/CBOR/CBOR.csproj index 7ce508e4..5c795ded 100644 --- a/CBOR/CBOR.csproj +++ b/CBOR/CBOR.csproj @@ -3,7 +3,7 @@ netstandard1.0 True - 3.2.1 + 3.3.0 Peter Occil A C# implementation of Concise Binary Object Representation (CBOR), a general-purpose binary data format defined in RFC 7049. A C# implementation of Concise Binary Object Representation (CBOR), a general-purpose binary data format defined in RFC 7049. @@ -61,4 +61,4 @@ Version 3.3: - \ No newline at end of file + diff --git a/CBOR/docs.xml b/CBOR/docs.xml index b8eb31d8..27e267db 100644 --- a/CBOR/docs.xml +++ b/CBOR/docs.xml @@ -1984,8 +1984,7 @@ The index, starting at 0, of the item to remove. Returns "true" if the object was removed. Returns "false" if the given - index is less than 0, or is at least the number of items in - the array. + index is less than 0, or is at least as high as the number of items in the array. This object is not a CBOR array. @@ -2520,89 +2519,84 @@ -At the moment, use the overload of this method - that takes a object. - The object CBOREncodeOptions.Default - contains recommended - settings for CBOREncodeOptions, and those settings may be adopted - by this overload (without a CBOREncodeOptions argument) in the next - major version. - - Writes this CBOR object to a data - stream. If the CBOR object contains CBOR maps, or is a CBOR map, - the keys to the map are written out to the data stream in an - undefined order. See the examples (written in C# for the .NET - version) for ways to write out certain keys of a CBOR map in a - given order. - - A writable data stream. - The parameter - is null. - An I/O error - occurred. - The following example shows a method that writes each key of - 'mapObj' to 'outputStream', in the order given in 'keys', where - 'mapObj' is written out in the form of a CBOR definite-length - map - . Only keys found in 'keys' will be written if they exist - in 'mapObj'. - private static void WriteKeysToMap(CBORObject - mapObj, IList<CBORObject> keys, Stream outputStream){ - if(mapObj == null){ throw new - ArgumentNullException(nameof(mapObj));} - if(keys == null){throw new - ArgumentNullException(nameof(keys));} - if(outputStream == null){throw new - ArgumentNullException(nameof(outputStream));} - if(obj.Type!=CBORType.Map){ throw new ArgumentException("'obj' - is not a map."); } - int keyCount = 0; - for (CBORObject key in keys) { - if(mapObj.ContainsKey(key)){ keyCount++; - } } - CBORObject.WriteValue(outputStream, 5, keyCount); - for (CBORObject key in keys) { - if(mapObj.ContainsKey(key)){ key.WriteTo(outputStream); - mapObj[key].WriteTo(outputStream); } } - } - - The following example shows a method that writes each key of - 'mapObj' to 'outputStream', in the order given in 'keys', where - 'mapObj' is written out in the form of a CBOR indefinite-length - map - . Only keys found in 'keys' will be written if they exist - in 'mapObj'. - private static void WriteKeysToIndefMap(CBORObject - mapObj, IList<CBORObject> keys, Stream outputStream){ - if(mapObj == null){ throw new - ArgumentNullException(nameof(mapObj));} - if(keys == null){throw new - ArgumentNullException(nameof(keys));} - if(outputStream == null){throw new - ArgumentNullException(nameof(outputStream));} - if(obj.Type!=CBORType.Map){ throw new ArgumentException("'obj' - is not a map."); } outputStream.WriteByte((byte)0xBF); - for (CBORObject key in keys) { - if(mapObj.ContainsKey(key)){ key.WriteTo(outputStream); - mapObj[key].WriteTo(outputStream); } } - outputStream.WriteByte((byte)0xff); } - - The following example shows a method that writes out a list - of objects to 'outputStream' as an indefinite-length CBOR - array - . - private static void WriteToIndefArray( - IList<object> list, Stream outputStream){ - if(list == null){ throw new - ArgumentNullException(nameof(list));} - if(outputStream == null){throw new - ArgumentNullException(nameof(outputStream));} - outputStream.WriteByte((byte)0x9f); - for (object item in list) { - new CBORObject(item).WriteTo(outputStream); } - outputStream.WriteByte((byte)0xff); } - - +At the moment, use the overload of this method that takes a + + object. The object + CBOREncodeOptions.Default + contains recommended settings for CBOREncodeOptions, and those + settings may be adopted by this overload (without a CBOREncodeOptions + argument) in the next major version. + + Writes this CBOR object to a data stream. If the CBOR object contains + CBOR maps, or is a CBOR map, the keys to the map are written out to the + data stream in an undefined order. See the examples (written in C# for + the .NET version) for ways to write out certain keys of a CBOR map in a + given order. + + + A writable data stream. + + The parameter + + is null. + + An I/O error occurred. + + The following example shows a method that writes each key of 'mapObj' to + 'outputStream', in the order given in 'keys', where 'mapObj' is written + out in the form of a CBOR + definite-length map + . Only keys found in 'keys' will be written if they exist in 'mapObj'. + + private static void WriteKeysToMap(CBORObject mapObj, + IList<CBORObject> keys, Stream outputStream){ if(mapObj + == null){ throw new + ArgumentNullException(nameof(mapObj));} if(keys == + null){throw new ArgumentNullException(nameof(keys));} + if(outputStream == null){throw new + ArgumentNullException(nameof(outputStream));} + if(obj.Type!=CBORType.Map){ throw new ArgumentException("'obj' + is not a map."); } int keyCount = 0; for (CBORObject key in keys) + { if(mapObj.ContainsKey(key)){ keyCount++; } } + CBORObject.WriteValue(outputStream, 5, keyCount); for (CBORObject key in + keys) { if(mapObj.ContainsKey(key)){ + key.WriteTo(outputStream); mapObj[key].WriteTo(outputStream); } + } } + + The following example shows a method that writes each key of 'mapObj' to + 'outputStream', in the order given in 'keys', where 'mapObj' is written + out in the form of a CBOR + indefinite-length map + . Only keys found in 'keys' will be written if they exist in 'mapObj'. + + private static void WriteKeysToIndefMap(CBORObject mapObj, + IList<CBORObject> keys, Stream outputStream){ if(mapObj + == null){ throw new + ArgumentNullException(nameof(mapObj));} if(keys == + null){throw new ArgumentNullException(nameof(keys));} + if(outputStream == null){throw new + ArgumentNullException(nameof(outputStream));} + if(obj.Type!=CBORType.Map){ throw new ArgumentException("'obj' + is not a map."); } outputStream.WriteByte((byte)0xBF); for + (CBORObject key in keys) { if(mapObj.ContainsKey(key)){ + key.WriteTo(outputStream); mapObj[key].WriteTo(outputStream); } + } outputStream.WriteByte((byte)0xff); } + + The following example shows a method that writes out a list of objects + to 'outputStream' as an + indefinite-length CBOR array + . + + private static void WriteToIndefArray( IList<object> list, + Stream outputStream){ if(list == null){ throw new + ArgumentNullException(nameof(list));} if(outputStream == + null){throw new + ArgumentNullException(nameof(outputStream));} + outputStream.WriteByte((byte)0x9f); for (object item in list) { new + CBORObject(item).WriteTo(outputStream); } + outputStream.WriteByte((byte)0xff); } + + diff --git a/CBOR20/Properties/AssemblyInfo.cs b/CBOR20/Properties/AssemblyInfo.cs index dc75347a..192da61f 100644 --- a/CBOR20/Properties/AssemblyInfo.cs +++ b/CBOR20/Properties/AssemblyInfo.cs @@ -1,9 +1,8 @@ using System.Reflection; - [assembly: System.CLSCompliant(true)] -[assembly: AssemblyVersion("3.2.1")] -[assembly: AssemblyFileVersion("3.2.1.0")] -[assembly: AssemblyInformationalVersion("3.2.1.0")] +[assembly: AssemblyVersion("3.3.0")] +[assembly: AssemblyFileVersion("3.3.0.0")] +[assembly: AssemblyInformationalVersion("3.3.0.0")] [assembly: AssemblyProduct("CBOR (Concise Binary Object Representati" + "on)")] [assembly: AssemblyTitle("CBOR (Concise Binary Object Representati" + diff --git a/CBOR40/Properties/AssemblyInfo.cs b/CBOR40/Properties/AssemblyInfo.cs index dc75347a..192da61f 100644 --- a/CBOR40/Properties/AssemblyInfo.cs +++ b/CBOR40/Properties/AssemblyInfo.cs @@ -1,9 +1,8 @@ using System.Reflection; - [assembly: System.CLSCompliant(true)] -[assembly: AssemblyVersion("3.2.1")] -[assembly: AssemblyFileVersion("3.2.1.0")] -[assembly: AssemblyInformationalVersion("3.2.1.0")] +[assembly: AssemblyVersion("3.3.0")] +[assembly: AssemblyFileVersion("3.3.0.0")] +[assembly: AssemblyInformationalVersion("3.3.0.0")] [assembly: AssemblyProduct("CBOR (Concise Binary Object Representati" + "on)")] [assembly: AssemblyTitle("CBOR (Concise Binary Object Representati" + diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 12742692..192da61f 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -1,8 +1,8 @@ using System.Reflection; [assembly: System.CLSCompliant(true)] -[assembly: AssemblyVersion("3.2.1")] -[assembly: AssemblyFileVersion("3.2.1.0")] -[assembly: AssemblyInformationalVersion("3.2.1.0")] +[assembly: AssemblyVersion("3.3.0")] +[assembly: AssemblyFileVersion("3.3.0.0")] +[assembly: AssemblyInformationalVersion("3.3.0.0")] [assembly: AssemblyProduct("CBOR (Concise Binary Object Representati" + "on)")] [assembly: AssemblyTitle("CBOR (Concise Binary Object Representati" +