diff --git a/changlog/autoUpdate.xml b/changlog/autoUpdate.xml index d9214ab..e2fc45b 100644 --- a/changlog/autoUpdate.xml +++ b/changlog/autoUpdate.xml @@ -1,7 +1,7 @@ - 1.0.3.1 - https://llcom.papapoi.com/update/1.0.3.1.zip - https://llcom.papapoi.com/changelog/1.0.3.1.html + 1.0.3.2 + https://llcom.papapoi.com/update/1.0.3.2.zip + https://llcom.papapoi.com/changelog/1.0.3.2.html true diff --git a/changlog/index.html b/changlog/index.html index c65b62a..602545a 100644 --- a/changlog/index.html +++ b/changlog/index.html @@ -8,6 +8,13 @@ > 欢迎加入交流群:`906307487` +## LLCOM 1.0.3.2 + +- 增加不分包显示数据的功能 +- 稍微调大分包显示时同屏的最大字符数限制 + +--- + ## LLCOM 1.0.3.1 - 更正开关串口后,波特率等信息错误的问题 diff --git a/llcom/Model/Settings.cs b/llcom/Model/Settings.cs index 686eac2..9eda32b 100644 --- a/llcom/Model/Settings.cs +++ b/llcom/Model/Settings.cs @@ -204,8 +204,6 @@ public int timeout { get { - if (_timeout < 0)//防止出现负数超时时间 - return 0; return _timeout; } set diff --git a/llcom/Model/Uart.cs b/llcom/Model/Uart.cs index e60dff0..7e0cab5 100644 --- a/llcom/Model/Uart.cs +++ b/llcom/Model/Uart.cs @@ -125,7 +125,8 @@ private void Serial_DataReceived(object sender, SerialDataReceivedEventArgs e) { lock (objLock) { - System.Threading.Thread.Sleep(Tools.Global.setting.timeout);//等待时间 + if(Tools.Global.setting.timeout > 0) + System.Threading.Thread.Sleep(Tools.Global.setting.timeout);//等待时间 List result = new List(); while (true)//循环读 { @@ -145,7 +146,7 @@ private void Serial_DataReceived(object sender, SerialDataReceivedEventArgs e) if (result.Count > Tools.Global.setting.maxLength)//长度超了 break; - if (Tools.Global.setting.bitDelay)//如果是设置了等待间隔时间 + if (Tools.Global.setting.bitDelay && Tools.Global.setting.timeout > 0)//如果是设置了等待间隔时间 { System.Threading.Thread.Sleep(Tools.Global.setting.timeout);//等待时间 } diff --git a/llcom/Pages/DataShowPage.xaml.cs b/llcom/Pages/DataShowPage.xaml.cs index 14d531c..cbe78f3 100644 --- a/llcom/Pages/DataShowPage.xaml.cs +++ b/llcom/Pages/DataShowPage.xaml.cs @@ -38,6 +38,8 @@ private void Page_Loaded(object sender, RoutedEventArgs e) }; } + int maxDataLength = 100000;//最长一包数据长度,因为太长会把工具卡死机 + int maxDataPack = 10000;//最大同时显示数据包数,因为太多会把工具卡死机 /// /// 添加串口日志数据 @@ -49,63 +51,90 @@ private void addUartLog(object e,Tools.DataShowPara input) uartDataFlowDocument.IsSelectionEnabled = false; byte[] data = input.data; bool send = input.send; - Paragraph p = new Paragraph(new Run("")); - - Span text = new Span(new Run(DateTime.Now.ToString("[yyyy/MM/dd HH:mm:ss.ffff]"))); - text.Foreground = Brushes.DarkSlateGray; - p.Inlines.Add(text); - - if (send) - text = new Span(new Run(" ← ")); - else - text = new Span(new Run(" → ")); - text.Foreground = Brushes.Black; - text.FontWeight = FontWeights.Bold; - p.Inlines.Add(text); - - if (data.Length > 2000) - text = new Span(new Run(Tools.Global.Byte2String(data.Skip(0).Take(2000).ToArray()) - + "\r\nData too long, check log folder for remaining data.")); - else - text = new Span(new Run(Tools.Global.Byte2String(data))); - - if (send) - text.Foreground = Brushes.DarkRed; - else - text.Foreground = Brushes.DarkGreen; - text.FontSize = 15; - p.Inlines.Add(text); - - if (!Tools.Global.setting.showHex) - p.Margin = new Thickness(0, 0, 0, 8); - uartDataFlowDocument.Document.Blocks.Add(p); - - if (Tools.Global.setting.showHex) + + if(Tools.Global.setting.timeout >= 0) { - if (data.Length > 600) - p = new Paragraph(new Run("HEX:" + Tools.Global.Byte2Hex(data.Skip(0).Take(600).ToArray(), " ") - + "\r\nData too long, check log folder for remaining data.")); + Paragraph p = new Paragraph(new Run("")); + + Span text = new Span(new Run(DateTime.Now.ToString("[yyyy/MM/dd HH:mm:ss.ffff]"))); + text.Foreground = Brushes.DarkSlateGray; + p.Inlines.Add(text); + + if (send) + text = new Span(new Run(" ← ")); else - p = new Paragraph(new Run("HEX:" + Tools.Global.Byte2Hex(data, " "))); + text = new Span(new Run(" → ")); + text.Foreground = Brushes.Black; + text.FontWeight = FontWeights.Bold; + p.Inlines.Add(text); + + if (data.Length > maxDataLength) + text = new Span(new Run(Tools.Global.Byte2String(data.Skip(0).Take(maxDataLength).ToArray()) + + "\r\nData too long, check log folder for remaining data.")); + else + text = new Span(new Run(Tools.Global.Byte2String(data))); if (send) - p.Foreground = Brushes.IndianRed; + text.Foreground = Brushes.DarkRed; else - p.Foreground = Brushes.ForestGreen; - p.Margin = new Thickness(0, 0, 0, 8); + text.Foreground = Brushes.DarkGreen; + text.FontSize = 15; + p.Inlines.Add(text); + + if (!Tools.Global.setting.showHex) + p.Margin = new Thickness(0, 0, 0, 8); uartDataFlowDocument.Document.Blocks.Add(p); - } - //条目过多,自动清空 - if (uartDataFlowDocument.Document.Blocks.Count > 500) + if (Tools.Global.setting.showHex) + { + if (data.Length > maxDataLength) + p = new Paragraph(new Run("HEX:" + Tools.Global.Byte2Hex(data.Skip(0).Take(maxDataLength).ToArray(), " ") + + "\r\nData too long, check log folder for remaining data.")); + else + p = new Paragraph(new Run("HEX:" + Tools.Global.Byte2Hex(data, " "))); + + if (send) + p.Foreground = Brushes.IndianRed; + else + p.Foreground = Brushes.ForestGreen; + p.Margin = new Thickness(0, 0, 0, 8); + uartDataFlowDocument.Document.Blocks.Add(p); + } + + //条目过多,自动清空 + if (uartDataFlowDocument.Document.Blocks.Count > maxDataPack) + { + uartDataFlowDocument.Document.Blocks.Clear(); + addUartLog(null, new Tools.DataShowPara + { + data = Encoding.Default.GetBytes("Too much packs, please check your log folder for log data."), + send = true + }); + } + } + else//不分包 { - uartDataFlowDocument.Document.Blocks.Clear(); - addUartLog(null,new Tools.DataShowPara { - data = Encoding.Default.GetBytes("Data too big, please check your log folder for log data."), - send = true - }); + if(uartDataFlowDocument.Document.Blocks.LastBlock == null || + uartDataFlowDocument.Document.Blocks.LastBlock.GetType() != typeof(Paragraph)) + uartDataFlowDocument.Document.Blocks.Add(new Paragraph(new Run(""))); + + //待显示的数据 + string s; + if (Tools.Global.setting.showHex) + s = Tools.Global.Byte2Hex(data, " "); + else + s = Tools.Global.Byte2String(data); + Span text = new Span(new Run(s)); + text.FontSize = 15; + if (send) + text.Foreground = Brushes.DarkRed; + else + text.Foreground = Brushes.DarkGreen; + (uartDataFlowDocument.Document.Blocks.LastBlock as Paragraph).Inlines.Add(text); + } + sv.ScrollToBottom(); uartDataFlowDocument.IsSelectionEnabled = true; } diff --git a/llcom/Properties/AssemblyInfo.cs b/llcom/Properties/AssemblyInfo.cs index 1daf150..4461ce6 100644 --- a/llcom/Properties/AssemblyInfo.cs +++ b/llcom/Properties/AssemblyInfo.cs @@ -51,7 +51,7 @@ //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.3.1")] -[assembly: AssemblyFileVersion("1.0.3.1")] +[assembly: AssemblyVersion("1.0.3.2")] +[assembly: AssemblyFileVersion("1.0.3.2")] [assembly: NeutralResourcesLanguage("zh-CN")] diff --git a/llcom/languages/en-US.xaml b/llcom/languages/en-US.xaml index e61cfd9..756c2f0 100644 --- a/llcom/languages/en-US.xaml +++ b/llcom/languages/en-US.xaml @@ -77,7 +77,7 @@ Show Hex Keep Window on top Data pack time: - Ms + Ms(minus means no pack) Split by no data time(or split by time from first time) Max length per packet Byte(s) diff --git a/llcom/languages/zh-CN.xaml b/llcom/languages/zh-CN.xaml index cb8096e..df510d7 100644 --- a/llcom/languages/zh-CN.xaml +++ b/llcom/languages/zh-CN.xaml @@ -77,7 +77,7 @@ 串口数据窗口显示HEX值 窗口保持置顶显示 分包数据超时时间: - 毫秒 + 毫秒(负数则不分包) 超时时间表示空白间隔(不勾选表示从第一个字节开始算超时时间) 串口数据每包最大 字节 diff --git a/llcom/llcom.csproj b/llcom/llcom.csproj index 37669fd..bfe1e56 100644 --- a/llcom/llcom.csproj +++ b/llcom/llcom.csproj @@ -83,11 +83,11 @@ true - - ..\packages\AdonisUI.1.14.0\lib\net45\AdonisUI.dll + + ..\packages\AdonisUI.1.16.0\lib\net45\AdonisUI.dll - - ..\packages\AdonisUI.ClassicTheme.1.14.0\lib\net45\AdonisUI.ClassicTheme.dll + + ..\packages\AdonisUI.ClassicTheme.1.16.0\lib\net45\AdonisUI.ClassicTheme.dll ..\packages\Autoupdater.NET.Official.1.6.0\lib\net40\AutoUpdater.NET.dll @@ -271,8 +271,8 @@ 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 - + - + \ No newline at end of file diff --git a/llcom/packages.config b/llcom/packages.config index dacd099..a8713f6 100644 --- a/llcom/packages.config +++ b/llcom/packages.config @@ -1,12 +1,12 @@  - - + + - +