Browse Source

refactor: rename BLE_Info to BLEInfo and update references

liuyuqi-dellpc 2 months ago
parent
commit
c118092758
4 changed files with 14 additions and 8 deletions
  1. 2 0
      .gitignore
  2. 2 2
      BLETool/BLEInfo.cs
  3. 5 1
      BLETool/BLETool.csproj
  4. 5 5
      BLETool/MainForm.cs

+ 2 - 0
.gitignore

@@ -2,3 +2,5 @@
 /.vs/BLETool/FileContentIndex
 BLETool/.vs/
 BLETool/obj/
+BLETool/bin/
+BLETool/ble2/windows.winmd

+ 2 - 2
BLETool/ble.cs → BLETool/BLEInfo.cs

@@ -6,7 +6,7 @@ using Windows.Storage.Streams;
 
 namespace BLEComm
 {
-    class BLE_Info
+    class BLEInfo
     {
 
         /// <summary>
@@ -174,7 +174,7 @@ namespace BLEComm
         }
         public static string GetServiceName(GattDeviceService service)
         {
-            BLE_Info.GattNativeServiceUuid serviceName;
+            BLEInfo.GattNativeServiceUuid serviceName;
             if (Enum.TryParse(ConvertUuidToShortId(service.Uuid).ToString(), out serviceName))
             {
                 return serviceName.ToString();

+ 5 - 1
BLETool/BLETool.csproj

@@ -38,6 +38,10 @@
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Runtime.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>ble2\System.Runtime.WindowsRuntime.dll</HintPath>
+    </Reference>
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
@@ -52,7 +56,7 @@
     </Reference>
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="ble.cs" />
+    <Compile Include="BLEInfo.cs" />
     <Compile Include="ClassSerialization.cs" />
     <Compile Include="ListviewSort.cs" />
     <Compile Include="MainForm.cs">

+ 5 - 5
BLETool/MainForm.cs

@@ -14,6 +14,7 @@ using Windows.Security.Cryptography;
 using Windows.Storage.Streams;
 using MSerialization;
 using BLEComm;
+using System.Runtime.InteropServices.WindowsRuntime;
 
 namespace BLETool
 {
@@ -55,7 +56,6 @@ namespace BLETool
             lvwColumnSorter = new ListViewColumnSorter();
             this.lv_device.ListViewItemSorter = lvwColumnSorter;
             this.ss_bottom.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
-            this.toolStripStatusLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
 
         }
         //发现新设备
@@ -370,7 +370,7 @@ namespace BLETool
                 ble_Services = services;
                 foreach (var service in services)
                 {
-                    string servicename = BLE_Info.GetServiceName(service);
+                    string servicename = BLEInfo.GetServiceName(service);
                     cmb_service.Items.Add(servicename);
                 }
                 if (services.Count > 0)
@@ -410,7 +410,7 @@ namespace BLETool
                             ble_Characteristics = characteristics;
                             foreach (var characteristic in characteristics)
                             {
-                                string characteristicname = BLE_Info.GetCharacteristicName(characteristic);
+                                string characteristicname = BLEInfo.GetCharacteristicName(characteristic);
                                 cmb_characteristic.Items.Add(characteristicname);
                             }
                             if (ble_Characteristics.Count > 0)
@@ -490,7 +490,7 @@ namespace BLETool
                 txt_UTF8Result.Text = "";
                 var result = args.CharacteristicValue;
                 string type = "";
-                string formattedResult = BLE_Info.FormatValueByPresentation(result, presentationFormat, out type);
+                string formattedResult = BLEInfo.FormatValueByPresentation(result, presentationFormat, out type);
                 txt_UTF8Result.Text = formattedResult;
                 if (type == "HEX") { rad_hex.Checked = true; rad_dec.Checked = false; rad_utf8.Checked = false; }
                 if (type == "Decimal") { rad_hex.Checked = false; rad_dec.Checked = true; rad_utf8.Checked = false; }
@@ -711,7 +711,7 @@ namespace BLETool
             {
                 ble_result = result.Value;
                 string type = "";
-                string formattedResult = BLE_Info.FormatValueByPresentation(result.Value, presentationFormat, out type);
+                string formattedResult = BLEInfo.FormatValueByPresentation(result.Value, presentationFormat, out type);
                 txt_UTF8Result.Text = formattedResult;
                 if (type == "HEX") { rad_hex.Checked = true; rad_dec.Checked = false; rad_utf8.Checked = false; }
                 if (type == "Decimal") { rad_hex.Checked = false; rad_dec.Checked = true; rad_utf8.Checked = false; }