From 0462ad000ac027bf1e7b97ec165c6e39c89ab7f3 Mon Sep 17 00:00:00 2001 From: SmallChi <564952747@qq.com> Date: Fri, 16 Aug 2019 20:43:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=B7=A5=E5=85=B7=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/JT1078.Protocol.Tools/App.config | 18 --- .../ByteArrayHexConverter.cs | 29 ---- src/JT1078.Protocol.Tools/Form1.Designer.cs | 87 ---------- src/JT1078.Protocol.Tools/Form1.cs | 53 ------- src/JT1078.Protocol.Tools/Form1.resx | 120 -------------- src/JT1078.Protocol.Tools/HexExtensions.cs | 80 ---------- .../JT1078.Protocol.Tools.csproj | 148 ------------------ src/JT1078.Protocol.Tools/Program.cs | 22 --- .../Properties/AssemblyInfo.cs | 36 ----- .../Properties/Resources.Designer.cs | 71 --------- .../Properties/Resources.resx | 117 -------------- .../Properties/Settings.Designer.cs | 30 ---- .../Properties/Settings.settings | 7 - src/JT1078.Protocol.Tools/packages.config | 8 - 14 files changed, 826 deletions(-) delete mode 100644 src/JT1078.Protocol.Tools/App.config delete mode 100644 src/JT1078.Protocol.Tools/ByteArrayHexConverter.cs delete mode 100644 src/JT1078.Protocol.Tools/Form1.Designer.cs delete mode 100644 src/JT1078.Protocol.Tools/Form1.cs delete mode 100644 src/JT1078.Protocol.Tools/Form1.resx delete mode 100644 src/JT1078.Protocol.Tools/HexExtensions.cs delete mode 100644 src/JT1078.Protocol.Tools/JT1078.Protocol.Tools.csproj delete mode 100644 src/JT1078.Protocol.Tools/Program.cs delete mode 100644 src/JT1078.Protocol.Tools/Properties/AssemblyInfo.cs delete mode 100644 src/JT1078.Protocol.Tools/Properties/Resources.Designer.cs delete mode 100644 src/JT1078.Protocol.Tools/Properties/Resources.resx delete mode 100644 src/JT1078.Protocol.Tools/Properties/Settings.Designer.cs delete mode 100644 src/JT1078.Protocol.Tools/Properties/Settings.settings delete mode 100644 src/JT1078.Protocol.Tools/packages.config diff --git a/src/JT1078.Protocol.Tools/App.config b/src/JT1078.Protocol.Tools/App.config deleted file mode 100644 index 226a251..0000000 --- a/src/JT1078.Protocol.Tools/App.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/JT1078.Protocol.Tools/ByteArrayHexConverter.cs b/src/JT1078.Protocol.Tools/ByteArrayHexConverter.cs deleted file mode 100644 index c6c0856..0000000 --- a/src/JT1078.Protocol.Tools/ByteArrayHexConverter.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace JT1078.Protocol.Tools -{ - class ByteArrayHexConverter : JsonConverter - { - public override bool CanConvert(Type objectType) => objectType == typeof(byte[]); - - public override bool CanRead => false; - public override bool CanWrite => true; - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) => throw new NotImplementedException(); - - private readonly string _separator; - - public ByteArrayHexConverter(string separator = " ") => _separator = separator; - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - var hexString = string.Join(_separator, ((byte[])value).Select(p => p.ToString("X2"))); - writer.WriteValue(hexString); - } - } -} diff --git a/src/JT1078.Protocol.Tools/Form1.Designer.cs b/src/JT1078.Protocol.Tools/Form1.Designer.cs deleted file mode 100644 index 6736f3b..0000000 --- a/src/JT1078.Protocol.Tools/Form1.Designer.cs +++ /dev/null @@ -1,87 +0,0 @@ -namespace JT1078.Protocol.Tools -{ - partial class JT1078Form - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要修改 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent() - { - this.button1 = new System.Windows.Forms.Button(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.textBox2 = new System.Windows.Forms.TextBox(); - this.SuspendLayout(); - // - // button1 - // - this.button1.Location = new System.Drawing.Point(12, 31); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(226, 42); - this.button1.TabIndex = 0; - this.button1.Text = "解析"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.Button1_Click); - // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(12, 91); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.textBox1.Size = new System.Drawing.Size(275, 379); - this.textBox1.TabIndex = 2; - // - // textBox2 - // - this.textBox2.Location = new System.Drawing.Point(307, 91); - this.textBox2.Multiline = true; - this.textBox2.Name = "textBox2"; - this.textBox2.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.textBox2.Size = new System.Drawing.Size(503, 379); - this.textBox2.TabIndex = 3; - // - // JT1078Form - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(822, 492); - this.Controls.Add(this.textBox2); - this.Controls.Add(this.textBox1); - this.Controls.Add(this.button1); - this.Name = "JT1078Form"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "JT1078解析工具"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button button1; - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.TextBox textBox2; - } -} - diff --git a/src/JT1078.Protocol.Tools/Form1.cs b/src/JT1078.Protocol.Tools/Form1.cs deleted file mode 100644 index c01ac95..0000000 --- a/src/JT1078.Protocol.Tools/Form1.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using JT1078.Protocol.Tools.Extensions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace JT1078.Protocol.Tools -{ - public partial class JT1078Form : Form - { - public JT1078Form() - { - InitializeComponent(); - Newtonsoft.Json.JsonSerializerSettings setting = new Newtonsoft.Json.JsonSerializerSettings(); - JsonConvert.DefaultSettings = new Func(() => - { - setting.Converters.Add(new StringEnumConverter()); - setting.Converters.Add(new ByteArrayHexConverter()); - return setting; - }); - } - - private void Button1_Click(object sender, EventArgs e) - { - if (string.IsNullOrEmpty(this.textBox1.Text)) - { - MessageBox.Show("请输入数据包!"); - return; - } - try - { - var buffer = this.textBox1.Text.ToHexBytes(); - - JT1078Package package = JT1078Serializer.Deserialize(buffer); - - this.textBox2.Text= JsonConvert.SerializeObject(package, Formatting.Indented); - - - } - catch (Exception ex) - { - this.textBox2.Text = JsonConvert.SerializeObject(ex); - } - } - } -} diff --git a/src/JT1078.Protocol.Tools/Form1.resx b/src/JT1078.Protocol.Tools/Form1.resx deleted file mode 100644 index 1af7de1..0000000 --- a/src/JT1078.Protocol.Tools/Form1.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/src/JT1078.Protocol.Tools/HexExtensions.cs b/src/JT1078.Protocol.Tools/HexExtensions.cs deleted file mode 100644 index e830587..0000000 --- a/src/JT1078.Protocol.Tools/HexExtensions.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; - -namespace JT1078.Protocol.Tools.Extensions -{ - public static partial class BinaryExtensions - { - public static string ToHexString(this byte[] source) - { - return HexUtil.DoHexDump(source, 0, source.Length).ToUpper(); - } - /// - /// 16进制字符串转16进制数组 - /// - /// - /// - /// - 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); - } - } - return buf; - } - } - - public 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)]; - HexdumpTable[(i << 1) + 1] = digits[i & 0x0F]; - } - } - - 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); - } - return new string(buf); - } - - 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); - } - } -} diff --git a/src/JT1078.Protocol.Tools/JT1078.Protocol.Tools.csproj b/src/JT1078.Protocol.Tools/JT1078.Protocol.Tools.csproj deleted file mode 100644 index dc30a97..0000000 --- a/src/JT1078.Protocol.Tools/JT1078.Protocol.Tools.csproj +++ /dev/null @@ -1,148 +0,0 @@ - - - - - Debug - AnyCPU - {97C4DE73-E41C-4026-B97B-79ECC8A71C91} - WinExe - JT1078.Protocol.Tools - JT1078.Protocol.Tools - v4.7.2 - 512 - true - true - false - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 1 - 1.0.0.%2a - false - true - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - EF6E3B26CE85A0FC7A8A4536400E8FC8108FF04F - - - JT1078.Protocol.Tools_TemporaryKey.pfx - - - true - - - false - - - - ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll - - - - ..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll - - - - ..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll - - - - ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll - - - ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll - - - - - - - - - - - - - - - Form - - - Form1.cs - - - - - - Form1.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - False - Microsoft .NET Framework 4.7.2 %28x86 和 x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - - - {60cac24b-7317-48bf-9dbf-7f3eca3689a4} - JT1078.Protocol - - - - \ No newline at end of file diff --git a/src/JT1078.Protocol.Tools/Program.cs b/src/JT1078.Protocol.Tools/Program.cs deleted file mode 100644 index 57969d8..0000000 --- a/src/JT1078.Protocol.Tools/Program.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace JT1078.Protocol.Tools -{ - static class Program - { - /// - /// 应用程序的主入口点。 - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new JT1078Form()); - } - } -} diff --git a/src/JT1078.Protocol.Tools/Properties/AssemblyInfo.cs b/src/JT1078.Protocol.Tools/Properties/AssemblyInfo.cs deleted file mode 100644 index 2798d30..0000000 --- a/src/JT1078.Protocol.Tools/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 有关程序集的一般信息由以下 -// 控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("JT1078.Protocol.Tools")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("JT1078.Protocol.Tools")] -[assembly: AssemblyCopyright("Copyright © 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 会使此程序集中的类型 -//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 -//请将此类型的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("97c4de73-e41c-4026-b97b-79ecc8a71c91")] - -// 程序集的版本信息由下列四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 -//通过使用 "*",如下所示: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/JT1078.Protocol.Tools/Properties/Resources.Designer.cs b/src/JT1078.Protocol.Tools/Properties/Resources.Designer.cs deleted file mode 100644 index 7bc7e33..0000000 --- a/src/JT1078.Protocol.Tools/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本: 4.0.30319.42000 -// -// 对此文件的更改可能导致不正确的行为,如果 -// 重新生成代码,则所做更改将丢失。 -// -//------------------------------------------------------------------------------ - -namespace JT1078.Protocol.Tools.Properties -{ - - - /// - /// 强类型资源类,用于查找本地化字符串等。 - /// - // 此类是由 StronglyTypedResourceBuilder - // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen - // (以 /str 作为命令选项),或重新生成 VS 项目。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// 返回此类使用的缓存 ResourceManager 实例。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("JT1078.Protocol.Tools.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// 覆盖当前线程的 CurrentUICulture 属性 - /// 使用此强类型的资源类的资源查找。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/src/JT1078.Protocol.Tools/Properties/Resources.resx b/src/JT1078.Protocol.Tools/Properties/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/src/JT1078.Protocol.Tools/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/src/JT1078.Protocol.Tools/Properties/Settings.Designer.cs b/src/JT1078.Protocol.Tools/Properties/Settings.Designer.cs deleted file mode 100644 index 035838e..0000000 --- a/src/JT1078.Protocol.Tools/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace JT1078.Protocol.Tools.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/src/JT1078.Protocol.Tools/Properties/Settings.settings b/src/JT1078.Protocol.Tools/Properties/Settings.settings deleted file mode 100644 index 3964565..0000000 --- a/src/JT1078.Protocol.Tools/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/JT1078.Protocol.Tools/packages.config b/src/JT1078.Protocol.Tools/packages.config deleted file mode 100644 index a7dbfa7..0000000 --- a/src/JT1078.Protocol.Tools/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file