shayne_lo 7 сар өмнө
parent
commit
de8cea4950
51 өөрчлөгдсөн 2180 нэмэгдсэн , 2180 устгасан
  1. 260 260
      .gitignore
  2. 4 4
      ApiTest/Properties/AssemblyInfo.cs
  3. 12 12
      AwInitilizer/App.xaml
  4. 59 59
      AwInitilizer/Assist/EvHttpClientLogger.cs
  5. 45 45
      AwInitilizer/Assist/SemaphoreQueue.cs
  6. 210 210
      AwInitilizer/Assist/TcpSerializer.cs
  7. 19 19
      AwInitilizer/Assist/WebClientTimeout.cs
  8. 29 29
      AwInitilizer/Converter/BooleanAndConverter.cs
  9. 24 24
      AwInitilizer/Converter/PressStatusConverter.cs
  10. 13 13
      AwInitilizer/Interface/IIogger.cs
  11. 26 26
      AwInitilizer/Interface/ISerialPort.cs
  12. 122 122
      AwInitilizer/KeyinListener.cs
  13. 41 41
      AwInitilizer/ManualSn.xaml
  14. 35 35
      AwInitilizer/ManualSn.xaml.cs
  15. 15 15
      AwInitilizer/Model/ButtonStatus.cs
  16. 16 16
      AwInitilizer/Model/EvseSerialResponseModel.cs
  17. 15 15
      AwInitilizer/Model/SimStatus.cs
  18. 21 21
      AwInitilizer/Model/UploadFile.cs
  19. 4 4
      AwInitilizer/Procedure/BasicInfoUpdateProcedure.cs
  20. 6 6
      AwInitilizer/Procedure/ProcedureBase.cs
  21. 5 5
      AwInitilizer/Procedure/RestarttoIdelProcedure.cs
  22. 3 3
      AwInitilizer/Procedure/VersionLogProcedure.cs
  23. 93 93
      AwInitilizer/ProcedureLog/LogWriter.cs
  24. 4 4
      AwInitilizer/Properties/AssemblyInfo.cs
  25. 26 26
      AwInitilizer/Properties/Settings.Designer.cs
  26. 4 4
      AwInitilizer/Properties/Settings.settings
  27. 76 76
      AwInitilizer/app.manifest
  28. 4 4
      AwInitlizerInstaller__Shinewave/DLL.INI
  29. 4 4
      AwInitlizerInstaller__Shinewave/config.ini
  30. 4 4
      ConfigEditor/Properties/AssemblyInfo.cs
  31. 4 4
      Editor/Properties/AssemblyInfo.cs
  32. 4 4
      InitializerModel/Properties/AssemblyInfo.cs
  33. 9 9
      Initilizer/App.xaml
  34. 17 17
      Initilizer/App.xaml.cs
  35. 3 3
      Initilizer/AssemblyInfo.cs
  36. 8 8
      Initilizer/Initilizer.csproj
  37. 12 12
      Initilizer/MainWindow.xaml
  38. 28 28
      Initilizer/MainWindow.xaml.cs
  39. 4 4
      InitlizerInstaller_Sajet/config.ini
  40. 5 5
      InitlizerInstaller_Sajet2/config.ini
  41. 22 22
      MesAdaptor/ISajetConnect.cs
  42. 64 64
      MesAdaptor/MesAdaptor.csproj
  43. 29 29
      MesAdaptor/MesErrorCode.cs
  44. 4 4
      MesAdaptor/Properties/AssemblyInfo.cs
  45. 275 275
      MesAdaptor/SajectConnectSajet.cs
  46. 283 283
      MesAdaptor/SajectConnectSajet2.cs
  47. 31 31
      MesAdaptor/SajectConnectTest.cs
  48. 59 59
      MesAdaptor/SajetConnectAdapter.cs
  49. 74 74
      MesAdaptor/ValueReportData.cs
  50. 3 3
      MesAdaptor/packages.config
  51. 43 43
      fixDuplicateModel.patch

+ 260 - 260
.gitignore

