Zixuan 2 тижнів тому
батько
коміт
6b1b62ccc6

+ 2 - 0
CommunicationProtocols/FinsTcp/FinsTcpBase.cs

@@ -496,6 +496,8 @@ internal class ConvertClass
         txtq = Regex.Replace(txt, "[^0-9.]", "");
         return true;
     }
+
+
 }
 
 internal class ErrorCode

+ 8 - 0
CommunicationProtocols/FinsTcp/GlobalSuppressions.cs

@@ -0,0 +1,8 @@
+// This file is used by Code Analysis to maintain SuppressMessage
+// attributes that are applied to this project.
+// Project-level suppressions either have no target or are given
+// a specific target and scoped to a namespace, type, member, etc.
+
+using System.Diagnostics.CodeAnalysis;
+
+[assembly: SuppressMessage("Performance", "SYSLIB1045:Convert to 'GeneratedRegexAttribute'.", Justification = "<Pending>", Scope = "member", Target = "~M:FinsTcp.ConvertClass.GetPlcMemory(System.String,System.String@,FinsTcp.PlcMemory@)~System.Boolean")]

+ 1 - 1
Directory.Packages.props

@@ -23,7 +23,7 @@
     <PackageVersion Include="Prism.DryIoc" Version="9.0.537" />
     <PackageVersion Include="ScottPlot.WPF" Version="5.0.55" />
     <PackageVersion Include="SqlSugarCore" Version="5.1.4.185" />
-    <PackageVersion Include="System.IO.Ports" Version="9.0.5" />
+    <PackageVersion Include="System.IO.Ports" Version="9.0.6" />
     <PackageVersion Include="System.Management" Version="9.0.3" />
     <PackageVersion Include="System.Net.Sockets" Version="4.3.0" />
   </ItemGroup>

+ 1 - 0
HistoryUI/HistoryUI.csproj

@@ -12,6 +12,7 @@
 		<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
 		<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
 		<UseWindowsForms>True</UseWindowsForms>
+		<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
 	</PropertyGroup>
 
 	<ItemGroup>

+ 0 - 7
HistoryUI/ViewModels/StatusViewModel.cs

@@ -1,12 +1,5 @@
 using GeneralData;
-using HandyControl.Tools.Extension;
-using NPOI.SS.UserModel;
-using Org.BouncyCastle.Tls.Crypto;
-using ScottPlot.Colormaps;
 using ScottPlot.Plottables;
-using System.Windows.Media.TextFormatting;
-using Universal;
-using static SkiaSharp.HarfBuzz.SKShaper;
 
 namespace HistoryUI.ViewModels;
 

+ 1 - 0
MinicsConsole/MinicsConsole.csproj

@@ -9,6 +9,7 @@
 		<Nullable>enable</Nullable>
 		<UseWPF>true</UseWPF>
 		<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
+		<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
 	</PropertyGroup>
 
 	<ItemGroup>

+ 1 - 0
MinicsUI/MinicsUI.csproj

@@ -14,6 +14,7 @@
 		<UseWindowsForms>True</UseWindowsForms>
 		<PackageIcon>MyLogoNormal.ico</PackageIcon>
 		<ApplicationIcon>Resources\MyLogoNormal.ico</ApplicationIcon>
+		<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
 	</PropertyGroup>
 
 	<ItemGroup>

+ 1 - 4
MinicsUI/ViewModels/Dialogs/TraceLogViewModel.cs

