From 8c6fd742db249ad4cc819cf041eb98d880a3ef73 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期四, 02 一月 2025 15:09:07 +0800
Subject: [PATCH] 1

---
 WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs
index 2b7c4b7..a9b12ce 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/DeviceBase/DeviceCommand.cs
@@ -26,12 +26,18 @@
 
 namespace WIDESEAWCS_QuartzJob.DeviceBase
 {
+    /// <summary>
+    /// 瑗块棬瀛�
+    /// </summary>
     public class DeviceCommand : IDataTransfer
     {
         #region <Const>
         #endregion <Const>
 
         #region <Private Member>
+        /// <summary>
+        /// 鏁版嵁闀垮害
+        /// </summary>
         public ushort ReadCount { get; }
 
         private IByteTransform byteTransform = new ReverseBytesTransform();
@@ -42,6 +48,10 @@
         #endregion <Public Menber>
 
         #region <Constructor function>
+        /// <summary>
+        /// 鏋勯�犲嚱鏁�
+        /// </summary>
+        /// <exception cref="NotSupportedException"></exception>
         public DeviceCommand()
         {
             ushort readCount = 0;
@@ -55,7 +65,7 @@
                     case TypeCode.Byte:
                     case TypeCode.SByte:
                     case TypeCode.Char:
-                        readCount += 1;
+                        readCount += sizeof(byte);
                         break;
                     case TypeCode.Int16:
                     case TypeCode.UInt16:
@@ -102,6 +112,11 @@
         #endregion <Private Method>
 
         #region <Public Method>
+        /// <summary>
+        /// 鏁版嵁瑁呮崲
+        /// </summary>
+        /// <param name="Content"></param>
+        /// <exception cref="NotSupportedException"></exception>
         public void ParseSource(byte[] Content)
         {
             PropertyInfo[] propertyInfos = GetType().GetProperties().Where(x => x.CanWrite).ToArray();
@@ -153,6 +168,12 @@
             }
         }
 
+        /// <summary>
+        /// 鏁版嵁杞崲
+        /// </summary>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        /// <exception cref="NotSupportedException"></exception>
         public byte[] ToSource()
         {
             int propertyValueHasNull = -1;
@@ -224,7 +245,7 @@
                             bytes.Add(Convert.ToByte(dataLength));
                             bytes.Add(Convert.ToByte(obj.ToString().Length));
                             bytes.AddRange(bytesString);
-                            for (int i = 0; i < dataLength - obj.ToString().Length; i++)
+                            for (int i = 0; i < dataLength - obj.ToString().Length - 2; i++)
                             {
                                 bytes.Add(0);
                             }

--
Gitblit v1.9.3