diff --git a/src/JTNE.Protocol/Extensions/JTNEDateTimeExtensions.cs b/src/JTNE.Protocol/Extensions/JTNEDateTimeExtensions.cs
index 8c51102..2a22c3c 100644
--- a/src/JTNE.Protocol/Extensions/JTNEDateTimeExtensions.cs
+++ b/src/JTNE.Protocol/Extensions/JTNEDateTimeExtensions.cs
@@ -107,7 +107,7 @@ namespace JTNE.Protocol.Extensions {
///
///
///
- ///
+ ///
///
///
///
diff --git a/src/JTNE.Protocol/Extensions/JTNEHexExtensions.cs b/src/JTNE.Protocol/Extensions/JTNEHexExtensions.cs
index a3c0cd7..e80957c 100644
--- a/src/JTNE.Protocol/Extensions/JTNEHexExtensions.cs
+++ b/src/JTNE.Protocol/Extensions/JTNEHexExtensions.cs
@@ -4,42 +4,34 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
-namespace JTNE.Protocol.Extensions
-{
+namespace JTNE.Protocol.Extensions {
///
///
/// ref:"www.codeproject.com/tips/447938/high-performance-csharp-byte-array-to-hex-string-t"
///
- public static partial class JTNEBinaryExtensions
- {
- public static string ToHexString(this byte[] source)
- {
- return HexUtil.DoHexDump(source,0, source.Length).ToUpper();
+ public static partial class JTNEBinaryExtensions {
+ public static string ToHexString (this byte[] source) {
+ return HexUtil.DoHexDump (source, 0, source.Length).ToUpper ();
}
- public static int WriteHexStringLittle(byte[] bytes, int offset, string data, int len)
- {
+ public static int WriteHexStringLittle (byte[] bytes, int offset, string data, int len) {
if (data == null) data = "";
- data = data.Replace(" ", "");
+ data = data.Replace (" ", "");
int startIndex = 0;
- if (data.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
- {
+ if (data.StartsWith ("0x", StringComparison.OrdinalIgnoreCase)) {
startIndex = 2;
}
int length = len;
- if (length == -1)
- {
+ if (length == -1) {
length = (data.Length - startIndex) / 2;
}
int noOfZero = length * 2 + startIndex - data.Length;
- if (noOfZero > 0)
- {
- data = data.Insert(startIndex, new string('0', noOfZero));
+ if (noOfZero > 0) {
+ data = data.Insert (startIndex, new string ('0', noOfZero));
}
int byteIndex = 0;
- while (startIndex < data.Length && byteIndex < length)
- {
- bytes[offset+byteIndex] = Convert.ToByte(data.Substring(startIndex, 2), 16);
+ while (startIndex < data.Length && byteIndex < length) {
+ bytes[offset + byteIndex] = Convert.ToByte (data.Substring (startIndex, 2), 16);
startIndex += 2;
byteIndex++;
}
@@ -50,27 +42,22 @@ namespace JTNE.Protocol.Extensions
/// 16进制字符串转16进制数组
///
///
- ///
///
- public static byte[] ToHexBytes(this string hexString)
- {
- hexString = hexString.Replace(" ", "");
+ public static byte[] ToHexBytes (this string hexString) {
+ hexString = hexString.Replace (" ", "");
byte[] buf = new byte[hexString.Length / 2];
- ReadOnlySpan readOnlySpan = hexString.AsSpan();
- for (int i = 0; i < hexString.Length; i++)
- {
- if (i % 2 == 0)
- {
- buf[i / 2] = Convert.ToByte(readOnlySpan.Slice(i, 2).ToString(), 16);
+ ReadOnlySpan readOnlySpan = hexString.AsSpan ();
+ for (int i = 0; i < hexString.Length; i++) {
+ if (i % 2 == 0) {
+ buf[i / 2] = Convert.ToByte (readOnlySpan.Slice (i, 2).ToString (), 16);
}
}
return buf;
}
- public static string ReadHexStringLittle(ReadOnlySpan read, ref int offset, int len)
- {
- ReadOnlySpan source = read.Slice(offset, len);
- string hex = HexUtil.DoHexDump(read, offset, len);
+ public static string ReadHexStringLittle (ReadOnlySpan read, ref int offset, int len) {
+ ReadOnlySpan source = read.Slice (offset, len);
+ string hex = HexUtil.DoHexDump (read, offset, len);
offset += len;
return hex;
}
@@ -78,53 +65,44 @@ namespace JTNE.Protocol.Extensions
///
/// ref dotnetty
///
- static class HexUtil
- {
+ static class HexUtil {
static readonly char[] HexdumpTable = new char[256 * 4];
- static HexUtil()
- {
- char[] digits = "0123456789abcdef".ToCharArray();
- for (int i = 0; i < 256; i++)
- {
- HexdumpTable[i << 1] = digits[(int)((uint)i >> 4 & 0x0F)];
+ static HexUtil () {
+ char[] digits = "0123456789abcdef".ToCharArray ();
+ for (int i = 0; i < 256; i++) {
+ HexdumpTable[i << 1] = digits[(int) ((uint) i >> 4 & 0x0F)];
HexdumpTable[(i << 1) + 1] = digits[i & 0x0F];
}
}
- public static string DoHexDump(ReadOnlySpan buffer, int fromIndex, int length)
- {
- if (length == 0)
- {
+ public static string DoHexDump (ReadOnlySpan buffer, int fromIndex, int length) {
+ if (length == 0) {
return "";
}
int endIndex = fromIndex + length;
var buf = new char[length << 1];
int srcIdx = fromIndex;
int dstIdx = 0;
- for (; srcIdx < endIndex; srcIdx++, dstIdx += 2)
- {
- Array.Copy(HexdumpTable, buffer[srcIdx] << 1,buf, dstIdx, 2);
+ for (; srcIdx < endIndex; srcIdx++, dstIdx += 2) {
+ Array.Copy (HexdumpTable, buffer[srcIdx] << 1, buf, dstIdx, 2);
}
- return new string(buf);
+ return new string (buf);
}
- public static string DoHexDump(byte[] array, int fromIndex, int length)
- {
- if (length == 0)
- {
+ public static string DoHexDump (byte[] array, int fromIndex, int length) {
+ if (length == 0) {
return "";
}
int endIndex = fromIndex + length;
var buf = new char[length << 1];
int srcIdx = fromIndex;
int dstIdx = 0;
- for (; srcIdx < endIndex; srcIdx++, dstIdx += 2)
- {
- Array.Copy(HexdumpTable, (array[srcIdx] & 0xFF) << 1, buf, dstIdx, 2);
- }
- return new string(buf);
+ for (; srcIdx < endIndex; srcIdx++, dstIdx += 2) {
+ Array.Copy (HexdumpTable, (array[srcIdx] & 0xFF) << 1, buf, dstIdx, 2);
+ }
+ return new string (buf);
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/JTNE.Protocol/JTNE.Protocol.csproj b/src/JTNE.Protocol/JTNE.Protocol.csproj
index d238415..ee7579b 100644
--- a/src/JTNE.Protocol/JTNE.Protocol.csproj
+++ b/src/JTNE.Protocol/JTNE.Protocol.csproj
@@ -22,10 +22,6 @@
1591
-
- bin\$(Configuration)\$(TargetFramework)\JTNE.Protocol.xml
-
-