Skip to content

Commit efc3111

Browse files
committed
Split classes into separate files
1 parent 9cc3e09 commit efc3111

File tree

5 files changed

+122
-99
lines changed

5 files changed

+122
-99
lines changed

nanoFramework.Aws.IoTCore.Devices/AwsSignatureVersion4/nfArrayListExtensions.cs

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -37,101 +37,4 @@ public static void Sort(this ArrayList items, IComparer comparer)
3737
}
3838
}
3939

40-
41-
/// <summary>
42-
/// String Comparers
43-
/// </summary>
44-
public abstract class StringComparer : IComparer
45-
{
46-
private static readonly StringComparer _ordinal = new OrdinalComparer(false);
47-
private static readonly StringComparer _ordinalIgnoreCase = new OrdinalComparer(true);
48-
49-
/// <summary>
50-
/// Ordinal Comparer
51-
/// </summary>
52-
public static StringComparer Ordinal
53-
{
54-
get
55-
{
56-
return _ordinal;
57-
}
58-
}
59-
60-
/// <summary>
61-
/// Ordinal Comparer (ignoring case)
62-
/// </summary>
63-
public static StringComparer OrdinalIgnoreCase
64-
{
65-
get
66-
{
67-
return _ordinalIgnoreCase;
68-
}
69-
}
70-
71-
/// <summary>
72-
/// Compares two objects
73-
/// </summary>
74-
/// <param name="x">Object x</param>
75-
/// <param name="y">Object y</param>
76-
/// <returns>The result</returns>
77-
/// <exception cref="ArgumentException"></exception>
78-
public int Compare(object x, object y)
79-
{
80-
if (x == y) return 0;
81-
if (x == null) return -1;
82-
if (y == null) return 1;
83-
84-
string sa = x as string;
85-
if (sa != null)
86-
{
87-
string sb = y as string;
88-
if (sb != null)
89-
{
90-
return Compare(sa, sb);
91-
}
92-
}
93-
94-
IComparable ia = x as IComparable;
95-
if (ia != null)
96-
{
97-
return ia.CompareTo(y);
98-
}
99-
100-
throw new ArgumentException("Argument_ImplementIComparable");
101-
}
102-
103-
/// <summary>
104-
/// Compares two strings
105-
/// </summary>
106-
/// <param name="x">String x</param>
107-
/// <param name="y">String y</param>
108-
/// <returns>The result.</returns>
109-
public abstract int Compare(string x, string y);
110-
}
111-
112-
internal sealed class OrdinalComparer : StringComparer
113-
{
114-
private bool _ignoreCase;
115-
116-
internal OrdinalComparer(bool ignoreCase)
117-
{
118-
_ignoreCase = ignoreCase;
119-
}
120-
121-
public override int Compare(string x, string y)
122-
{
123-
if (ReferenceEquals(x, y)) return 0;
124-
if (x == null) return -1;
125-
if (y == null) return 1;
126-
127-
if (_ignoreCase)
128-
{
129-
return string.Compare(x.ToLower(), y.ToLower());
130-
}
131-
132-
return string.Compare(x, y);
133-
}
134-
135-
}
136-
13740
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// Copyright (c) .NET Foundation and Contributors
3+
// See LICENSE file in the project root for full license information.
4+
//
5+
6+
namespace System.Collections
7+
{
8+
9+
internal sealed class OrdinalComparer : StringComparer
10+
{
11+
private bool _ignoreCase;
12+
13+
internal OrdinalComparer(bool ignoreCase)
14+
{
15+
_ignoreCase = ignoreCase;
16+
}
17+
18+
public override int Compare(string x, string y)
19+
{
20+
if (ReferenceEquals(x, y)) return 0;
21+
if (x == null) return -1;
22+
if (y == null) return 1;
23+
24+
if (_ignoreCase)
25+
{
26+
return string.Compare(x.ToLower(), y.ToLower());
27+
}
28+
29+
return string.Compare(x, y);
30+
}
31+
32+
}
33+
34+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
//
2+
// Copyright (c) .NET Foundation and Contributors
3+
// See LICENSE file in the project root for full license information.
4+
//
5+
6+
namespace System.Collections
7+
{
8+
9+
/// <summary>
10+
/// String Comparers
11+
/// </summary>
12+
public abstract class StringComparer : IComparer
13+
{
14+
private static readonly StringComparer _ordinal = new OrdinalComparer(false);
15+
private static readonly StringComparer _ordinalIgnoreCase = new OrdinalComparer(true);
16+
17+
/// <summary>
18+
/// Ordinal Comparer
19+
/// </summary>
20+
public static StringComparer Ordinal
21+
{
22+
get
23+
{
24+
return _ordinal;
25+
}
26+
}
27+
28+
/// <summary>
29+
/// Ordinal Comparer (ignoring case)
30+
/// </summary>
31+
public static StringComparer OrdinalIgnoreCase
32+
{
33+
get
34+
{
35+
return _ordinalIgnoreCase;
36+
}
37+
}
38+
39+
/// <summary>
40+
/// Compares two objects
41+
/// </summary>
42+
/// <param name="x">Object x</param>
43+
/// <param name="y">Object y</param>
44+
/// <returns>The result</returns>
45+
/// <exception cref="ArgumentException"></exception>
46+
public int Compare(object x, object y)
47+
{
48+
if (x == y) return 0;
49+
if (x == null) return -1;
50+
if (y == null) return 1;
51+
52+
string sa = x as string;
53+
if (sa != null)
54+
{
55+
string sb = y as string;
56+
if (sb != null)
57+
{
58+
return Compare(sa, sb);
59+
}
60+
}
61+
62+
IComparable ia = x as IComparable;
63+
if (ia != null)
64+
{
65+
return ia.CompareTo(y);
66+
}
67+
68+
throw new ArgumentException("Argument_ImplementIComparable");
69+
}
70+
71+
/// <summary>
72+
/// Compares two strings
73+
/// </summary>
74+
/// <param name="x">String x</param>
75+
/// <param name="y">String y</param>
76+
/// <returns>The result.</returns>
77+
public abstract int Compare(string x, string y);
78+
}
79+
80+
}

nanoFramework.Aws.IoTCore.Devices/WebsocketConnectionClient.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class WebsocketConnectionClient : IDisposable
3434

3535
const int _wssPort = 443; //Default WSS port.
3636

37-
//WebSocket _webSocket = null;
37+
//private WebSocket _webSocket = null;
3838

3939
/// <summary>
4040
/// Creates a new MQTT over WebSocket Connection Client
@@ -66,7 +66,11 @@ public WebsocketConnectionClient()
6666
/// <inheritdoc/>
6767
public void Dispose()
6868
{
69-
69+
//if (_webSocket != null)
70+
//{
71+
// GC.SuppressFinalize(_webSocket);
72+
// _webSocket = null;
73+
//}
7074
}
7175
}
7276
}

nanoFramework.Aws.IoTCore.Devices/nanoFramework.Aws.IoTCore.Devices.nfproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
<ItemGroup>
3434
<Compile Include="AwsSignatureVersion4\nfArrayListExtensions.cs" />
3535
<Compile Include="AwsSignatureVersion4\HMACSHA256.cs" />
36+
<Compile Include="AwsSignatureVersion4\nfOrdinalComparer.cs" />
37+
<Compile Include="AwsSignatureVersion4\nfStringComparer.cs" />
3638
<Compile Include="AwsSignatureVersion4\SHA256.cs" />
3739
<Compile Include="CloudToDeviceMessage.cs" />
3840
<Compile Include="ConfirmationStatus.cs" />

0 commit comments

Comments
 (0)