@@ -1,261 +1,261 @@
-## Ignore Visual Studio temporary files, build results, and
-## files generated by popular Visual Studio add-ons.
-
-# User-specific files
-*.suo
-*.user
-*.userosscache
-*.sln.docstates
-
-# User-specific files (MonoDevelop/Xamarin Studio)
-*.userprefs
-
-# Build results
-[Dd]ebug/
-[Dd]ebugPublic/
-[Rr]elease/
-[Rr]eleases/
-x64/
-x86/
-bld/
-[Bb]in/
-[Oo]bj/
-[Ll]og/
-
-# Visual Studio 2015 cache/options directory
-.vs/
-# Uncomment if you have tasks that create the project's static files in wwwroot
-#wwwroot/
-
-# MSTest test Results
-[Tt]est[Rr]esult*/
-[Bb]uild[Ll]og.*
-
-# NUNIT
-*.VisualState.xml
-TestResult.xml
-
-# Build Results of an ATL Project
-[Dd]ebugPS/
-[Rr]eleasePS/
-dlldata.c
-
-# DNX
-project.lock.json
-project.fragment.lock.json
-artifacts/
-
-*_i.c
-*_p.c
-*_i.h
-*.ilk
-*.meta
-*.obj
-*.pch
-*.pdb
-*.pgc
-*.pgd
-*.rsp
-*.sbr
-*.tlb
-*.tli
-*.tlh
-*.tmp
-*.tmp_proj
-*.log
-*.vspscc
-*.vssscc
-.builds
-*.pidb
-*.svclog
-*.scc
-
-# Chutzpah Test files
-_Chutzpah*
-
-# Visual C++ cache files
-ipch/
-*.aps
-*.ncb
-*.opendb
-*.opensdf
-*.sdf
-*.cachefile
-*.VC.db
-*.VC.VC.opendb
-
-# Visual Studio profiler
-*.psess
-*.vsp
-*.vspx
-*.sap
-
-# TFS 2012 Local Workspace
-$tf/
-
-# Guidance Automation Toolkit
-*.gpState
-
-# ReSharper is a .NET coding add-in
-_ReSharper*/
-*.[Rr]e[Ss]harper
-*.DotSettings.user
-
-# JustCode is a .NET coding add-in
-.JustCode
-
-# TeamCity is a build add-in
-_TeamCity*
-
-# DotCover is a Code Coverage Tool
-*.dotCover
-
-# NCrunch
-_NCrunch_*
-.*crunch*.local.xml
-nCrunchTemp_*
-
-# MightyMoose
-*.mm.*
-AutoTest.Net/
-
-# Web workbench (sass)
-.sass-cache/
-
-# Installshield output folder
-[Ee]xpress/
-
-# DocProject is a documentation generator add-in
-DocProject/buildhelp/
-DocProject/Help/*.HxT
-DocProject/Help/*.HxC
-DocProject/Help/*.hhc
-DocProject/Help/*.hhk
-DocProject/Help/*.hhp
-DocProject/Help/Html2
-DocProject/Help/html
-
-# Click-Once directory
-publish/
-
-# Publish Web Output
-*.[Pp]ublish.xml
-*.azurePubxml
-# TODO: Comment the next line if you want to checkin your web deploy settings
-# but database connection strings (with potential passwords) will be unencrypted
-#*.pubxml
-*.publishproj
-
-# Microsoft Azure Web App publish settings. Comment the next line if you want to
-# checkin your Azure Web App publish settings, but sensitive information contained
-# in these scripts will be unencrypted
-PublishScripts/
-
-# NuGet Packages
-*.nupkg
-# The packages folder can be ignored because of Package Restore
-**/packages/*
-# except build/, which is used as an MSBuild target.
-!**/packages/build/
-# Uncomment if necessary however generally it will be regenerated when needed
-#!**/packages/repositories.config
-# NuGet v3's project.json files produces more ignoreable files
-*.nuget.props
-*.nuget.targets
-
-# Microsoft Azure Build Output
-csx/
-*.build.csdef
-
-# Microsoft Azure Emulator
-ecf/
-rcf/
-
-# Windows Store app package directories and files
-AppPackages/
-BundleArtifacts/
-Package.StoreAssociation.xml
-_pkginfo.txt
-
-# Visual Studio cache files
-# files ending in .cache can be ignored
-*.[Cc]ache
-# but keep track of directories ending in .cache
-!*.[Cc]ache/
-
-# Others
-ClientBin/
-~$*
-*~
-*.dbmdl
-*.dbproj.schemaview
-*.jfm
-*.pfx
-*.publishsettings
-node_modules/
-orleans.codegen.cs
-
-# Since there are multiple workflows, uncomment next line to ignore bower_components
-# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
-#bower_components/
-
-# RIA/Silverlight projects
-Generated_Code/
-
-# Backup & report files from converting an old project file
-# to a newer Visual Studio version. Backup files are not needed,
-# because we have git ;-)
-_UpgradeReport_Files/
-Backup*/
-UpgradeLog*.XML
-UpgradeLog*.htm
-
-# SQL Server files
-*.mdf
-*.ldf
-
-# Business Intelligence projects
-*.rdl.data
-*.bim.layout
-*.bim_*.settings
-
-# Microsoft Fakes
-FakesAssemblies/
-
-# GhostDoc plugin setting file
-*.GhostDoc.xml
-
-# Node.js Tools for Visual Studio
-.ntvs_analysis.dat
-
-# Visual Studio 6 build log
-*.plg
-
-# Visual Studio 6 workspace options file
-*.opt
-
-# Visual Studio LightSwitch build output
-**/*.HTMLClient/GeneratedArtifacts
-**/*.DesktopClient/GeneratedArtifacts
-**/*.DesktopClient/ModelManifest.xml
-**/*.Server/GeneratedArtifacts
-**/*.Server/ModelManifest.xml
-_Pvt_Extensions
-
-# Paket dependency manager
-.paket/paket.exe
-paket-files/
-
-# FAKE - F# Make
-.fake/
-
-# JetBrains Rider
-.idea/
-*.sln.iml
-
-# CodeRush
-.cr/
-
-# Python Tools for Visual Studio (PTVS)
-__pycache__/
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+#*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
 *.pyc

+ 4 - 4
ApiTest/Properties/AssemblyInfo.cs

@@ -50,7 +50,7 @@ using System.Windows;
 //
 // 您可以指定所有的值,也可以使用 '*' 將組建和修訂編號
 // 設為預設,如下所示:
-// [assembly: AssemblyVersion("1.13.1.0")]
-[assembly: AssemblyVersion("1.13.1.0")]
-[assembly: AssemblyFileVersion("1.13.1.0")]
-[assembly: AssemblyInformationalVersion("3a0b9b9")]
+// [assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyFileVersion("1.13.2.0")]
+[assembly: AssemblyInformationalVersion("e8c61f8")]

+ 12 - 12
AwInitilizer/App.xaml

@@ -1,12 +1,12 @@
-<Application x:Class="AwInitilizer.App"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:local="clr-namespace:AwInitilizer" 
-             xmlns:converterNamespace="clr-namespace:AwInitilizer.Converter"
-             StartupUri="MainWindow.xaml">
-    <Application.Resources>
-        <ResourceDictionary>
-            <converterNamespace:BooleanAndConverter x:Key="booleanAndConverter" />
-        </ResourceDictionary>
-    </Application.Resources>
-</Application>
+<Application x:Class="AwInitilizer.App"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:local="clr-namespace:AwInitilizer" 
+             xmlns:converterNamespace="clr-namespace:AwInitilizer.Converter"
+             StartupUri="MainWindow.xaml">
+    <Application.Resources>
+        <ResourceDictionary>
+            <converterNamespace:BooleanAndConverter x:Key="booleanAndConverter" />
+        </ResourceDictionary>
+    </Application.Resources>
+</Application>

+ 59 - 59
AwInitilizer/Assist/EvHttpClientLogger.cs

@@ -1,59 +1,59 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace AwInitilizer.Assist
-{
-    public class EvHttpClientLogger
-    {
-        public static EvHttpClientLogger Instance => _Instance;
-
-        private static EvHttpClientLogger _Instance = new EvHttpClientLogger();
-
-        private EvHttpClientLogger()
-        {
-            if (!Directory.Exists(FolderName))
-            {
-                Directory.CreateDirectory(FolderName);
-            }
-        }
-        private const string FolderName = "ApiLog";
-        private const int MaxLogCnt = 10;
-        private string LogFileName = null;
-
-        internal void StartNewLog(string name)
-        {
-            TryRemoveOneLog();
-            LogFileName = name + DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".txt";
-        }
-
-        internal void Log(string mesasage)
-        {
-            if (string.IsNullOrEmpty(LogFileName))
-            {
-                return;
-            }
-            File.AppendAllText(Path.Combine(FolderName, LogFileName), mesasage + Environment.NewLine);
-        }
-
-        private void TryRemoveOneLog()
-        {
-            var files = Directory.GetFiles(FolderName).ToList();
-            if (files.Count < MaxLogCnt)
-            {
-                return;
-            }
-
-            List<FileInfo> fileInfos = new List<FileInfo>();
-            foreach (var file in files) {
-                fileInfos.Add(new FileInfo(file));
-            }
-            var candidateFile = fileInfos.OrderBy(x => x.LastWriteTimeUtc).First();
-            candidateFile.Delete();
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace AwInitilizer.Assist
+{
+    public class EvHttpClientLogger
+    {
+        public static EvHttpClientLogger Instance => _Instance;
+
+        private static EvHttpClientLogger _Instance = new EvHttpClientLogger();
+
+        private EvHttpClientLogger()
+        {
+            if (!Directory.Exists(FolderName))
+            {
+                Directory.CreateDirectory(FolderName);
+            }
+        }
+        private const string FolderName = "ApiLog";
+        private const int MaxLogCnt = 10;
+        private string LogFileName = null;
+
+        internal void StartNewLog(string name)
+        {
+            TryRemoveOneLog();
+            LogFileName = name + DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".txt";
+        }
+
+        internal void Log(string mesasage)
+        {
+            if (string.IsNullOrEmpty(LogFileName))
+            {
+                return;
+            }
+            File.AppendAllText(Path.Combine(FolderName, LogFileName), mesasage + Environment.NewLine);
+        }
+
+        private void TryRemoveOneLog()
+        {
+            var files = Directory.GetFiles(FolderName).ToList();
+            if (files.Count < MaxLogCnt)
+            {
+                return;
+            }
+
+            List<FileInfo> fileInfos = new List<FileInfo>();
+            foreach (var file in files) {
+                fileInfos.Add(new FileInfo(file));
+            }
+            var candidateFile = fileInfos.OrderBy(x => x.LastWriteTimeUtc).First();
+            candidateFile.Delete();
+        }
+    }
+}

+ 45 - 45
AwInitilizer/Assist/SemaphoreQueue.cs

@@ -1,45 +1,45 @@
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace AwInitilizer.Assist
-{
-    public class SemaphoreQueue
-    {
-        private SemaphoreSlim semaphore;
-        private ConcurrentQueue<TaskCompletionSource<bool>> queue =
-            new ConcurrentQueue<TaskCompletionSource<bool>>();
-        public SemaphoreQueue(int initialCount)
-        {
-            semaphore = new SemaphoreSlim(initialCount);
-        }
-        public SemaphoreQueue(int initialCount, int maxCount)
-        {
-            semaphore = new SemaphoreSlim(initialCount, maxCount);
-        }
-        public void Wait()
-        {
-            WaitAsync().Wait();
-        }
-        public Task WaitAsync()
-        {
-            var tcs = new TaskCompletionSource<bool>();
-            queue.Enqueue(tcs);
-            semaphore.WaitAsync().ContinueWith(t =>
-            {
-                TaskCompletionSource<bool> popped;
-                if (queue.TryDequeue(out popped))
-                    popped.SetResult(true);
-            });
-            return tcs.Task;
-        }
-        public void Release()
-        {
-            semaphore.Release();
-        }
-    }
-}
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Assist
+{
+    public class SemaphoreQueue
+    {
+        private SemaphoreSlim semaphore;
+        private ConcurrentQueue<TaskCompletionSource<bool>> queue =
+            new ConcurrentQueue<TaskCompletionSource<bool>>();
+        public SemaphoreQueue(int initialCount)
+        {
+            semaphore = new SemaphoreSlim(initialCount);
+        }
+        public SemaphoreQueue(int initialCount, int maxCount)
+        {
+            semaphore = new SemaphoreSlim(initialCount, maxCount);
+        }
+        public void Wait()
+        {
+            WaitAsync().Wait();
+        }
+        public Task WaitAsync()
+        {
+            var tcs = new TaskCompletionSource<bool>();
+            queue.Enqueue(tcs);
+            semaphore.WaitAsync().ContinueWith(t =>
+            {
+                TaskCompletionSource<bool> popped;
+                if (queue.TryDequeue(out popped))
+                    popped.SetResult(true);
+            });
+            return tcs.Task;
+        }
+        public void Release()
+        {
+            semaphore.Release();
+        }
+    }
+}

+ 210 - 210
AwInitilizer/Assist/TcpSerializer.cs

@@ -1,210 +1,210 @@
-using AwInitilizer.Interface;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Net;
-using System.Net.Sockets;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AwInitilizer.Assist
-{
-    public class TcpSerializer : Interface.ISerialPort
-    {
-        public event EventHandler<byte[]> OnDataReceived;
-        public event PropertyChangedEventHandler PropertyChanged;
-
-        public string IP { get; private set; }
-
-        private ConnectStatus _ConnectStatus = ConnectStatus.Cleared;
-        public ConnectStatus ConnectStatus
-        {
-            get => _ConnectStatus;
-            set
-            {
-                if (_ConnectStatus != value)
-                {
-                    _ConnectStatus = value;
-                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ConnectStatus"));
-                }
-            }
-        }
-
-        private IPAddress iPAddress;
-        private IPEndPoint iPEndPoint;
-        private Socket tcpSocket;
-
-        public TcpSerializer(string ip = "192.168.1.10",int port = 8234)
-        {
-            IP = ip;
-
-            iPAddress = IPAddress.Parse(ip);
-            iPEndPoint = new IPEndPoint(iPAddress, port);
-        }
-
-        public async Task OpenAsync()
-        {
-            await Conenct();
-        }
-
-        public void Open()
-        {
-            _ = Conenct();
-        }
-
-        public void Close()
-        {
-            ConnectStatus = ConnectStatus.DisConnected;
-            try
-            {
-                tcpSocket?.Close();
-                tcpSocket?.Dispose();
-            }
-            catch
-            {
-
-            }
-        }
-
-        public void WriteData(byte[] msg)
-        {
-            if (ConnectStatus != ConnectStatus.Connected)
-                return;
-            tcpSocket.Send(msg);
-        }
-
-        private async Task Conenct()
-        {
-            ConnectStatus = ConnectStatus.Connecting;
-
-            tcpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
-            tcpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
-            var connectTask = tcpSocket.ConnectAsync(iPEndPoint);
-            //var asyncResult = tcpSocket.BeginConnect(iPEndPoint, OnTcpConnectComplete, null);
-            //await Task.Delay(2 * 1000);
-            await Task.WhenAny(connectTask, Task.Delay(2 * 1000));
-            if (tcpSocket.Connected)
-            {
-                ConnectStatus = ConnectStatus.Connected;
-
-                var stateObject = new StateObject(bufferSize: 512, tcpSocket);
-                WaitForData(stateObject);
-            }
-            else
-            {
-                ConnectStatus = ConnectStatus.ConnectionFail;
-
-                //Try Clear - disconnect
-                Close();
-            }
-        }
-
-        private void OnTcpConnectComplete(IAsyncResult ar)
-        {
-            if (tcpSocket.Connected)
-            {
-                ConnectStatus = ConnectStatus.Connected;
-
-                var stateObject = new StateObject(bufferSize: 512, tcpSocket);
-                WaitForData(stateObject);
-            }
-            else
-            {
-                ConnectStatus = ConnectStatus.ConnectionFail;
-            }
-        }
-
-        private void WaitForData(StateObject stateObject)
-        {
-            try
-            {
-                var soc = stateObject.sSocket;
-
-                if (!soc.Connected) { return; }
-
-                IAsyncResult iar = soc.BeginReceive(
-                    stateObject.sBuffer,
-                    0,
-                    stateObject.sBuffer.Length,
-                    SocketFlags.None,
-                    new AsyncCallback(ReveiveCallBack),
-                    stateObject);
-            }
-            catch (Exception e)
-            {
-                if (e != null)
-                {
-                    if (e.Message != null)
-                        Console.WriteLine(e.Message);
-                    if (e.StackTrace != null)
-                        Console.WriteLine(e.StackTrace);
-                }
-            }
-        }
-
-        private void ReveiveCallBack(IAsyncResult ar)
-        {
-            StateObject stateObject = (StateObject)ar.AsyncState;
-
-            if (!stateObject.sSocket.Connected)
-            {
-                //server Diconnected
-                HandleDisconnected();
-                return;
-            }
-
-            int bytesReceived;
-            try
-            {
-                bytesReceived = stateObject.sSocket.EndReceive(ar);
-            }
-            catch (SocketException e)
-            {
-                if (e != null)
-                {
-                    if (e.Message != null)
-                        System.Diagnostics.Debug.WriteLine(e.Message);
-                    if (e.StackTrace != null)
-                        System.Diagnostics.Debug.WriteLine(e.StackTrace);
-                }
-
-                //server Diconnected
-                HandleDisconnected();
-                return;
-            }
-
-            if (bytesReceived == 0)
-            {
-                stateObject.sSocket.Disconnect(true);
-                HandleDisconnected();
-                return;
-            }
-
-            byte[] receivedBytes = new byte[bytesReceived];
-            Array.Copy(stateObject.sBuffer, 0, receivedBytes, 0, bytesReceived);
-
-            OnDataReceived?.Invoke(this, receivedBytes);
-
-            //continue receive
-            WaitForData(stateObject);
-        }
-
-        private void HandleDisconnected()
-        {
-            Close();
-        }
-    }
-
-    internal class StateObject
-    {
-        public byte[] sBuffer;
-        public Socket sSocket;
-
-        public StateObject(int bufferSize, Socket sock, int timeOutMilliSecond = -1)
-        {
-            sBuffer = new byte[bufferSize];
-            sSocket = sock;
-        }
-    }
-}
+using AwInitilizer.Interface;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Assist
+{
+    public class TcpSerializer : Interface.ISerialPort
+    {
+        public event EventHandler<byte[]> OnDataReceived;
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        public string IP { get; private set; }
+
+        private ConnectStatus _ConnectStatus = ConnectStatus.Cleared;
+        public ConnectStatus ConnectStatus
+        {
+            get => _ConnectStatus;
+            set
+            {
+                if (_ConnectStatus != value)
+                {
+                    _ConnectStatus = value;
+                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ConnectStatus"));
+                }
+            }
+        }
+
+        private IPAddress iPAddress;
+        private IPEndPoint iPEndPoint;
+        private Socket tcpSocket;
+
+        public TcpSerializer(string ip = "192.168.1.10",int port = 8234)
+        {
+            IP = ip;
+
+            iPAddress = IPAddress.Parse(ip);
+            iPEndPoint = new IPEndPoint(iPAddress, port);
+        }
+
+        public async Task OpenAsync()
+        {
+            await Conenct();
+        }
+
+        public void Open()
+        {
+            _ = Conenct();
+        }
+
+        public void Close()
+        {
+            ConnectStatus = ConnectStatus.DisConnected;
+            try
+            {
+                tcpSocket?.Close();
+                tcpSocket?.Dispose();
+            }
+            catch
+            {
+
+            }
+        }
+
+        public void WriteData(byte[] msg)
+        {
+            if (ConnectStatus != ConnectStatus.Connected)
+                return;
+            tcpSocket.Send(msg);
+        }
+
+        private async Task Conenct()
+        {
+            ConnectStatus = ConnectStatus.Connecting;
+
+            tcpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+            tcpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
+            var connectTask = tcpSocket.ConnectAsync(iPEndPoint);
+            //var asyncResult = tcpSocket.BeginConnect(iPEndPoint, OnTcpConnectComplete, null);
+            //await Task.Delay(2 * 1000);
+            await Task.WhenAny(connectTask, Task.Delay(2 * 1000));
+            if (tcpSocket.Connected)
+            {
+                ConnectStatus = ConnectStatus.Connected;
+
+                var stateObject = new StateObject(bufferSize: 512, tcpSocket);
+                WaitForData(stateObject);
+            }
+            else
+            {
+                ConnectStatus = ConnectStatus.ConnectionFail;
+
+                //Try Clear - disconnect
+                Close();
+            }
+        }
+
+        private void OnTcpConnectComplete(IAsyncResult ar)
+        {
+            if (tcpSocket.Connected)
+            {
+                ConnectStatus = ConnectStatus.Connected;
+
+                var stateObject = new StateObject(bufferSize: 512, tcpSocket);
+                WaitForData(stateObject);
+            }
+            else
+            {
+                ConnectStatus = ConnectStatus.ConnectionFail;
+            }
+        }
+
+        private void WaitForData(StateObject stateObject)
+        {
+            try
+            {
+                var soc = stateObject.sSocket;
+
+                if (!soc.Connected) { return; }
+
+                IAsyncResult iar = soc.BeginReceive(
+                    stateObject.sBuffer,
+                    0,
+                    stateObject.sBuffer.Length,
+                    SocketFlags.None,
+                    new AsyncCallback(ReveiveCallBack),
+                    stateObject);
+            }
+            catch (Exception e)
+            {
+                if (e != null)
+                {
+                    if (e.Message != null)
+                        Console.WriteLine(e.Message);
+                    if (e.StackTrace != null)
+                        Console.WriteLine(e.StackTrace);
+                }
+            }
+        }
+
+        private void ReveiveCallBack(IAsyncResult ar)
+        {
+            StateObject stateObject = (StateObject)ar.AsyncState;
+
+            if (!stateObject.sSocket.Connected)
+            {
+                //server Diconnected
+                HandleDisconnected();
+                return;
+            }
+
+            int bytesReceived;
+            try
+            {
+                bytesReceived = stateObject.sSocket.EndReceive(ar);
+            }
+            catch (SocketException e)
+            {
+                if (e != null)
+                {
+                    if (e.Message != null)
+                        System.Diagnostics.Debug.WriteLine(e.Message);
+                    if (e.StackTrace != null)
+                        System.Diagnostics.Debug.WriteLine(e.StackTrace);
+                }
+
+                //server Diconnected
+                HandleDisconnected();
+                return;
+            }
+
+            if (bytesReceived == 0)
+            {
+                stateObject.sSocket.Disconnect(true);
+                HandleDisconnected();
+                return;
+            }
+
+            byte[] receivedBytes = new byte[bytesReceived];
+            Array.Copy(stateObject.sBuffer, 0, receivedBytes, 0, bytesReceived);
+
+            OnDataReceived?.Invoke(this, receivedBytes);
+
+            //continue receive
+            WaitForData(stateObject);
+        }
+
+        private void HandleDisconnected()
+        {
+            Close();
+        }
+    }
+
+    internal class StateObject
+    {
+        public byte[] sBuffer;
+        public Socket sSocket;
+
+        public StateObject(int bufferSize, Socket sock, int timeOutMilliSecond = -1)
+        {
+            sBuffer = new byte[bufferSize];
+            sSocket = sock;
+        }
+    }
+}

+ 19 - 19
AwInitilizer/Assist/WebClientTimeout.cs

@@ -1,19 +1,19 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AwInitilizer.Assist
-{
-    public class WebClientTimeout : WebClient
-    {
-        protected override WebRequest GetWebRequest(Uri uri)
-        {
-            WebRequest w = base.GetWebRequest(uri);
-            w.Timeout = 2 * 1000;
-            return w;
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Assist
+{
+    public class WebClientTimeout : WebClient
+    {
+        protected override WebRequest GetWebRequest(Uri uri)
+        {
+            WebRequest w = base.GetWebRequest(uri);
+            w.Timeout = 2 * 1000;
+            return w;
+        }
+    }
+}

+ 29 - 29
AwInitilizer/Converter/BooleanAndConverter.cs

@@ -1,29 +1,29 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Data;
-
-namespace AwInitilizer.Converter
-{
-    public class BooleanAndConverter : IMultiValueConverter
-    {
-        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
-        {
-            foreach (object value in values)
-            {
-                if ((value is bool) && (bool)value == false)
-                {
-                    return false;
-                }
-            }
-            return true;
-        }
-
-        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
-        {
-            throw new NotSupportedException("BooleanAndConverter is a OneWay converter.");
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace AwInitilizer.Converter
+{
+    public class BooleanAndConverter : IMultiValueConverter
+    {
+        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+        {
+            foreach (object value in values)
+            {
+                if ((value is bool) && (bool)value == false)
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
+        {
+            throw new NotSupportedException("BooleanAndConverter is a OneWay converter.");
+        }
+    }
+}

+ 24 - 24
AwInitilizer/Converter/PressStatusConverter.cs

@@ -1,24 +1,24 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AwInitilizer.Converter
-{
-    public static class PressStatusConverter
-    {
-        public static string ToPressString(this int from)
-        {
-            if(from == 0)
-            {
-                return "Unpress";
-            }
-            else if (from == 1)
-            {
-                return "Press";
-            }
-            return "Unknown";
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Converter
+{
+    public static class PressStatusConverter
+    {
+        public static string ToPressString(this int from)
+        {
+            if(from == 0)
+            {
+                return "Unpress";
+            }
+            else if (from == 1)
+            {
+                return "Press";
+            }
+            return "Unknown";
+        }
+    }
+}

+ 13 - 13
AwInitilizer/Interface/IIogger.cs

@@ -1,13 +1,13 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AwInitilizer.Interface
-{
-    public interface IIogger
-    {
-        void Print(string msg,bool isError = false);
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Interface
+{
+    public interface IIogger
+    {
+        void Print(string msg,bool isError = false);
+    }
+}

+ 26 - 26
AwInitilizer/Interface/ISerialPort.cs

@@ -1,26 +1,26 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AwInitilizer.Interface
-{
-    public enum ConnectStatus
-    {
-        Cleared, Connecting, Connected, DisConnected, ConnectionFail
-    }
-
-    public interface ISerialPort : INotifyPropertyChanged
-    {
-        ConnectStatus ConnectStatus { get; }
-
-        void Open();
-        Task OpenAsync();
-        void Close();
-
-        void WriteData(byte[] msg);
-        event EventHandler<byte[]> OnDataReceived;
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Interface
+{
+    public enum ConnectStatus
+    {
+        Cleared, Connecting, Connected, DisConnected, ConnectionFail
+    }
+
+    public interface ISerialPort : INotifyPropertyChanged
+    {
+        ConnectStatus ConnectStatus { get; }
+
+        void Open();
+        Task OpenAsync();
+        void Close();
+
+        void WriteData(byte[] msg);
+        event EventHandler<byte[]> OnDataReceived;
+    }
+}

+ 122 - 122
AwInitilizer/KeyinListener.cs

@@ -1,122 +1,122 @@
-using AwInitilizer.Model;
-using PhihongEv.Lib;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Input;
-using System.Windows.Threading;
-
-namespace AwInitilizer
-{
-    public class KeyinListener
-    {
-        public event EventHandler<SystemID> OnSystemIDReseived;
-
-        private string stackedInput = string.Empty;
-        private bool shiftPressed = false;
-        private DispatcherTimer CleanInputTimer;
-
-        private Window sourceWindow;
-
-        public KeyinListener(Window sourceWindow)
-        {
-            this.sourceWindow = sourceWindow;
-            sourceWindow.Closing += SourceWindow_Closing;
-            sourceWindow.PreviewKeyDown += MainWindow_PreviewKeyDown;
-            sourceWindow.PreviewKeyUp += MainWindow_PreviewKeyUp;
-
-            CleanInputTimer = new DispatcherTimer();
-            CleanInputTimer.Interval = TimeSpan.FromSeconds(1);
-            CleanInputTimer.Tick += CleanInputTimer_Tick;
-        }
-
-        private void MainWindow_PreviewKeyDown(object sender, KeyEventArgs e)
-        {
-            if (e.Key == Key.LeftShift || e.Key == Key.RightShift)
-            {
-                shiftPressed = true;
-                return;
-            }
-            else if (e.Key == Key.Capital)
-            {
-                shiftPressed = !shiftPressed;
-                return;
-            }
-            else if (e.Key == Key.Enter)
-            {
-                e.Handled = true;
-                return;
-            }
-            else
-            {
-                if (e.Key >= Key.D0 && e.Key <= Key.D9)
-                {
-                    // Number keys pressed so need to so special processing
-                    // also check if shift pressed
-                    var input = e.Key.ToString();
-                    input = input.Remove(0, 1);
-                    stackedInput += input;
-                }
-                else if (e.Key == Key.OemMinus)
-                {
-                    stackedInput += "-";
-                }
-                else if (e.Key == Key.Return)
-                {
-                    return;
-                }
-                else
-                {
-                    var input = e.Key.ToString();
-                    if (shiftPressed)
-                        input = input.ToUpper();
-                    stackedInput += input;
-                }
-            }
-
-            CleanInputTimer.Stop();
-            CleanInputTimer.Start();
-        }
-
-        private void MainWindow_PreviewKeyUp(object sender, KeyEventArgs e)
-        {
-            if (e.Key == Key.LeftShift || e.Key == Key.RightShift)
-            {
-                shiftPressed = false;
-            }
-        }
-
-        private void CleanInputTimer_Tick(object sender, EventArgs e)
-        {
-            CleanInputTimer.Stop();
-
-            if (SystemID.TryLooseParse(stackedInput, out SystemID systemID))
-            {
-                OnSystemIDReseived?.Invoke(this, systemID);
-                //SystemIDScanReseived(systemID);
-            }
-
-            stackedInput = string.Empty;
-        }
-
-        private void SourceWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
-        {
-            try
-            {
-                sourceWindow.Closing -= SourceWindow_Closing;
-                sourceWindow.PreviewKeyDown -= MainWindow_PreviewKeyDown;
-                sourceWindow.PreviewKeyUp -= MainWindow_PreviewKeyUp;
-
-                CleanInputTimer.Tick -= CleanInputTimer_Tick;
-                CleanInputTimer.Stop();
-            }
-            catch
-            {
-
-            }
-        }
-    }
-}
+using AwInitilizer.Model;
+using PhihongEv.Lib;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Input;
+using System.Windows.Threading;
+
+namespace AwInitilizer
+{
+    public class KeyinListener
+    {
+        public event EventHandler<SystemID> OnSystemIDReseived;
+
+        private string stackedInput = string.Empty;
+        private bool shiftPressed = false;
+        private DispatcherTimer CleanInputTimer;
+
+        private Window sourceWindow;
+
+        public KeyinListener(Window sourceWindow)
+        {
+            this.sourceWindow = sourceWindow;
+            sourceWindow.Closing += SourceWindow_Closing;
+            sourceWindow.PreviewKeyDown += MainWindow_PreviewKeyDown;
+            sourceWindow.PreviewKeyUp += MainWindow_PreviewKeyUp;
+
+            CleanInputTimer = new DispatcherTimer();
+            CleanInputTimer.Interval = TimeSpan.FromSeconds(1);
+            CleanInputTimer.Tick += CleanInputTimer_Tick;
+        }
+
+        private void MainWindow_PreviewKeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.LeftShift || e.Key == Key.RightShift)
+            {
+                shiftPressed = true;
+                return;
+            }
+            else if (e.Key == Key.Capital)
+            {
+                shiftPressed = !shiftPressed;
+                return;
+            }
+            else if (e.Key == Key.Enter)
+            {
+                e.Handled = true;
+                return;
+            }
+            else
+            {
+                if (e.Key >= Key.D0 && e.Key <= Key.D9)
+                {
+                    // Number keys pressed so need to so special processing
+                    // also check if shift pressed
+                    var input = e.Key.ToString();
+                    input = input.Remove(0, 1);
+                    stackedInput += input;
+                }
+                else if (e.Key == Key.OemMinus)
+                {
+                    stackedInput += "-";
+                }
+                else if (e.Key == Key.Return)
+                {
+                    return;
+                }
+                else
+                {
+                    var input = e.Key.ToString();
+                    if (shiftPressed)
+                        input = input.ToUpper();
+                    stackedInput += input;
+                }
+            }
+
+            CleanInputTimer.Stop();
+            CleanInputTimer.Start();
+        }
+
+        private void MainWindow_PreviewKeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.LeftShift || e.Key == Key.RightShift)
+            {
+                shiftPressed = false;
+            }
+        }
+
+        private void CleanInputTimer_Tick(object sender, EventArgs e)
+        {
+            CleanInputTimer.Stop();
+
+            if (SystemID.TryLooseParse(stackedInput, out SystemID systemID))
+            {
+                OnSystemIDReseived?.Invoke(this, systemID);
+                //SystemIDScanReseived(systemID);
+            }
+
+            stackedInput = string.Empty;
+        }
+
+        private void SourceWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
+        {
+            try
+            {
+                sourceWindow.Closing -= SourceWindow_Closing;
+                sourceWindow.PreviewKeyDown -= MainWindow_PreviewKeyDown;
+                sourceWindow.PreviewKeyUp -= MainWindow_PreviewKeyUp;
+
+                CleanInputTimer.Tick -= CleanInputTimer_Tick;
+                CleanInputTimer.Stop();
+            }
+            catch
+            {
+
+            }
+        }
+    }
+}

+ 41 - 41
AwInitilizer/ManualSn.xaml

@@ -1,41 +1,41 @@
-<Window
-    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-    xmlns:local="clr-namespace:AwInitilizer"
-    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-    Title="ManualSn"
-    Width="600"
-    Height="150"
-    ResizeMode="NoResize"
-    Topmost="True"
-    WindowStartupLocation="CenterOwner"
-    WindowStyle="SingleBorderWindow"
-    mc:Ignorable="d"
-    x:Class="AwInitilizer.ManualSn">
-    <Grid>
-        <Grid.RowDefinitions>
-            <RowDefinition Height="*" />
-            <RowDefinition Height="auto" />
-        </Grid.RowDefinitions>
-        <Grid Grid.Row="0">
-            <TextBox
-                x:Name="uxSn"
-                Margin="20"
-                VerticalAlignment="Center" />
-        </Grid>
-        <Grid
-            x:Name="uxCancelContainer"
-            Grid.Row="1"
-            Height="40">
-            <Button
-                Width="100"
-                Height="30"
-                HorizontalAlignment="Center"
-                VerticalAlignment="Center"
-                Click="Button_Click">
-                <Label x:Name="uxBtnText" Content="Confirm" />
-            </Button>
-        </Grid>
-    </Grid>
-</Window>
+<Window
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:local="clr-namespace:AwInitilizer"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    Title="ManualSn"
+    Width="600"
+    Height="150"
+    ResizeMode="NoResize"
+    Topmost="True"
+    WindowStartupLocation="CenterOwner"
+    WindowStyle="SingleBorderWindow"
+    mc:Ignorable="d"
+    x:Class="AwInitilizer.ManualSn">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="*" />
+            <RowDefinition Height="auto" />
+        </Grid.RowDefinitions>
+        <Grid Grid.Row="0">
+            <TextBox
+                x:Name="uxSn"
+                Margin="20"
+                VerticalAlignment="Center" />
+        </Grid>
+        <Grid
+            x:Name="uxCancelContainer"
+            Grid.Row="1"
+            Height="40">
+            <Button
+                Width="100"
+                Height="30"
+                HorizontalAlignment="Center"
+                VerticalAlignment="Center"
+                Click="Button_Click">
+                <Label x:Name="uxBtnText" Content="Confirm" />
+            </Button>
+        </Grid>
+    </Grid>
+</Window>

+ 35 - 35
AwInitilizer/ManualSn.xaml.cs

@@ -1,35 +1,35 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-
-namespace AwInitilizer
-{
-    /// <summary>
-    /// ManualSn.xaml 的互動邏輯
-    /// </summary>
-    public partial class ManualSn : Window
-    {
-        public ManualSn()
-        {
-            InitializeComponent();
-        }
-
-        public string EnteredSn { get; private set; }
-
-        private void Button_Click(object sender, RoutedEventArgs e)
-        {
-            this.EnteredSn = uxSn.Text;
-            this.Close();
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace AwInitilizer
+{
+    /// <summary>
+    /// ManualSn.xaml 的互動邏輯
+    /// </summary>
+    public partial class ManualSn : Window
+    {
+        public ManualSn()
+        {
+            InitializeComponent();
+        }
+
+        public string EnteredSn { get; private set; }
+
+        private void Button_Click(object sender, RoutedEventArgs e)
+        {
+            this.EnteredSn = uxSn.Text;
+            this.Close();
+        }
+    }
+}

+ 15 - 15
AwInitilizer/Model/ButtonStatus.cs

@@ -1,15 +1,15 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AwInitilizer.Model
-{
-    public class ButtonStatus
-    {
-        public int Button1 { get; set; }
-        public int Button2 { get; set; }
-        public int EmergencyButton { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Model
+{
+    public class ButtonStatus
+    {
+        public int Button1 { get; set; }
+        public int Button2 { get; set; }
+        public int EmergencyButton { get; set; }
+    }
+}

+ 16 - 16
AwInitilizer/Model/EvseSerialResponseModel.cs

@@ -1,16 +1,16 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AwInitilizer.Model
-{
-    public class EvseSerialResponseModel
-    {
-        public byte Source { get; set; }
-        public byte Destination { get; set; }
-        public byte Command { get; set; }
-        public byte[] Parameter { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Model
+{
+    public class EvseSerialResponseModel
+    {
+        public byte Source { get; set; }
+        public byte Destination { get; set; }
+        public byte Command { get; set; }
+        public byte[] Parameter { get; set; }
+    }
+}

+ 15 - 15
AwInitilizer/Model/SimStatus.cs

@@ -1,15 +1,15 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AwInitilizer.Model
-{
-    public class SimStatus
-    {
-        public bool IsInstalled { get; set; }
-        public byte[] ICCID { get; set; }
-        public byte[] IMSI { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Model
+{
+    public class SimStatus
+    {
+        public bool IsInstalled { get; set; }
+        public byte[] ICCID { get; set; }
+        public byte[] IMSI { get; set; }
+    }
+}

+ 21 - 21
AwInitilizer/Model/UploadFile.cs

@@ -1,21 +1,21 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AwInitilizer.Model
-{
-    public class UploadFile
-    {
-        public UploadFile()
-        {
-            //ContentType = "application/octet-stream";
-        }
-        public string Name { get; set; }
-        public string Filename { get; set; }
-        //public string ContentType { get; set; }
-        public Stream Stream { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Model
+{
+    public class UploadFile
+    {
+        public UploadFile()
+        {
+            //ContentType = "application/octet-stream";
+        }
+        public string Name { get; set; }
+        public string Filename { get; set; }
+        //public string ContentType { get; set; }
+        public Stream Stream { get; set; }
+    }
+}

+ 4 - 4
AwInitilizer/Procedure/BasicInfoUpdateProcedure.cs

@@ -228,16 +228,16 @@ namespace AwInitilizer.Procedure.BasicInfoUpdate
                 }
                 LogWriter.Report(LogEvent.RtcRead, receivedDateTime?.ToString("yyyyMMddHHmmss"), isError: false);
                 LogWriter.Log("UTC Time update Success");
-            }
-
+            }
+
             for (var pollingCnt = 0; pollingCnt < 56; pollingCnt++)
             {
                 await Task.Delay(TimeSpan.FromSeconds(15));
                 var response = await ChekCsuBootCompelete();
                 if (response)
                     break;
-            }
-
+            }
+
             return true;
         }
     }

+ 6 - 6
AwInitilizer/Procedure/ProcedureBase.cs

@@ -67,13 +67,13 @@ namespace AwInitilizer.Procedure
         internal async Task<bool> CheckAndCreateSocket()
         {
             string ipAddress = null;
-            if (!string.IsNullOrEmpty(UpdateData.IpAddress))
-            {
-                ipAddress = UpdateData.IpAddress;
+            if (!string.IsNullOrEmpty(UpdateData.IpAddress))
+            {
+                ipAddress = UpdateData.IpAddress;
             }
-            else
-            {
-                ipAddress = ServerIpAddress;
+            else
+            {
+                ipAddress = ServerIpAddress;
             }
 
             TcpSerializer socketConnection = null;

+ 5 - 5
AwInitilizer/Procedure/RestarttoIdelProcedure.cs

@@ -66,11 +66,11 @@ namespace AwInitilizer.Procedure.RestarttoIdle
                 //LogWriter.Log("Waiting Factory reset complete...");
                 //Logger.Print("Waiting Factory reset complete...");
                 int retryCnt = 0;
-                do
-                {
-                    LogWriter.Log("Waiting Factory reset complete...");
-                    await Task.Delay(TimeSpan.FromMinutes(2));
-                    retryCnt++;
+                do
+                {
+                    LogWriter.Log("Waiting Factory reset complete...");
+                    await Task.Delay(TimeSpan.FromMinutes(2));
+                    retryCnt++;
                 }
                 while (!await CheckAllIdle() && retryCnt < 4);
                 

+ 3 - 3
AwInitilizer/Procedure/VersionLogProcedure.cs

@@ -84,9 +84,9 @@ namespace AwInitilizer.Procedure.VersionLog
 
             foreach (var infoPair in versionPair)
             {
-                if (string.IsNullOrEmpty(infoPair.Value))
-                {
-                    continue;
+                if (string.IsNullOrEmpty(infoPair.Value))
+                {
+                    continue;
                 }
 
                 if (!excludeHeaderList.Contains(infoPair.Key))

+ 93 - 93
AwInitilizer/ProcedureLog/LogWriter.cs

@@ -1,93 +1,93 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AwInitilizer.ProcedureLog
-{
-    public class LogWriter<T1,T2> where T1 : Procedure.ProcedureBase where T2 : Enum
-    {
-        public Dictionary<T2, string> ReportPair { get; set; }
-        public Dictionary<T2, string> LogPair { get; set; }
-
-        internal readonly T1 source;
-
-        public LogWriter(T1 source)
-        {
-            this.source = source;
-        }
-
-        public void Report(T2 logEvent, string data,bool isError = false)
-        {
-            string log = "";
-            log = CreateLogMessage(logEvent, data);
-
-            Log(log, isError);
-
-            if (ReportPair != null && ReportPair.ContainsKey(logEvent))
-            {
-                MesReport(ReportPair[logEvent], data, !isError);
-            }
-        }
-
-        public void Report(string logEvent, string data, bool isError = false)
-        {
-            string log = "";
-            log = string.Format("{0} {1}", logEvent, data);
-
-            Log(log, isError);
-
-            MesReport(logEvent, data, !isError);
-        }
-
-        public virtual void Log(string data, bool isError = false, bool isDebugLog = false)
-        {
-            WriteMyLog(data);
-            if (!isDebugLog)
-            {
-                WriteShortLog(data, isError);
-                WriteFormateLog(data);
-            }
-        }
-
-        private string CreateLogMessage(T2 logEvent, string data)
-        {
-            string log;
-            if (LogPair != null && LogPair.ContainsKey(logEvent))
-            {
-                log = string.Format(LogPair[logEvent], data);
-            }
-            else
-            {
-                log = string.Format("{0} {1}", Enum.GetName(typeof(T2), logEvent), data);
-            }
-
-            return log;
-        }
-
-        private void MesReport(string key,string value, bool isSuccess)
-        {
-            //source.MesLogData[key] = value;
-            source.MesLogData.Add(key,value,isSuccess);
-        }
-
-        private void WriteMyLog(string log)
-        {
-            source.InfoLog += string.Format("{0}\n", log);
-        }
-
-        private void WriteShortLog(string log, bool isError = false)
-        {
-            if (log.Length < 100)
-            {
-                Procedure.ProcedureBase.Logger.Print(log, isError);
-            }
-        }
-
-        private void WriteFormateLog(string log)
-        {
-            source.ReportLog.Add(log);
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.ProcedureLog
+{
+    public class LogWriter<T1,T2> where T1 : Procedure.ProcedureBase where T2 : Enum
+    {
+        public Dictionary<T2, string> ReportPair { get; set; }
+        public Dictionary<T2, string> LogPair { get; set; }
+
+        internal readonly T1 source;
+
+        public LogWriter(T1 source)
+        {
+            this.source = source;
+        }
+
+        public void Report(T2 logEvent, string data,bool isError = false)
+        {
+            string log = "";
+            log = CreateLogMessage(logEvent, data);
+
+            Log(log, isError);
+
+            if (ReportPair != null && ReportPair.ContainsKey(logEvent))
+            {
+                MesReport(ReportPair[logEvent], data, !isError);
+            }
+        }
+
+        public void Report(string logEvent, string data, bool isError = false)
+        {
+            string log = "";
+            log = string.Format("{0} {1}", logEvent, data);
+
+            Log(log, isError);
+
+            MesReport(logEvent, data, !isError);
+        }
+
+        public virtual void Log(string data, bool isError = false, bool isDebugLog = false)
+        {
+            WriteMyLog(data);
+            if (!isDebugLog)
+            {
+                WriteShortLog(data, isError);
+                WriteFormateLog(data);
+            }
+        }
+
+        private string CreateLogMessage(T2 logEvent, string data)
+        {
+            string log;
+            if (LogPair != null && LogPair.ContainsKey(logEvent))
+            {
+                log = string.Format(LogPair[logEvent], data);
+            }
+            else
+            {
+                log = string.Format("{0} {1}", Enum.GetName(typeof(T2), logEvent), data);
+            }
+
+            return log;
+        }
+
+        private void MesReport(string key,string value, bool isSuccess)
+        {
+            //source.MesLogData[key] = value;
+            source.MesLogData.Add(key,value,isSuccess);
+        }
+
+        private void WriteMyLog(string log)
+        {
+            source.InfoLog += string.Format("{0}\n", log);
+        }
+
+        private void WriteShortLog(string log, bool isError = false)
+        {
+            if (log.Length < 100)
+            {
+                Procedure.ProcedureBase.Logger.Print(log, isError);
+            }
+        }
+
+        private void WriteFormateLog(string log)
+        {
+            source.ReportLog.Add(log);
+        }
+    }
+}

+ 4 - 4
AwInitilizer/Properties/AssemblyInfo.cs

@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.13.1.0")]
-[assembly: AssemblyVersion("1.13.1.0")]
-[assembly: AssemblyFileVersion("1.13.1.0")]
-[assembly: AssemblyInformationalVersion("3a0b9b9")]
+// [assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyFileVersion("1.13.2.0")]
+[assembly: AssemblyInformationalVersion("e8c61f8")]

+ 26 - 26
AwInitilizer/Properties/Settings.Designer.cs

@@ -1,26 +1,26 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-//     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.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace AwInitilizer.Properties {
-    
-    
-    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.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;
-            }
-        }
-    }
-}
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     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.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace AwInitilizer.Properties {
+    
+    
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.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;
+            }
+        }
+    }
+}

+ 4 - 4
AwInitilizer/Properties/Settings.settings

@@ -1,5 +1,5 @@
-<?xml version='1.0' encoding='utf-8'?>
-<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
-  <Profiles />
-  <Settings />
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+  <Profiles />
+  <Settings />
 </SettingsFile>

+ 76 - 76
AwInitilizer/app.manifest

@@ -1,76 +1,76 @@
-<?xml version="1.0" encoding="utf-8"?>
-<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
-  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
-  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
-    <security>
-      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
-        <!-- UAC Manifest Options
-             If you want to change the Windows User Account Control level replace the 
-             requestedExecutionLevel node with one of the following.
-
-        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
-        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
-        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />
-
-            Specifying requestedExecutionLevel element will disable file and registry virtualization. 
-            Remove this element if your application requires this virtualization for backwards
-            compatibility.
-        -->
-        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
-      </requestedPrivileges>
-    </security>
-  </trustInfo>
-
-  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
-    <application>
-      <!-- A list of the Windows versions that this application has been tested on
-           and is designed to work with. Uncomment the appropriate elements
-           and Windows will automatically select the most compatible environment. -->
-
-      <!-- Windows Vista -->
-      <!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
-
-      <!-- Windows 7 -->
-      <!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
-
-      <!-- Windows 8 -->
-      <!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
-
-      <!-- Windows 8.1 -->
-      <!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
-
-      <!-- Windows 10 -->
-      <!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
-
-    </application>
-  </compatibility>
-
-  <!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
-       DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need 
-       to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should 
-       also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
-  <!--
-  <application xmlns="urn:schemas-microsoft-com:asm.v3">
-    <windowsSettings>
-      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
-    </windowsSettings>
-  </application>
-  -->
-
-  <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
-  <!--
-  <dependency>
-    <dependentAssembly>
-      <assemblyIdentity
-          type="win32"
-          name="Microsoft.Windows.Common-Controls"
-          version="6.0.0.0"
-          processorArchitecture="*"
-          publicKeyToken="6595b64144ccf1df"
-          language="*"
-        />
-    </dependentAssembly>
-  </dependency>
-  -->
-
-</assembly>
+<?xml version="1.0" encoding="utf-8"?>
+<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
+  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
+  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+    <security>
+      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
+        <!-- UAC Manifest Options
+             If you want to change the Windows User Account Control level replace the 
+             requestedExecutionLevel node with one of the following.
+
+        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
+        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
+        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />
+
+            Specifying requestedExecutionLevel element will disable file and registry virtualization. 
+            Remove this element if your application requires this virtualization for backwards
+            compatibility.
+        -->
+        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
+      </requestedPrivileges>
+    </security>
+  </trustInfo>
+
+  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+    <application>
+      <!-- A list of the Windows versions that this application has been tested on
+           and is designed to work with. Uncomment the appropriate elements
+           and Windows will automatically select the most compatible environment. -->
+
+      <!-- Windows Vista -->
+      <!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
+
+      <!-- Windows 7 -->
+      <!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
+
+      <!-- Windows 8 -->
+      <!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
+
+      <!-- Windows 8.1 -->
+      <!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
+
+      <!-- Windows 10 -->
+      <!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
+
+    </application>
+  </compatibility>
+
+  <!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
+       DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need 
+       to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should 
+       also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
+  <!--
+  <application xmlns="urn:schemas-microsoft-com:asm.v3">
+    <windowsSettings>
+      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
+    </windowsSettings>
+  </application>
+  -->
+
+  <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
+  <!--
+  <dependency>
+    <dependentAssembly>
+      <assemblyIdentity
+          type="win32"
+          name="Microsoft.Windows.Common-Controls"
+          version="6.0.0.0"
+          processorArchitecture="*"
+          publicKeyToken="6595b64144ccf1df"
+          language="*"
+        />
+    </dependentAssembly>
+  </dependency>
+  -->
+
+</assembly>

+ 4 - 4
AwInitlizerInstaller__Shinewave/DLL.INI

@@ -1,4 +1,4 @@
-[Server]
-IP=192.168.66.252
-SPARE_FLAG=,
-TerminalName=EV_L407_FW
+[Server]
+IP=192.168.66.252
+SPARE_FLAG=,
+TerminalName=EV_L407_FW

+ 4 - 4
AwInitlizerInstaller__Shinewave/config.ini

@@ -1,5 +1,5 @@
-{
-"FirmwareRoot":"./Firmware",
-"Language":"zh-chs",
-"MES":"shinewave",
+{
+"FirmwareRoot":"./Firmware",
+"Language":"zh-chs",
+"MES":"shinewave",
 }

+ 4 - 4
ConfigEditor/Properties/AssemblyInfo.cs

@@ -50,7 +50,7 @@ using System.Windows;
 //
 // 您可以指定所有的值,也可以使用 '*' 將組建和修訂編號
 // 設為預設,如下所示:
-// [assembly: AssemblyVersion("1.13.1.0")]
-[assembly: AssemblyVersion("1.13.1.0")]
-[assembly: AssemblyFileVersion("1.13.1.0")]
-[assembly: AssemblyInformationalVersion("3a0b9b9")]
+// [assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyFileVersion("1.13.2.0")]
+[assembly: AssemblyInformationalVersion("e8c61f8")]

+ 4 - 4
Editor/Properties/AssemblyInfo.cs

@@ -50,7 +50,7 @@ using System.Windows;
 //
 // 您可以指定所有的值,也可以使用 '*' 將組建和修訂編號
 // 設為預設,如下所示:
-// [assembly: AssemblyVersion("1.13.1.0")]
-[assembly: AssemblyVersion("1.13.1.0")]
-[assembly: AssemblyFileVersion("1.13.1.0")]
-[assembly: AssemblyInformationalVersion("3a0b9b9")]
+// [assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyFileVersion("1.13.2.0")]
+[assembly: AssemblyInformationalVersion("e8c61f8")]

+ 4 - 4
InitializerModel/Properties/AssemblyInfo.cs

@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
 //
 // 您可以指定所有的值,也可以使用 '*' 將組建和修訂編號
 // 設為預設,如下所示:
-// [assembly: AssemblyVersion("1.13.1.0")]
-[assembly: AssemblyVersion("1.13.1.0")]
-[assembly: AssemblyFileVersion("1.13.1.0")]
-[assembly: AssemblyInformationalVersion("3a0b9b9")]
+// [assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyFileVersion("1.13.2.0")]
+[assembly: AssemblyInformationalVersion("e8c61f8")]

+ 9 - 9
Initilizer/App.xaml

@@ -1,9 +1,9 @@
-<Application x:Class="Initilizer.App"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:local="clr-namespace:Initilizer"
-             StartupUri="MainWindow.xaml">
-    <Application.Resources>
-         
-    </Application.Resources>
-</Application>
+<Application x:Class="Initilizer.App"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:local="clr-namespace:Initilizer"
+             StartupUri="MainWindow.xaml">
+    <Application.Resources>
+         
+    </Application.Resources>
+</Application>

+ 17 - 17
Initilizer/App.xaml.cs

@@ -1,17 +1,17 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace Initilizer
-{
-    /// <summary>
-    /// Interaction logic for App.xaml
-    /// </summary>
-    public partial class App : Application
-    {
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Initilizer
+{
+    /// <summary>
+    /// Interaction logic for App.xaml
+    /// </summary>
+    public partial class App : Application
+    {
+    }
+}

+ 3 - 3
Initilizer/AssemblyInfo.cs

@@ -9,7 +9,7 @@
                                               // app, or any theme specific resource dictionaries)
 )]
 
-[assembly: AssemblyVersion("1.13.1.0")]
-[assembly: AssemblyFileVersion("1.13.1.0")]
-[assembly: AssemblyInformationalVersion("3a0b9b9")]
+[assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyFileVersion("1.13.2.0")]
+[assembly: AssemblyInformationalVersion("e8c61f8")]
 

+ 8 - 8
Initilizer/Initilizer.csproj

@@ -1,9 +1,9 @@
-<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
-
-  <PropertyGroup>
-    <OutputType>WinExe</OutputType>
-    <TargetFramework>netcoreapp3.1</TargetFramework>
-    <UseWPF>true</UseWPF>
-  </PropertyGroup>
-
+<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
+
+  <PropertyGroup>
+    <OutputType>WinExe</OutputType>
+    <TargetFramework>netcoreapp3.1</TargetFramework>
+    <UseWPF>true</UseWPF>
+  </PropertyGroup>
+
 </Project>

+ 12 - 12
Initilizer/MainWindow.xaml

@@ -1,12 +1,12 @@
-<Window x:Class="Initilizer.MainWindow"
-        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-        xmlns:local="clr-namespace:Initilizer"
-        mc:Ignorable="d"
-        Title="MainWindow" Height="450" Width="800">
-    <Grid>
-        <Label Content="Test"/>
-    </Grid>
-</Window>
+<Window x:Class="Initilizer.MainWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:Initilizer"
+        mc:Ignorable="d"
+        Title="MainWindow" Height="450" Width="800">
+    <Grid>
+        <Label Content="Test"/>
+    </Grid>
+</Window>

+ 28 - 28
Initilizer/MainWindow.xaml.cs

@@ -1,28 +1,28 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-
-namespace Initilizer
-{
-    /// <summary>
-    /// Interaction logic for MainWindow.xaml
-    /// </summary>
-    public partial class MainWindow : Window
-    {
-        public MainWindow()
-        {
-            InitializeComponent();
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Initilizer
+{
+    /// <summary>
+    /// Interaction logic for MainWindow.xaml
+    /// </summary>
+    public partial class MainWindow : Window
+    {
+        public MainWindow()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 4 - 4
InitlizerInstaller_Sajet/config.ini

@@ -1,5 +1,5 @@
-{
-"FirmwareRoot":"./Firmware",
-"Language":"en-US",
-"MES":"sajet",
+{
+"FirmwareRoot":"./Firmware",
+"Language":"en-US",
+"MES":"sajet",
 }

+ 5 - 5
InitlizerInstaller_Sajet2/config.ini

@@ -1,6 +1,6 @@
-{
-"FirmwareRoot":"./Firmware",
-"Language":"en-US",
-"MES":"sajet2",
-"MechineCode":"ATC_TEST01"
+{
+"FirmwareRoot":"./Firmware",
+"Language":"en-US",
+"MES":"sajet2",
+"MechineCode":"ATC_TEST01"
 }

+ 22 - 22
MesAdaptor/ISajetConnect.cs

@@ -1,22 +1,22 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace MesAdaptor
-{
-    public interface ISajetConnect
-    {
-        bool SajetTransStart();
-        bool SajetTransClose();
-        bool SajetTransSignIn(ref string data);
-        bool SajetTransWoCheck(ref string workOrder);
-        bool SajetTransSnCheck(ref string serialNumber);
-        bool SajetTranFinishSuccess();
-        bool SajetTranFinishFail(MesErrorCode errorCode);
-        string SajetTransRegisterHeader(string model, string header);
-        bool SajetTransReport(ValueReportDatas reportPair);
-        bool SajetTransLog(string data);
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MesAdaptor
+{
+    public interface ISajetConnect
+    {
+        bool SajetTransStart();
+        bool SajetTransClose();
+        bool SajetTransSignIn(ref string data);
+        bool SajetTransWoCheck(ref string workOrder);
+        bool SajetTransSnCheck(ref string serialNumber);
+        bool SajetTranFinishSuccess();
+        bool SajetTranFinishFail(MesErrorCode errorCode);
+        string SajetTransRegisterHeader(string model, string header);
+        bool SajetTransReport(ValueReportDatas reportPair);
+        bool SajetTransLog(string data);
+    }
+}

+ 64 - 64
MesAdaptor/MesAdaptor.csproj

@@ -1,65 +1,65 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{6B69CF23-270B-429B-A21D-AD98C2DFF678}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>MesAdaptor</RootNamespace>
-    <AssemblyName>MesAdaptor</AssemblyName>
-    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <Deterministic>true</Deterministic>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="PhihongEv.Lib, Version=1.0.12.0, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\PhihongEv.Lib.1.0.12\lib\net40\PhihongEv.Lib.dll</HintPath>
-    </Reference>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Net.Http" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="ISajetConnect.cs" />
-    <Compile Include="MesErrorCode.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="SajectConnectSajet2.cs" />
-    <Compile Include="SajectConnectSajet.cs" />
-    <Compile Include="SajectConnectTest.cs" />
-    <Compile Include="SajetConnect.cs" />
-    <Compile Include="SajetConnectAdapter.cs" />
-    <Compile Include="SajetConnectShinewave.cs" />
-    <Compile Include="ValueReportData.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="packages.config" />
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <PropertyGroup>
-    <PreBuildEvent>GitVersion.exe $(SolutionDir) /updateassemblyinfo</PreBuildEvent>
-  </PropertyGroup>
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{6B69CF23-270B-429B-A21D-AD98C2DFF678}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>MesAdaptor</RootNamespace>
+    <AssemblyName>MesAdaptor</AssemblyName>
+    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="PhihongEv.Lib, Version=1.0.12.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\PhihongEv.Lib.1.0.12\lib\net40\PhihongEv.Lib.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="ISajetConnect.cs" />
+    <Compile Include="MesErrorCode.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="SajectConnectSajet2.cs" />
+    <Compile Include="SajectConnectSajet.cs" />
+    <Compile Include="SajectConnectTest.cs" />
+    <Compile Include="SajetConnect.cs" />
+    <Compile Include="SajetConnectAdapter.cs" />
+    <Compile Include="SajetConnectShinewave.cs" />
+    <Compile Include="ValueReportData.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PreBuildEvent>GitVersion.exe $(SolutionDir) /updateassemblyinfo</PreBuildEvent>
+  </PropertyGroup>
 </Project>

+ 29 - 29
MesAdaptor/MesErrorCode.cs

@@ -1,29 +1,29 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace MesAdaptor
-{
-    public enum MesErrorCode
-    {
-        None,
-        ChargerConnectFail,
-        ModelNameUpadateFail,
-        SerilaNumberUpadateFail,
-        UtcDatetimeUpdateFail,
-        FourthGenModelVersionMismatch,
-        FourthGenSimInstartionMismatch,
-        FourthGenSimInfoMismatch,
-        WifiModeNotClient,
-        WifiRssiLow,
-        FirmwareUploadFail,
-        FirmwareUpdateTimeout,
-        FirmwareVersionCheckFail,
-        EmergencyButtonTestFail,
-        GreenButtonTestFail,
-        BlueButtonTestFail,
-        FactoryResetFail,
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MesAdaptor
+{
+    public enum MesErrorCode
+    {
+        None,
+        ChargerConnectFail,
+        ModelNameUpadateFail,
+        SerilaNumberUpadateFail,
+        UtcDatetimeUpdateFail,
+        FourthGenModelVersionMismatch,
+        FourthGenSimInstartionMismatch,
+        FourthGenSimInfoMismatch,
+        WifiModeNotClient,
+        WifiRssiLow,
+        FirmwareUploadFail,
+        FirmwareUpdateTimeout,
+        FirmwareVersionCheckFail,
+        EmergencyButtonTestFail,
+        GreenButtonTestFail,
+        BlueButtonTestFail,
+        FactoryResetFail,
+    }
+}

+ 4 - 4
MesAdaptor/Properties/AssemblyInfo.cs

@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.13.1.0")]
-[assembly: AssemblyVersion("1.13.1.0")]
-[assembly: AssemblyFileVersion("1.13.1.0")]
-[assembly: AssemblyInformationalVersion("3a0b9b9")]
+// [assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyFileVersion("1.13.2.0")]
+[assembly: AssemblyInformationalVersion("e8c61f8")]

+ 275 - 275
MesAdaptor/SajectConnectSajet.cs

@@ -1,275 +1,275 @@
-using PhihongEv.Lib;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace MesAdaptor
-{
-    public class SajectConnectSajet : ISajetConnect
-    {
-        private enum CMD
-        {
-            Signin = 1,
-            SnCheck = 2,
-            WoCheck = -1,
-            Report = 3,
-            Log = 4,
-            HeaderRegister = 8,
-            ValueReport = 5,
-            StringValueReport = 6,
-        }
-
-        public bool SajetTransStart() => SajetConnectAdapter.SajetTransStart();
-        public bool SajetTransClose() => SajetConnectAdapter.SajetTransClose();
-
-        private string userId = "";
-        public bool SajetTransSignIn(ref string data)
-        {
-            var attemptId = data;
-            if (SajetTransData(CMD.Signin, ref data))
-            {
-                if (string.IsNullOrEmpty(data) || data.StartsWith("NG"))
-                {
-                    userId = "";
-                    return false;
-                }
-                else
-                {
-                    userId = attemptId;
-                    return true;
-                }
-            }
-            userId = "";
-            return false;
-        }
-
-        private string WorkOrder = "";
-        public bool SajetTransWoCheck(ref string workOrder)
-        {
-            return true;
-        }
-
-        private string SN;
-        public bool SajetTransSnCheck(ref string serialNumber)
-        {
-            var attemptSN = serialNumber;
-            var msg = serialNumber;
-
-            if (SajetTransData(CMD.SnCheck, ref msg))
-            {
-                if (string.IsNullOrEmpty(msg) || msg.StartsWith("NG"))
-                {
-                    SN = "";
-                    return false;
-                }
-                else
-                {
-                    SN = attemptSN;
-                    return true;
-                }
-            }
-            SN = "";
-            return false;
-        }
-
-        public bool SajetTranFinishSuccess()
-        {
-            if (string.IsNullOrEmpty(userId))
-                return false;
-            if (string.IsNullOrEmpty(SN))
-                return false;
-            string msg = userId + ";" + SN + ";";
-
-            if (string.IsNullOrEmpty(msg))
-                return false;
-
-            msg += "OK";
-
-#if DEBUG
-            return true;
-#endif
-
-            return SajetTransData(CMD.Report, ref msg);
-        }
-
-        public bool SajetTranFinishFail(MesErrorCode errorCode)
-        {
-            if (string.IsNullOrEmpty(userId))
-                return false;
-            if (string.IsNullOrEmpty(SN))
-                return false;
-            string msg = userId + ";" + SN + ";";
-
-            if (string.IsNullOrEmpty(msg))
-                return false;
-
-            msg += $"NG;{errorCode};";  //E114
-
-#if DEBUG
-            return true;
-#endif
-
-            return SajetTransData(CMD.Report, ref msg);
-        }
-
-        public string SajetTransRegisterHeader(string model, string header)
-        {
-            if (string.IsNullOrEmpty(userId))
-                return "";
-            var msg = userId + ";";
-            msg += model + ";" + header;
-            if (SajetTransData(CMD.HeaderRegister, ref msg))
-            {
-                if (msg.StartsWith("OK"))
-                {
-                    //get codename
-                    msg = msg.Substring(3);
-                    var spaceIndex = msg.IndexOf(";");
-                    if (spaceIndex > 0)
-                    {
-                        msg = msg.Substring(0, spaceIndex);
-                    }
-                    return msg;
-                }
-                return null;
-            }
-            return null;
-        }
-
-        public bool SajetTransReport(ValueReportDatas reportPair)
-        {
-            //build header
-            Dictionary<string, int> valuePairs = new Dictionary<string, int>();
-            foreach (var data in reportPair)
-            {
-                if (int.TryParse(data.Val, out int val))
-                {
-                    valuePairs.Add(data.Key, val);
-                }
-                else if (data.Val.ToLower().Contains("fail"))
-                {
-                    valuePairs.Add(data.Key, 0);
-                }
-                else if (data.Val.ToLower().Contains("success"))
-                {
-                    valuePairs.Add(data.Key, 1);
-                }
-                else
-                {
-                    valuePairs.Add(string.Format("{0}:{1}", data.Key, data.Val), 1);
-                }
-            }
-            //register Header
-            var codePair = new Dictionary<string, string>();
-
-            string model = "";
-            if (SystemID.TryParse(SN,out var systemID))
-            {
-                model = systemID.ModelName.ToString();
-            }
-
-            foreach (var key in valuePairs.Keys)
-            {
-                var code = SajetTransRegisterHeader(model, key);
-                if (string.IsNullOrEmpty(code))
-                    continue;
-                codePair.Add(key, code);
-            }
-            //report value
-            var reportResult = SajetTransReport(valuePairs, codePair);
-            return reportResult;
-        }
-
-        public bool SajetTransReport(Dictionary<string, int> resultPair, Dictionary<string, string> codePair)
-        {
-            if (string.IsNullOrEmpty(userId))
-                return false;
-            if (string.IsNullOrEmpty(SN))
-                return false;
-            string msgHeader = userId + ";" + SN;
-            string msg = "";
-
-            foreach (var result in resultPair)
-            {
-                if (codePair.Keys.Contains(result.Key))
-                {
-                    msg = string.Format("{0};{1}:{2};",msgHeader, codePair[result.Key], string.Format("{0}.00", result.Value));
-                    //msg += string.Format(";{0}:{1}", codePair[result.Key], string.Format("{0}.00", result.Value));
-                }
-                //msg += ";";
-                SajetTransData(CMD.ValueReport, ref msg);
-                //msg = userId + ";" + SN;
-            }
-            //msg += ";";
-            return true;
-        }
-
-        public bool SajetTransReport(Dictionary<string, string> resultPair, Dictionary<string, string> codePair)
-        {
-            if (string.IsNullOrEmpty(userId))
-                return false;
-            if (string.IsNullOrEmpty(SN))
-                return false;
-            string msg = userId + ";" + SN;
-            foreach (var result in resultPair)
-            {
-                if (codePair.Keys.Contains(result.Key))
-                {
-                    msg += string.Format(";{0}:{1}", codePair[result.Key], string.Format("{0}.00", result.Value));
-                }
-                msg += ";";
-                SajetTransData(CMD.StringValueReport, ref msg);
-                msg = userId + ";" + SN;
-            }
-            msg += ";";
-            return true;
-        }
-
-        public bool SajetTransLog(string data)
-        {
-            return true;
-
-            if (string.IsNullOrEmpty(userId))
-                return false;
-            if (string.IsNullOrEmpty(SN))
-                return false;
-            string prefix = userId + ";" + SN + ";";
-            while (data.Length > 0)
-            {
-                var msg = prefix;
-                int sendLength = Math.Min(250 - msg.Length, data.Length);
-                var sendString = data.Substring(0, sendLength);
-                msg += sendString;
-                if (!SajetTransData(CMD.Log, ref msg))
-                {
-                    break;
-                }
-                data = data.Substring(sendLength);
-            }
-            return data.Length == 0;
-        }
-
-        private bool SajetTransData(CMD command, ref string data)
-        {
-            return SajetConnectAdapter.SajetTransData((int)command, ref data);
-        }
-
-        private string GetSendPrefix()
-        {
-            string msg = "";
-            if (string.IsNullOrEmpty(userId))
-            {
-                return null;
-            }
-            msg = userId + ";";
-            if (string.IsNullOrEmpty(WorkOrder))
-            {
-                return null;
-            }
-            msg += WorkOrder + ";";
-            return msg;
-        }
-    }
-}
+using PhihongEv.Lib;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MesAdaptor
+{
+    public class SajectConnectSajet : ISajetConnect
+    {
+        private enum CMD
+        {
+            Signin = 1,
+            SnCheck = 2,
+            WoCheck = -1,
+            Report = 3,
+            Log = 4,
+            HeaderRegister = 8,
+            ValueReport = 5,
+            StringValueReport = 6,
+        }
+
+        public bool SajetTransStart() => SajetConnectAdapter.SajetTransStart();
+        public bool SajetTransClose() => SajetConnectAdapter.SajetTransClose();
+
+        private string userId = "";
+        public bool SajetTransSignIn(ref string data)
+        {
+            var attemptId = data;
+            if (SajetTransData(CMD.Signin, ref data))
+            {
+                if (string.IsNullOrEmpty(data) || data.StartsWith("NG"))
+                {
+                    userId = "";
+                    return false;
+                }
+                else
+                {
+                    userId = attemptId;
+                    return true;
+                }
+            }
+            userId = "";
+            return false;
+        }
+
+        private string WorkOrder = "";
+        public bool SajetTransWoCheck(ref string workOrder)
+        {
+            return true;
+        }
+
+        private string SN;
+        public bool SajetTransSnCheck(ref string serialNumber)
+        {
+            var attemptSN = serialNumber;
+            var msg = serialNumber;
+
+            if (SajetTransData(CMD.SnCheck, ref msg))
+            {
+                if (string.IsNullOrEmpty(msg) || msg.StartsWith("NG"))
+                {
+                    SN = "";
+                    return false;
+                }
+                else
+                {
+                    SN = attemptSN;
+                    return true;
+                }
+            }
+            SN = "";
+            return false;
+        }
+
+        public bool SajetTranFinishSuccess()
+        {
+            if (string.IsNullOrEmpty(userId))
+                return false;
+            if (string.IsNullOrEmpty(SN))
+                return false;
+            string msg = userId + ";" + SN + ";";
+
+            if (string.IsNullOrEmpty(msg))
+                return false;
+
+            msg += "OK";
+
+#if DEBUG
+            return true;
+#endif
+
+            return SajetTransData(CMD.Report, ref msg);
+        }
+
+        public bool SajetTranFinishFail(MesErrorCode errorCode)
+        {
+            if (string.IsNullOrEmpty(userId))
+                return false;
+            if (string.IsNullOrEmpty(SN))
+                return false;
+            string msg = userId + ";" + SN + ";";
+
+            if (string.IsNullOrEmpty(msg))
+                return false;
+
+            msg += $"NG;{errorCode};";  //E114
+
+#if DEBUG
+            return true;
+#endif
+
+            return SajetTransData(CMD.Report, ref msg);
+        }
+
+        public string SajetTransRegisterHeader(string model, string header)
+        {
+            if (string.IsNullOrEmpty(userId))
+                return "";
+            var msg = userId + ";";
+            msg += model + ";" + header;
+            if (SajetTransData(CMD.HeaderRegister, ref msg))
+            {
+                if (msg.StartsWith("OK"))
+                {
+                    //get codename
+                    msg = msg.Substring(3);
+                    var spaceIndex = msg.IndexOf(";");
+                    if (spaceIndex > 0)
+                    {
+                        msg = msg.Substring(0, spaceIndex);
+                    }
+                    return msg;
+                }
+                return null;
+            }
+            return null;
+        }
+
+        public bool SajetTransReport(ValueReportDatas reportPair)
+        {
+            //build header
+            Dictionary<string, int> valuePairs = new Dictionary<string, int>();
+            foreach (var data in reportPair)
+            {
+                if (int.TryParse(data.Val, out int val))
+                {
+                    valuePairs.Add(data.Key, val);
+                }
+                else if (data.Val.ToLower().Contains("fail"))
+                {
+                    valuePairs.Add(data.Key, 0);
+                }
+                else if (data.Val.ToLower().Contains("success"))
+                {
+                    valuePairs.Add(data.Key, 1);
+                }
+                else
+                {
+                    valuePairs.Add(string.Format("{0}:{1}", data.Key, data.Val), 1);
+                }
+            }
+            //register Header
+            var codePair = new Dictionary<string, string>();
+
+            string model = "";
+            if (SystemID.TryParse(SN,out var systemID))
+            {
+                model = systemID.ModelName.ToString();
+            }
+
+            foreach (var key in valuePairs.Keys)
+            {
+                var code = SajetTransRegisterHeader(model, key);
+                if (string.IsNullOrEmpty(code))
+                    continue;
+                codePair.Add(key, code);
+            }
+            //report value
+            var reportResult = SajetTransReport(valuePairs, codePair);
+            return reportResult;
+        }
+
+        public bool SajetTransReport(Dictionary<string, int> resultPair, Dictionary<string, string> codePair)
+        {
+            if (string.IsNullOrEmpty(userId))
+                return false;
+            if (string.IsNullOrEmpty(SN))
+                return false;
+            string msgHeader = userId + ";" + SN;
+            string msg = "";
+
+            foreach (var result in resultPair)
+            {
+                if (codePair.Keys.Contains(result.Key))
+                {
+                    msg = string.Format("{0};{1}:{2};",msgHeader, codePair[result.Key], string.Format("{0}.00", result.Value));
+                    //msg += string.Format(";{0}:{1}", codePair[result.Key], string.Format("{0}.00", result.Value));
+                }
+                //msg += ";";
+                SajetTransData(CMD.ValueReport, ref msg);
+                //msg = userId + ";" + SN;
+            }
+            //msg += ";";
+            return true;
+        }
+
+        public bool SajetTransReport(Dictionary<string, string> resultPair, Dictionary<string, string> codePair)
+        {
+            if (string.IsNullOrEmpty(userId))
+                return false;
+            if (string.IsNullOrEmpty(SN))
+                return false;
+            string msg = userId + ";" + SN;
+            foreach (var result in resultPair)
+            {
+                if (codePair.Keys.Contains(result.Key))
+                {
+                    msg += string.Format(";{0}:{1}", codePair[result.Key], string.Format("{0}.00", result.Value));
+                }
+                msg += ";";
+                SajetTransData(CMD.StringValueReport, ref msg);
+                msg = userId + ";" + SN;
+            }
+            msg += ";";
+            return true;
+        }
+
+        public bool SajetTransLog(string data)
+        {
+            return true;
+
+            if (string.IsNullOrEmpty(userId))
+                return false;
+            if (string.IsNullOrEmpty(SN))
+                return false;
+            string prefix = userId + ";" + SN + ";";
+            while (data.Length > 0)
+            {
+                var msg = prefix;
+                int sendLength = Math.Min(250 - msg.Length, data.Length);
+                var sendString = data.Substring(0, sendLength);
+                msg += sendString;
+                if (!SajetTransData(CMD.Log, ref msg))
+                {
+                    break;
+                }
+                data = data.Substring(sendLength);
+            }
+            return data.Length == 0;
+        }
+
+        private bool SajetTransData(CMD command, ref string data)
+        {
+            return SajetConnectAdapter.SajetTransData((int)command, ref data);
+        }
+
+        private string GetSendPrefix()
+        {
+            string msg = "";
+            if (string.IsNullOrEmpty(userId))
+            {
+                return null;
+            }
+            msg = userId + ";";
+            if (string.IsNullOrEmpty(WorkOrder))
+            {
+                return null;
+            }
+            msg += WorkOrder + ";";
+            return msg;
+        }
+    }
+}

+ 283 - 283
MesAdaptor/SajectConnectSajet2.cs

@@ -1,283 +1,283 @@
-using PhihongEv.Lib;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace MesAdaptor
-{
-    public class SajectConnectSajet2 : ISajetConnect
-    {
-        private enum CMD
-        {
-            Signin = 1,
-            SnCheck = 2,
-            Report = 3,
-            ValueReport = 4,
-        }
-
-        private readonly string _MechineCode;
-        public SajectConnectSajet2(string MechineCode)
-        {
-            if (string.IsNullOrEmpty(MechineCode))
-            {
-                throw new Exception("MechineCode cannot not be empty");
-            }
-
-            _MechineCode = MechineCode;
-        }
-
-        public bool SajetTransStart() => SajetConnectAdapter.SajetTransStart();
-        public bool SajetTransClose() => SajetConnectAdapter.SajetTransClose();
-
-        private string userId = "";
-        public bool SajetTransSignIn(ref string data)
-        {
-            var attemptId = data;
-            var msg = data + ";";
-            if (SajetTransData(CMD.Signin, ref data))
-            {
-                if (string.IsNullOrEmpty(data) || data.StartsWith("NG"))
-                {
-                    userId = "";
-                    return false;
-                }
-                else
-                {
-                    userId = attemptId;
-                    return true;
-                }
-            }
-            userId = "";
-            return false;
-        }
-
-        [Obsolete]
-        public bool SajetTransWoCheck(ref string workOrder)
-        {
-            return true;
-        }
-
-        private SystemID systemID;
-        public bool SajetTransSnCheck(ref string serialNumber)
-        {
-            if (!SystemID.TryLooseParse(serialNumber, out var id))
-            {
-                return false;
-            }
-
-            var msg = string.Format("{0};{1};;", id.ModelName.ToString(), id.ToString());
-
-            if (SajetTransData(CMD.SnCheck, ref msg))
-            {
-                if (string.IsNullOrEmpty(msg) || msg.StartsWith("NG"))
-                {
-                    systemID = null;
-                    return false;
-                }
-                systemID = id;
-                return true;
-            }
-            systemID = null;
-            return false;
-        }
-
-        //public bool SajetTransSnCheck(string partNO,string sn)
-        //{
-        //    var msg = string.Format("{0};{1};;", partNO, sn);
-
-        //    if (SajetTransData(CMD.SnCheck, ref msg))
-        //    {
-        //        if (string.IsNullOrEmpty(msg) || msg.StartsWith("NG"))
-        //        {
-        //            return false;
-        //        }
-        //        return true;
-        //    }
-        //    return false;
-        //}
-
-        public bool SajetTranFinishSuccess()
-        {
-            if (string.IsNullOrEmpty(userId))
-                return false;
-            if (systemID == null)
-                return false;
-            //string msg = userId + ";" + systemID.ToString() + ";";
-            string msg = string.Format("{0};{1};{2};{3}:0;", userId, _MechineCode, systemID.ModelName.ToString(), systemID.ToString());
-
-            if (string.IsNullOrEmpty(msg))
-                return false;
-
-            return SajetTransData(CMD.Report, ref msg);
-        }
-
-        //public bool SajetTranFinishSuccess(string partNO, string sn)
-        //{
-        //    if (string.IsNullOrEmpty(userId))
-        //        return false;
-        //    //string msg = userId + ";" + systemID.ToString() + ";";
-        //    string msg = string.Format("{0};{1};{2};{3}:0;", userId, _MechineCode, partNO, sn);
-
-        //    if (string.IsNullOrEmpty(msg))
-        //        return false;
-
-        //    return SajetTransData(CMD.Report, ref msg);
-        //}
-
-        public bool SajetTranFinishFail(MesErrorCode errorCode)
-        {
-            if (string.IsNullOrEmpty(userId))
-                return false;
-            if (systemID == null)
-                return false;
-            //string msg = userId + ";" + systemID.ToString() + ";";
-            string msg = string.Format("{0};{1};{2};{3}:1:", userId, _MechineCode, systemID.ModelName.ToString(), systemID.ToString());
-
-            if (string.IsNullOrEmpty(msg))
-                return false;
-
-            msg += $"{GetMesCodeString(errorCode)};";  //E114
-
-            return SajetTransData(CMD.Report, ref msg);
-        }
-
-        //public bool SajetTranFinishFail(string partNO, string sn, MesErrorCode errorCode)
-        //{
-        //    if (string.IsNullOrEmpty(userId))
-        //        return false;
-        //    //string msg = userId + ";" + systemID.ToString() + ";";
-        //    string msg = string.Format("{0};{1};{2};{3}:1:", userId, _MechineCode, partNO, sn);
-
-        //    if (string.IsNullOrEmpty(msg))
-        //        return false;
-
-        //    msg += $"{errorCode};";  //E114
-
-        //    return SajetTransData(CMD.Report, ref msg);
-        //}
-
-        [Obsolete]
-        public string SajetTransRegisterHeader(string model, string header)
-        {
-            return "";
-        }
-
-        public bool SajetTransReport(ValueReportDatas reportDatas)
-        {
-            if (string.IsNullOrEmpty(userId))
-                return false;
-            if (systemID == null)
-                return false;
-
-            var totalResult = true;
-
-            foreach (var data in reportDatas)
-            {
-                var key = data.Key;
-                var value = data.Val;
-                var isSuccess = data.IsSuccess;
-
-                value = value.Trim();
-                var det = isSuccess ? "0" : "1";
-
-                if (string.IsNullOrEmpty(value))
-                {
-                    value = "empty";
-                }
-                else if (value.ToLower() == "fail")
-                {
-                    value = "0";
-                }
-                else if (value.ToLower() == "success")
-                {
-                    value = "1";
-                }
-
-                var msg = string.Format("{0};{1};{2};{3};{4}:{5}:{6};", userId, _MechineCode, systemID.ModelName.ToString(), systemID.ToString(), key, value, det);
-                var result = SajetTransData(CMD.ValueReport, ref msg);
-                totalResult &= result;
-            }
-            return totalResult;
-        }
-
-        //public bool SajetTransReport(string partNO, string no, Dictionary<string, string> reportPair)
-        //{
-        //    if (string.IsNullOrEmpty(userId))
-        //        return false;
-
-        //    var totalResult = true;
-        //    foreach (var pair in reportPair)
-        //    {
-        //        var msg = string.Format("{0};{1};{2};{3};{4}:{5};", userId, _MechineCode, partNO, no, pair.Key, pair.Value);
-        //        var result = SajetTransData(CMD.ValueReport, ref msg);
-        //        totalResult &= result;
-        //    }
-        //    return totalResult;
-        //}
-
-        [Obsolete]
-        public bool SajetTransReport(Dictionary<string, int> resultPair, Dictionary<string, string> codePair)
-        {
-            return true;
-        }
-
-        [Obsolete]
-        public bool SajetTransReport(Dictionary<string, string> resultPair, Dictionary<string, string> codePair)
-        {
-            return true;
-        }
-
-        [Obsolete]
-        public bool SajetTransLog(string data)
-        {
-            return true;
-        }
-
-        private bool SajetTransData(CMD command, ref string data)
-        {
-            return SajetConnectAdapter.SajetTransData((int)command, ref data);
-        }
-
-        private string GetMesCodeString(MesErrorCode mesError)
-        {
-            switch (mesError)
-            {
-                case MesErrorCode.ChargerConnectFail:
-                    return "A081";
-                case MesErrorCode.ModelNameUpadateFail:
-                    return "A082";
-                case MesErrorCode.SerilaNumberUpadateFail:
-                    return "A083";
-                case MesErrorCode.UtcDatetimeUpdateFail:
-                    return "A084";
-                case MesErrorCode.FourthGenModelVersionMismatch:
-                    return "A085";
-                case MesErrorCode.FourthGenSimInstartionMismatch:
-                    return "A086";
-                case MesErrorCode.FourthGenSimInfoMismatch:
-                    return "A087";
-                case MesErrorCode.WifiModeNotClient:
-                    return "A088";
-                case MesErrorCode.WifiRssiLow:
-                    return "A089";
-                case MesErrorCode.FirmwareUploadFail:
-                    return "A090";
-                case MesErrorCode.FirmwareUpdateTimeout:
-                    return "A091";
-                case MesErrorCode.FirmwareVersionCheckFail:
-                    return "A092";
-                case MesErrorCode.EmergencyButtonTestFail:
-                    return "A093";
-                case MesErrorCode.GreenButtonTestFail:
-                    return "A094";
-                case MesErrorCode.BlueButtonTestFail:
-                    return "A095";
-                case MesErrorCode.FactoryResetFail:
-                    return "A096";
-            }
-            return "A081";
-        }
-    }
-}
+using PhihongEv.Lib;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MesAdaptor
+{
+    public class SajectConnectSajet2 : ISajetConnect
+    {
+        private enum CMD
+        {
+            Signin = 1,
+            SnCheck = 2,
+            Report = 3,
+            ValueReport = 4,
+        }
+
+        private readonly string _MechineCode;
+        public SajectConnectSajet2(string MechineCode)
+        {
+            if (string.IsNullOrEmpty(MechineCode))
+            {
+                throw new Exception("MechineCode cannot not be empty");
+            }
+
+            _MechineCode = MechineCode;
+        }
+
+        public bool SajetTransStart() => SajetConnectAdapter.SajetTransStart();
+        public bool SajetTransClose() => SajetConnectAdapter.SajetTransClose();
+
+        private string userId = "";
+        public bool SajetTransSignIn(ref string data)
+        {
+            var attemptId = data;
+            var msg = data + ";";
+            if (SajetTransData(CMD.Signin, ref data))
+            {
+                if (string.IsNullOrEmpty(data) || data.StartsWith("NG"))
+                {
+                    userId = "";
+                    return false;
+                }
+                else
+                {
+                    userId = attemptId;
+                    return true;
+                }
+            }
+            userId = "";
+            return false;
+        }
+
+        [Obsolete]
+        public bool SajetTransWoCheck(ref string workOrder)
+        {
+            return true;
+        }
+
+        private SystemID systemID;
+        public bool SajetTransSnCheck(ref string serialNumber)
+        {
+            if (!SystemID.TryLooseParse(serialNumber, out var id))
+            {
+                return false;
+            }
+
+            var msg = string.Format("{0};{1};;", id.ModelName.ToString(), id.ToString());
+
+            if (SajetTransData(CMD.SnCheck, ref msg))
+            {
+                if (string.IsNullOrEmpty(msg) || msg.StartsWith("NG"))
+                {
+                    systemID = null;
+                    return false;
+                }
+                systemID = id;
+                return true;
+            }
+            systemID = null;
+            return false;
+        }
+
+        //public bool SajetTransSnCheck(string partNO,string sn)
+        //{
+        //    var msg = string.Format("{0};{1};;", partNO, sn);
+
+        //    if (SajetTransData(CMD.SnCheck, ref msg))
+        //    {
+        //        if (string.IsNullOrEmpty(msg) || msg.StartsWith("NG"))
+        //        {
+        //            return false;
+        //        }
+        //        return true;
+        //    }
+        //    return false;
+        //}
+
+        public bool SajetTranFinishSuccess()
+        {
+            if (string.IsNullOrEmpty(userId))
+                return false;
+            if (systemID == null)
+                return false;
+            //string msg = userId + ";" + systemID.ToString() + ";";
+            string msg = string.Format("{0};{1};{2};{3}:0;", userId, _MechineCode, systemID.ModelName.ToString(), systemID.ToString());
+
+            if (string.IsNullOrEmpty(msg))
+                return false;
+
+            return SajetTransData(CMD.Report, ref msg);
+        }
+
+        //public bool SajetTranFinishSuccess(string partNO, string sn)
+        //{
+        //    if (string.IsNullOrEmpty(userId))
+        //        return false;
+        //    //string msg = userId + ";" + systemID.ToString() + ";";
+        //    string msg = string.Format("{0};{1};{2};{3}:0;", userId, _MechineCode, partNO, sn);
+
+        //    if (string.IsNullOrEmpty(msg))
+        //        return false;
+
+        //    return SajetTransData(CMD.Report, ref msg);
+        //}
+
+        public bool SajetTranFinishFail(MesErrorCode errorCode)
+        {
+            if (string.IsNullOrEmpty(userId))
+                return false;
+            if (systemID == null)
+                return false;
+            //string msg = userId + ";" + systemID.ToString() + ";";
+            string msg = string.Format("{0};{1};{2};{3}:1:", userId, _MechineCode, systemID.ModelName.ToString(), systemID.ToString());
+
+            if (string.IsNullOrEmpty(msg))
+                return false;
+
+            msg += $"{GetMesCodeString(errorCode)};";  //E114
+
+            return SajetTransData(CMD.Report, ref msg);
+        }
+
+        //public bool SajetTranFinishFail(string partNO, string sn, MesErrorCode errorCode)
+        //{
+        //    if (string.IsNullOrEmpty(userId))
+        //        return false;
+        //    //string msg = userId + ";" + systemID.ToString() + ";";
+        //    string msg = string.Format("{0};{1};{2};{3}:1:", userId, _MechineCode, partNO, sn);
+
+        //    if (string.IsNullOrEmpty(msg))
+        //        return false;
+
+        //    msg += $"{errorCode};";  //E114
+
+        //    return SajetTransData(CMD.Report, ref msg);
+        //}
+
+        [Obsolete]
+        public string SajetTransRegisterHeader(string model, string header)
+        {
+            return "";
+        }
+
+        public bool SajetTransReport(ValueReportDatas reportDatas)
+        {
+            if (string.IsNullOrEmpty(userId))
+                return false;
+            if (systemID == null)
+                return false;
+
+            var totalResult = true;
+
+            foreach (var data in reportDatas)
+            {
+                var key = data.Key;
+                var value = data.Val;
+                var isSuccess = data.IsSuccess;
+
+                value = value.Trim();
+                var det = isSuccess ? "0" : "1";
+
+                if (string.IsNullOrEmpty(value))
+                {
+                    value = "empty";
+                }
+                else if (value.ToLower() == "fail")
+                {
+                    value = "0";
+                }
+                else if (value.ToLower() == "success")
+                {
+                    value = "1";
+                }
+
+                var msg = string.Format("{0};{1};{2};{3};{4}:{5}:{6};", userId, _MechineCode, systemID.ModelName.ToString(), systemID.ToString(), key, value, det);
+                var result = SajetTransData(CMD.ValueReport, ref msg);
+                totalResult &= result;
+            }
+            return totalResult;
+        }
+
+        //public bool SajetTransReport(string partNO, string no, Dictionary<string, string> reportPair)
+        //{
+        //    if (string.IsNullOrEmpty(userId))
+        //        return false;
+
+        //    var totalResult = true;
+        //    foreach (var pair in reportPair)
+        //    {
+        //        var msg = string.Format("{0};{1};{2};{3};{4}:{5};", userId, _MechineCode, partNO, no, pair.Key, pair.Value);
+        //        var result = SajetTransData(CMD.ValueReport, ref msg);
+        //        totalResult &= result;
+        //    }
+        //    return totalResult;
+        //}
+
+        [Obsolete]
+        public bool SajetTransReport(Dictionary<string, int> resultPair, Dictionary<string, string> codePair)
+        {
+            return true;
+        }
+
+        [Obsolete]
+        public bool SajetTransReport(Dictionary<string, string> resultPair, Dictionary<string, string> codePair)
+        {
+            return true;
+        }
+
+        [Obsolete]
+        public bool SajetTransLog(string data)
+        {
+            return true;
+        }
+
+        private bool SajetTransData(CMD command, ref string data)
+        {
+            return SajetConnectAdapter.SajetTransData((int)command, ref data);
+        }
+
+        private string GetMesCodeString(MesErrorCode mesError)
+        {
+            switch (mesError)
+            {
+                case MesErrorCode.ChargerConnectFail:
+                    return "A081";
+                case MesErrorCode.ModelNameUpadateFail:
+                    return "A082";
+                case MesErrorCode.SerilaNumberUpadateFail:
+                    return "A083";
+                case MesErrorCode.UtcDatetimeUpdateFail:
+                    return "A084";
+                case MesErrorCode.FourthGenModelVersionMismatch:
+                    return "A085";
+                case MesErrorCode.FourthGenSimInstartionMismatch:
+                    return "A086";
+                case MesErrorCode.FourthGenSimInfoMismatch:
+                    return "A087";
+                case MesErrorCode.WifiModeNotClient:
+                    return "A088";
+                case MesErrorCode.WifiRssiLow:
+                    return "A089";
+                case MesErrorCode.FirmwareUploadFail:
+                    return "A090";
+                case MesErrorCode.FirmwareUpdateTimeout:
+                    return "A091";
+                case MesErrorCode.FirmwareVersionCheckFail:
+                    return "A092";
+                case MesErrorCode.EmergencyButtonTestFail:
+                    return "A093";
+                case MesErrorCode.GreenButtonTestFail:
+                    return "A094";
+                case MesErrorCode.BlueButtonTestFail:
+                    return "A095";
+                case MesErrorCode.FactoryResetFail:
+                    return "A096";
+            }
+            return "A081";
+        }
+    }
+}

+ 31 - 31
MesAdaptor/SajectConnectTest.cs

@@ -1,31 +1,31 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace MesAdaptor
-{
-    public class SajectConnectTest : ISajetConnect
-    {
-        public bool SajetTranFinishFail(MesErrorCode errorCode) => true;
-
-        public bool SajetTranFinishSuccess() => true;
-
-        public bool SajetTransClose() => true;
-
-        public bool SajetTransLog(string data) => true;
-
-        public string SajetTransRegisterHeader(string model, string header) => "";
-
-        public bool SajetTransReport(ValueReportDatas reportPair) => true;
-
-        public bool SajetTransSignIn(ref string data) => true;
-
-        public bool SajetTransSnCheck(ref string serialNumber) => true;
-
-        public bool SajetTransStart() => true;
-
-        public bool SajetTransWoCheck(ref string workOrder) => true;
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MesAdaptor
+{
+    public class SajectConnectTest : ISajetConnect
+    {
+        public bool SajetTranFinishFail(MesErrorCode errorCode) => true;
+
+        public bool SajetTranFinishSuccess() => true;
+
+        public bool SajetTransClose() => true;
+
+        public bool SajetTransLog(string data) => true;
+
+        public string SajetTransRegisterHeader(string model, string header) => "";
+
+        public bool SajetTransReport(ValueReportDatas reportPair) => true;
+
+        public bool SajetTransSignIn(ref string data) => true;
+
+        public bool SajetTransSnCheck(ref string serialNumber) => true;
+
+        public bool SajetTransStart() => true;
+
+        public bool SajetTransWoCheck(ref string workOrder) => true;
+    }
+}

+ 59 - 59
MesAdaptor/SajetConnectAdapter.cs

@@ -1,59 +1,59 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace MesAdaptor
-{
-    public static class SajetConnectAdapter
-    {
-        [DllImport("SajetConnect.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
-        public static extern bool SajetTransStart();
-
-        [DllImport("SajetConnect.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
-        public static extern bool SajetTransClose();
-
-        //[DllImport("SajetConnect.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
-        //public static extern bool SajetTransData(int command, IntPtr data, IntPtr length);
-
-        [DllImport("SajetConnect.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
-        public static extern bool SajetTransData(int command, IntPtr data, IntPtr length);
-
-        [DllImport("SajetConnect.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
-        public static extern bool SajetTransData_C(int command, out string data);
-
-        public static bool SajetTransData(int command, ref string data)
-        {
-            var idByte = Encoding.ASCII.GetBytes(data);
-            var length = idByte.Length;
-
-            var dataArrayLength = Math.Max(length, 200);
-            var dataArray = new byte[dataArrayLength];
-            Array.Copy(idByte, 0, dataArray, 0, length);
-
-            IntPtr dataIntPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(dataArrayLength);
-            System.Runtime.InteropServices.Marshal.Copy(dataArray, 0, dataIntPtr, dataArray.Length);
-
-            IntPtr lengthIntPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(10);
-            System.Runtime.InteropServices.Marshal.WriteInt32(lengthIntPtr, length);
-
-            var sendResult = SajetConnectAdapter.SajetTransData(command, dataIntPtr, lengthIntPtr);
-
-            var resultString1 = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(dataIntPtr);
-
-            System.Runtime.InteropServices.Marshal.Copy(dataIntPtr, dataArray, 0, dataArrayLength);
-            //System.Runtime.InteropServices.Marshal.Release(dataIntPtr);
-            System.Runtime.InteropServices.Marshal.FreeCoTaskMem(dataIntPtr);
-
-            var readLength = System.Runtime.InteropServices.Marshal.ReadInt32(lengthIntPtr);
-            //System.Runtime.InteropServices.Marshal.Release(lengthIntPtr);
-
-            var resultString = Encoding.ASCII.GetString(dataArray);
-
-            data = resultString1.Substring(0, Math.Min(readLength, resultString1.Length));
-            return sendResult;
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MesAdaptor
+{
+    public static class SajetConnectAdapter
+    {
+        [DllImport("SajetConnect.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
+        public static extern bool SajetTransStart();
+
+        [DllImport("SajetConnect.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
+        public static extern bool SajetTransClose();
+
+        //[DllImport("SajetConnect.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
+        //public static extern bool SajetTransData(int command, IntPtr data, IntPtr length);
+
+        [DllImport("SajetConnect.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
+        public static extern bool SajetTransData(int command, IntPtr data, IntPtr length);
+
+        [DllImport("SajetConnect.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
+        public static extern bool SajetTransData_C(int command, out string data);
+
+        public static bool SajetTransData(int command, ref string data)
+        {
+            var idByte = Encoding.ASCII.GetBytes(data);
+            var length = idByte.Length;
+
+            var dataArrayLength = Math.Max(length, 200);
+            var dataArray = new byte[dataArrayLength];
+            Array.Copy(idByte, 0, dataArray, 0, length);
+
+            IntPtr dataIntPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(dataArrayLength);
+            System.Runtime.InteropServices.Marshal.Copy(dataArray, 0, dataIntPtr, dataArray.Length);
+
+            IntPtr lengthIntPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(10);
+            System.Runtime.InteropServices.Marshal.WriteInt32(lengthIntPtr, length);
+
+            var sendResult = SajetConnectAdapter.SajetTransData(command, dataIntPtr, lengthIntPtr);
+
+            var resultString1 = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(dataIntPtr);
+
+            System.Runtime.InteropServices.Marshal.Copy(dataIntPtr, dataArray, 0, dataArrayLength);
+            //System.Runtime.InteropServices.Marshal.Release(dataIntPtr);
+            System.Runtime.InteropServices.Marshal.FreeCoTaskMem(dataIntPtr);
+
+            var readLength = System.Runtime.InteropServices.Marshal.ReadInt32(lengthIntPtr);
+            //System.Runtime.InteropServices.Marshal.Release(lengthIntPtr);
+
+            var resultString = Encoding.ASCII.GetString(dataArray);
+
+            data = resultString1.Substring(0, Math.Min(readLength, resultString1.Length));
+            return sendResult;
+        }
+    }
+}

+ 74 - 74
MesAdaptor/ValueReportData.cs

@@ -1,74 +1,74 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace MesAdaptor
-{
-    public class ValueReportDatas : IEnumerable<ValueReportData>
-    {
-        public ValueReportDatas()
-        {
-            _valueReportDatas = new List<ValueReportData>();
-        }
-
-        public void Add(string key,string val, bool success)
-        {
-            var data = new ValueReportData(key,val,success);
-            var sameKey = _valueReportDatas.FirstOrDefault(x => x.Key == data.Key);
-            _valueReportDatas.Remove(sameKey);
-            _valueReportDatas.Add(data);
-        }
-
-        public void Add(ValueReportData data)
-        {
-            var sameKey = _valueReportDatas.FirstOrDefault(x=>x.Key == data.Key);
-            _valueReportDatas.Remove(sameKey);
-            _valueReportDatas.Add(data);
-        }
-
-        public void Clear()
-        {
-            _valueReportDatas = new List<ValueReportData>();
-        }
-
-        public IEnumerator<ValueReportData> GetEnumerator()
-        {
-            return _valueReportDatas.GetEnumerator();
-        }
-
-        IEnumerator IEnumerable.GetEnumerator()
-        {
-            return _valueReportDatas.GetEnumerator();
-        }
-
-        public ValueReportData this[string index]
-        {
-            get
-            {
-                return _valueReportDatas.FirstOrDefault(x => x.Key == index);
-            }
-        }
-
-        private List<ValueReportData> _valueReportDatas;
-    }
-
-    public class ValueReportData
-    {
-        public ValueReportData(
-            string key,
-            string val,
-            bool isSuccess)
-        {
-            Key = key;
-            Val = val;
-            IsSuccess = isSuccess;
-        }
-
-        public string Key { get; private set; }
-        public string Val { get; private set; }
-        public bool IsSuccess { get; private set; }
-    }
-}
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MesAdaptor
+{
+    public class ValueReportDatas : IEnumerable<ValueReportData>
+    {
+        public ValueReportDatas()
+        {
+            _valueReportDatas = new List<ValueReportData>();
+        }
+
+        public void Add(string key,string val, bool success)
+        {
+            var data = new ValueReportData(key,val,success);
+            var sameKey = _valueReportDatas.FirstOrDefault(x => x.Key == data.Key);
+            _valueReportDatas.Remove(sameKey);
+            _valueReportDatas.Add(data);
+        }
+
+        public void Add(ValueReportData data)
+        {
+            var sameKey = _valueReportDatas.FirstOrDefault(x=>x.Key == data.Key);
+            _valueReportDatas.Remove(sameKey);
+            _valueReportDatas.Add(data);
+        }
+
+        public void Clear()
+        {
+            _valueReportDatas = new List<ValueReportData>();
+        }
+
+        public IEnumerator<ValueReportData> GetEnumerator()
+        {
+            return _valueReportDatas.GetEnumerator();
+        }
+
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return _valueReportDatas.GetEnumerator();
+        }
+
+        public ValueReportData this[string index]
+        {
+            get
+            {
+                return _valueReportDatas.FirstOrDefault(x => x.Key == index);
+            }
+        }
+
+        private List<ValueReportData> _valueReportDatas;
+    }
+
+    public class ValueReportData
+    {
+        public ValueReportData(
+            string key,
+            string val,
+            bool isSuccess)
+        {
+            Key = key;
+            Val = val;
+            IsSuccess = isSuccess;
+        }
+
+        public string Key { get; private set; }
+        public string Val { get; private set; }
+        public bool IsSuccess { get; private set; }
+    }
+}

+ 3 - 3
MesAdaptor/packages.config

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="PhihongEv.Lib" version="1.0.12" targetFramework="net48" />
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="PhihongEv.Lib" version="1.0.12" targetFramework="net48" />
 </packages>

+ 43 - 43
fixDuplicateModel.patch

@@ -1,43 +1,43 @@
-diff --git a/AwInitilizer/Procedure/FirmwareCheckVersionProcedure.cs b/AwInitilizer/Procedure/FirmwareCheckVersionProcedure.cs
-index 3036a9b..24ab0ed 100644
---- a/AwInitilizer/Procedure/FirmwareCheckVersionProcedure.cs
-+++ b/AwInitilizer/Procedure/FirmwareCheckVersionProcedure.cs
-@@ -58,7 +58,9 @@ namespace AwInitilizer.Procedure
-                     continue;
-                 }
- 
--                if(versionPair.Keys.Contains(model.Module))
-+                var logPairNmae = $"{model.Module}VersionCheck";
-+
-+                if (versionPair.Keys.Contains(model.Module))
-                 {
-                     ReportLog.Add(string.Format("Read {0} version : {1} , Expect:{2}", model.Module, versionPair[model.Module], model.Version));
- 
-@@ -76,13 +78,15 @@ namespace AwInitilizer.Procedure
-                     {
-                         Logger.Print($"Model {model.Module} updated", isError: false);
-                         InfoLog += $"{Name}:updated success\n";
--                        LogPair.Add($"{model.Module}VersionCheck", "1");
-+                        if (!LogPair.Keys.Contains(logPairNmae))
-+                            LogPair.Add(logPairNmae, "1");
-                     }
-                     else
-                     {
-                         Logger.Print($"Model {model.Module} version mismatch", isError: true);
-                         InfoLog += $"{model.Module}:Updated Version mismatched\n";
--                        LogPair.Add($"{model.Module}VersionCheck", "0");
-+                        if (!LogPair.Keys.Contains(logPairNmae))
-+                            LogPair.Add(logPairNmae, "0");
-                         return false;
-                     }
-                 }
-@@ -91,7 +95,8 @@ namespace AwInitilizer.Procedure
-                     //model name not found
-                     Logger.Print($"Model {model.Module} version not found", isError: true);
-                     InfoLog += $"Model {model.Module} version not found\n";
--                    LogPair.Add($"{model.Module}VersionCheck", "0");
-+                    if (!LogPair.Keys.Contains(logPairNmae))
-+                        LogPair.Add(logPairNmae, "0");
-                     return false;
-                 }
-             }
+diff --git a/AwInitilizer/Procedure/FirmwareCheckVersionProcedure.cs b/AwInitilizer/Procedure/FirmwareCheckVersionProcedure.cs
+index 3036a9b..24ab0ed 100644
+--- a/AwInitilizer/Procedure/FirmwareCheckVersionProcedure.cs
++++ b/AwInitilizer/Procedure/FirmwareCheckVersionProcedure.cs
+@@ -58,7 +58,9 @@ namespace AwInitilizer.Procedure
+                     continue;
+                 }
+ 
+-                if(versionPair.Keys.Contains(model.Module))
++                var logPairNmae = $"{model.Module}VersionCheck";
++
++                if (versionPair.Keys.Contains(model.Module))
+                 {
+                     ReportLog.Add(string.Format("Read {0} version : {1} , Expect:{2}", model.Module, versionPair[model.Module], model.Version));
+ 
+@@ -76,13 +78,15 @@ namespace AwInitilizer.Procedure
+                     {
+                         Logger.Print($"Model {model.Module} updated", isError: false);
+                         InfoLog += $"{Name}:updated success\n";
+-                        LogPair.Add($"{model.Module}VersionCheck", "1");
++                        if (!LogPair.Keys.Contains(logPairNmae))
++                            LogPair.Add(logPairNmae, "1");
+                     }
+                     else
+                     {
+                         Logger.Print($"Model {model.Module} version mismatch", isError: true);
+                         InfoLog += $"{model.Module}:Updated Version mismatched\n";
+-                        LogPair.Add($"{model.Module}VersionCheck", "0");
++                        if (!LogPair.Keys.Contains(logPairNmae))
++                            LogPair.Add(logPairNmae, "0");
+                         return false;
+                     }
+                 }
+@@ -91,7 +95,8 @@ namespace AwInitilizer.Procedure
+                     //model name not found
+                     Logger.Print($"Model {model.Module} version not found", isError: true);
+                     InfoLog += $"Model {model.Module} version not found\n";
+-                    LogPair.Add($"{model.Module}VersionCheck", "0");
++                    if (!LogPair.Keys.Contains(logPairNmae))
++                        LogPair.Add(logPairNmae, "0");
+                     return false;
+                 }
+             }