@@ -1,7 +1,4 @@
-
-using NPOI.SS.Formula.Functions;
-
-namespace MinicsUI.ViewModels.Dialogs;
+namespace MinicsUI.ViewModels.Dialogs;
 
 public partial class TraceLogViewModel(Hardwares hardwares, DialogService dialogService) : ObservableObject, IDialogAwareTitle
 {

+ 2 - 0
Tools/OnlineLogViewer/OnlineLogViewer.csproj

@@ -8,6 +8,8 @@
 		<ImplicitUsings>enable</ImplicitUsings>
 		<Nullable>enable</Nullable>
 		<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
+		<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
+
 	</PropertyGroup>
 
 	<ItemGroup>

+ 51 - 5
Tools/ToMcFile/Program.cs

@@ -1,5 +1,7 @@
 using ConfigOperator;
 using GeneralData;
+using NPOI.SS.UserModel;
+using NPOI.XSSF.UserModel;
 using TemperatureConfigFile;
 using Universal;
 
@@ -80,8 +82,10 @@ internal class Program
     private static ChannelConfig GetChannelConfig(Dictionary<int, string> channel, int numerator, int denominator)
     {
         string[] content = [.. channel.Values];
-        ChannelConfig config = new();
-        config.Index = byte.Parse(content[1]);
+        ChannelConfig config = new()
+        {
+            Index = byte.Parse(content[1])
+        };
 
         if (float.TryParse(content[2], out float setPoint))
         {
@@ -144,8 +148,10 @@ internal class Program
     private static ChannelConfig GetChannelConfig(Dictionary<int, string> channel)
     {
         string[] content = [.. channel.Values];
-        ChannelConfig config = new();
-        config.Index = byte.Parse(content[1]);
+        ChannelConfig config = new()
+        {
+            Index = byte.Parse(content[1])
+        };
 
         if (float.TryParse(content[2], out float setPoint))
             config.SetPoint = setPoint;
@@ -189,4 +195,44 @@ internal class Program
 
         return config;
     }
-}
+}
+
+public class ExcelReader
+{
+    public static Dictionary<string, Dictionary<int, Dictionary<int, string>>> Read(string filePath, int startRow)
+    {
+        Dictionary<string, Dictionary<int, Dictionary<int, string>>> sheets = [];
+
+        using FileStream file = new(filePath, FileMode.Open, FileAccess.Read);
+
+        for (int i = 0; ; i++)
+        {
+            ISheet sheet;
+            try
+            {
+                sheet = new XSSFWorkbook(file).GetSheetAt(i);
+                if (sheet is null)
+                    break;
+            }
+            catch
+            {
+                break;
+            }
+            Dictionary<int, Dictionary<int, string>> contents = [];
+            sheets[sheet.SheetName] = contents;
+
+            for (int row = startRow; row <= sheet.LastRowNum; row++)
+            {
+                if (sheet.GetRow(row) is not IRow currentRow)
+                    continue;
+                contents[row] = [];
+                for (int colum = 0; colum < currentRow.LastCellNum; colum++)
+                {
+                    ICell cell = currentRow.GetCell(colum);
+                    contents[row][colum] = cell?.ToString() ?? string.Empty;
+                }
+            }
+        }
+        return sheets;
+    }
+}

+ 1 - 0
Tools/ToMcFile/ToMcFile.csproj

@@ -5,6 +5,7 @@
 		<TargetFramework>net8.0</TargetFramework>
 		<OutputPath>$(SolutionDir)Binary\Tools\ToPMCScript</OutputPath>
 		<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
+		<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
 
 		<ImplicitUsings>enable</ImplicitUsings>
 		<Nullable>enable</Nullable>

+ 6 - 0
Tools/UserTool/UserTool.csproj

@@ -7,9 +7,15 @@
 	  <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
 	  <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
+	  <SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
+
   </PropertyGroup>
 
   <ItemGroup>
+    <PackageReference Include="NPOI" />
+  </ItemGroup>
+
+  <ItemGroup>
     <ProjectReference Include="..\..\Configs\CofigOperator\ConfigOperator.csproj" />
     <ProjectReference Include="..\..\DataBase\ORM\ORM.csproj" />
     <ProjectReference Include="..\..\DataBase\SqlSugarORM\SqlSugarORM.csproj" />

+ 0 - 44
Universal/ExcelReader.cs

@@ -1,44 +0,0 @@
-using NPOI.SS.UserModel;
-using NPOI.XSSF.UserModel;
-
-namespace Universal;
-
-public class ExcelReader
-{
-    public static Dictionary<string, Dictionary<int, Dictionary<int, string>>> Read(string filePath, int startRow)
-    {
-        Dictionary<string, Dictionary<int, Dictionary<int, string>>> sheets = [];
-        
-        using FileStream file = new(filePath, FileMode.Open, FileAccess.Read);
-
-        for (int i = 0; ; i++)
-        {
-            ISheet sheet;
-            try
-            {
-                sheet = new XSSFWorkbook(file).GetSheetAt(i);
-                if (sheet is null)
-                    break;
-            }
-            catch
-            {
-                break;
-            }
-            Dictionary<int, Dictionary<int, string>> contents = [];
-            sheets[sheet.SheetName] = contents;
-
-            for (int row = startRow; row <= sheet.LastRowNum; row++)
-            {
-                if (sheet.GetRow(row) is not IRow currentRow)
-                    continue;
-                contents[row] = [];
-                for (int colum = 0; colum < currentRow.LastCellNum; colum++)
-                {
-                    ICell cell = currentRow.GetCell(colum);
-                    contents[row][colum] = cell?.ToString() ?? string.Empty;
-                }
-            }
-        }
-        return sheets;
-    }
-}

+ 0 - 48
Universal/ParallelHelper.cs

@@ -1,48 +0,0 @@
-namespace Universal;
-
-public class ParallelHelper : IDisposable
-{
-    private readonly List<Task> _tasks = [];
-    private bool _isStarted = false;
-
-    void IDisposable.Dispose()
-    {
-        _tasks.ForEach(task => task.Dispose());
-        _tasks.Clear();
-        _isStarted = false;
-    }
-
-    public bool Insert(Action action)
-    {
-        if (_isStarted)
-            return false;
-
-        Task task = new(action);
-        _tasks.Add(task);
-
-        return true;
-    }
-
-
-    public bool StartnWaitAll()
-    {
-        if (_isStarted)
-            return false;
-        _tasks.ForEach(t => t.Start());
-
-        Task.WhenAll(_tasks).Wait();
-        _isStarted = false;
-        _tasks.Clear();
-        return true;
-    }
-
-    public bool StartnWaitAny()
-    {
-        if (_isStarted)
-            return false;
-        _tasks.ForEach(t => t.Start());
-
-        Task.WhenAny(_tasks).Wait();
-        return true;
-    }
-}

+ 1 - 4
Universal/RingBuffer.cs

@@ -1,7 +1,4 @@
-using Org.BouncyCastle.Crypto.Fpe;
-using System.Collections.Generic;
-
-namespace Universal;
+namespace Universal;
 
 public class RingBuffer<T>(int size)
 {

+ 0 - 2
Universal/Universal.csproj

@@ -16,8 +16,6 @@
 	</ItemGroup>
 
 	<ItemGroup>
-	  <PackageReference Include="FluentModbus" />
-	  <PackageReference Include="NPOI" />
 	  <PackageReference Include="System.IO.Ports" />
 	</ItemGroup>