|
5 | 5 | using System.Security.Cryptography; |
6 | 6 | using System.Text; |
7 | 7 |
|
8 | | -using Smdn.IO.Streams; |
| 8 | +#if !(NET472_OR_GREATER || NETSTANDARD2_0_OR_GREATER || NET5_0_OR_GREATER) |
| 9 | +using Smdn.IO.Streams; // NonClosingStream |
| 10 | +#endif |
9 | 11 | using Smdn.Security.Cryptography; |
10 | 12 |
|
11 | 13 | namespace Smdn.Formats { |
@@ -69,9 +71,9 @@ public static byte[] Encode(byte[] bytes) |
69 | 71 |
|
70 | 72 | public static byte[] Encode(byte[] bytes, int offset, int count) |
71 | 73 | { |
72 | | - using (var transform = CreateToBase64Transform()) { |
73 | | - return ICryptoTransformExtensions.TransformBytes(transform, bytes, offset, count); |
74 | | - } |
| 74 | + using var transform = CreateToBase64Transform(); |
| 75 | + |
| 76 | + return ICryptoTransformExtensions.TransformBytes(transform, bytes, offset, count); |
75 | 77 | } |
76 | 78 |
|
77 | 79 | public static string GetDecodedString(string str) |
@@ -115,9 +117,9 @@ public static byte[] Decode(byte[] bytes) |
115 | 117 |
|
116 | 118 | public static byte[] Decode(byte[] bytes, int offset, int count) |
117 | 119 | { |
118 | | - using (var transform = CreateFromBase64Transform(ignoreWhiteSpaces: true)) { |
119 | | - return ICryptoTransformExtensions.TransformBytes(transform, bytes, offset, count); |
120 | | - } |
| 120 | + using var transform = CreateFromBase64Transform(ignoreWhiteSpaces: true); |
| 121 | + |
| 122 | + return ICryptoTransformExtensions.TransformBytes(transform, bytes, offset, count); |
121 | 123 | } |
122 | 124 |
|
123 | 125 | public static Stream CreateEncodingStream(Stream stream, bool leaveStreamOpen = false) |
|
0 commit comments