Skip to content

Commit

Permalink
minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
peteroupc committed May 30, 2024
1 parent b5bd38b commit f32bad2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
20 changes: 12 additions & 8 deletions CBOR/PeterO/Cbor/CBORObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2336,7 +2336,8 @@ public static CBORObject FromInt32(int value) {
/// <param name='value'>The parameter <paramref name='value'/> is a
/// Guid.</param>
/// <returns>A CBOR object.</returns>
public static CBORObject FromGuid(Guid value) => new CBORUuidConverter().ToCBORObject(value);
public static CBORObject FromGuid(Guid value) => new
CBORUuidConverter().ToCBORObject(value);

/// <summary>Generates a CBOR object from a 32-bit signed
/// integer.</summary>
Expand Down Expand Up @@ -3240,7 +3241,8 @@ public static CBORObject NewMap() {
/// undefined order.</summary>
/// <param name='keysAndValues'>A sequence of key-value pairs.</param>
/// <returns>A new CBOR map.</returns>
public static CBORObject FromMap(IEnumerable<Tuple<CBORObject, CBORObject>> keysAndValues) {
public static CBORObject FromMap(IEnumerable<Tuple<CBORObject,
CBORObject >> keysAndValues) {

Check warning on line 3245 in CBOR/PeterO/Cbor/CBORObject.cs

View workflow job for this annotation

GitHub Actions / Core (ubuntu-latest)

Closing generic bracket should not be preceded by a space (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1015.md)

Check warning on line 3245 in CBOR/PeterO/Cbor/CBORObject.cs

View workflow job for this annotation

GitHub Actions / Core (macos-latest)

Closing generic bracket should not be preceded by a space (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1015.md)
var sd = new SortedDictionary<CBORObject, CBORObject>();
foreach (Tuple<CBORObject, CBORObject> kv in keysAndValues) {
sd.Add(kv.Item1, kv.Item2);
Expand All @@ -3259,11 +3261,12 @@ public static CBORObject NewOrderedMap() {
PropertyMap.NewOrderedDict());
}

/// <summary>Creates a new CBOR map that ensures that keys are
/// stored in order.</summary>
/// <summary>Creates a new CBOR map that ensures that keys are stored
/// in order.</summary>
/// <param name='keysAndValues'>A sequence of key-value pairs.</param>
/// <returns>A new CBOR map.</returns>
public static CBORObject FromOrderedMap(IEnumerable<Tuple<CBORObject, CBORObject>> keysAndValues) {
public static CBORObject FromOrderedMap(IEnumerable<Tuple<CBORObject,
CBORObject >> keysAndValues) {

Check warning on line 3269 in CBOR/PeterO/Cbor/CBORObject.cs

View workflow job for this annotation

GitHub Actions / Core (ubuntu-latest)

Closing generic bracket should not be preceded by a space (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1015.md)

Check warning on line 3269 in CBOR/PeterO/Cbor/CBORObject.cs

View workflow job for this annotation

GitHub Actions / Core (macos-latest)

Closing generic bracket should not be preceded by a space (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1015.md)
var oDict = PropertyMap.NewOrderedDict();
foreach (Tuple<CBORObject, CBORObject> kv in keysAndValues) {
oDict.Add(kv.Item1, kv.Item2);
Expand Down Expand Up @@ -4697,9 +4700,10 @@ public float AsSingle() {

/// <summary>Converts this object to a Guid.</summary>
/// <returns>A Guid.</returns>
/// <exception cref="InvalidOperationException">This object does
/// not represent a Guid.</exception><exception cref="CBORException">
/// This object does not have the expected tag.</exception>
/// <exception cref='InvalidOperationException'>This object does not
/// represent a Guid.</exception>
/// <exception cref='CBORException'>This object does not have the
/// expected tag.</exception>
public Guid AsGuid() {
return new CBORUuidConverter().FromCBORObject(this);
}
Expand Down
5 changes: 4 additions & 1 deletion CBOR/PeterO/Cbor/CBORUuidConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ public Guid FromCBORObject(CBORObject obj) {
}
_ = ValidateObject(obj);
byte[] b2 = obj.GetByteString();
byte[] bytes = { b2[3], b2[2], b2[1], b2[0], b2[5], b2[4], b2[7], b2[6], b2[8], b2[9], b2[10], b2[11], b2[12], b2[13], b2[14], b2[15] };
byte[] bytes = {
b2[3], b2[2], b2[1], b2[0], b2[5], b2[4], b2[7],
b2[6], b2[8], b2[9], b2[10], b2[11], b2[12], b2[13], b2[14], b2[15],
};
return new Guid(bytes);
}
}
Expand Down

0 comments on commit f32bad2

Please sign in to comment.