diff --git a/HKCard.sln b/HKCard.sln
index cebaddf..db7f129 100644
--- a/HKCard.sln
+++ b/HKCard.sln
@@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32804.467
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HKCardIN", "HKCardIN\HKCardIN.csproj", "{B1174E5F-41B1-447E-BCDD-3C94E311487D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HKCardIN", "HKCardIN\HKCardIN.csproj", "{B1174E5F-41B1-447E-BCDD-3C94E311487D}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HKCardOUT", "HKCardOUT\HKCardOUT.csproj", "{A03F8002-B946-4FD6-BEE7-54EFC199FE4E}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HKCardOUT", "HKCardOUT\HKCardOUT.csproj", "{A03F8002-B946-4FD6-BEE7-54EFC199FE4E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HKLog", "HKLog\HKLog.csproj", "{617E076F-D422-44B7-8455-006AA34ECD45}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -21,6 +23,10 @@ Global
{A03F8002-B946-4FD6-BEE7-54EFC199FE4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A03F8002-B946-4FD6-BEE7-54EFC199FE4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A03F8002-B946-4FD6-BEE7-54EFC199FE4E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {617E076F-D422-44B7-8455-006AA34ECD45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {617E076F-D422-44B7-8455-006AA34ECD45}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {617E076F-D422-44B7-8455-006AA34ECD45}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {617E076F-D422-44B7-8455-006AA34ECD45}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/HKCardIN/Bootstrapper.cs b/HKCardIN/Bootstrapper.cs
index 53476ae..1bca6d5 100644
--- a/HKCardIN/Bootstrapper.cs
+++ b/HKCardIN/Bootstrapper.cs
@@ -7,6 +7,8 @@ using System.Configuration;
using System.Windows.Controls;
using System.Windows.Threading;
using System.Windows;
+using Microsoft.Extensions.Configuration;
+using HKCardIN.Helper;
namespace HKCardIN
{
@@ -17,6 +19,7 @@ namespace HKCardIN
///
protected override void OnStart()
{
+ HKLog.HKLogImport.Init("HKCardIN");
}
protected override void ConfigureIoC(IStyletIoCBuilder builder)
@@ -28,6 +31,9 @@ namespace HKCardIN
///
protected override void Configure()
{
+ var configer = (new ConfigurationBuilder()).AddJsonFile("options.json").Build();
+ DataBus.SaasRoute = configer["SaasRoute"];
+ DataBus.LockCode = configer["LockCode"];
base.Configure();
}
@@ -71,6 +77,7 @@ namespace HKCardIN
///
protected override void OnUnhandledException(DispatcherUnhandledExceptionEventArgs e)
{
+ HKLog.HKLogImport.WriteError(e.Exception.InnerException != null ? e.Exception.InnerException : e.Exception);
GC.Collect();
}
}
diff --git a/HKCardIN/HKCardIN.csproj b/HKCardIN/HKCardIN.csproj
index d27e875..f5aeba8 100644
--- a/HKCardIN/HKCardIN.csproj
+++ b/HKCardIN/HKCardIN.csproj
@@ -24,9 +24,14 @@
+
+
+
+
+
diff --git a/HKCardIN/Helper/DataBus.cs b/HKCardIN/Helper/DataBus.cs
index c4066a2..44e2a06 100644
--- a/HKCardIN/Helper/DataBus.cs
+++ b/HKCardIN/Helper/DataBus.cs
@@ -13,9 +13,8 @@ namespace HKCardIN.Helper
public class DataBus
{
public static bool NetWordState { get; set; } = false;
- public static JObject Option => SyncStatic.ReadFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "options.json")).ToModel();
- public static string SaasRoute => Option["SaasRoute"].ToString();
- public static string LockCode => Option["LockCode"].ToString();
+ public static string SaasRoute { get; set; }
+ public static string LockCode { get; set; }
}
public class ApiRoute
{
diff --git a/HKCardOUT/Bootstrapper.cs b/HKCardOUT/Bootstrapper.cs
index af104b1..300c9c6 100644
--- a/HKCardOUT/Bootstrapper.cs
+++ b/HKCardOUT/Bootstrapper.cs
@@ -4,6 +4,8 @@ using StyletIoC;
using System;
using System.Windows.Threading;
using System.Windows;
+using Microsoft.Extensions.Configuration;
+using HKCardOUT.Helper;
namespace HKCardOUT
{
@@ -14,6 +16,7 @@ namespace HKCardOUT
///
protected override void OnStart()
{
+ HKLog.HKLogImport.Init("HKCardOUT");
}
protected override void ConfigureIoC(IStyletIoCBuilder builder)
@@ -25,6 +28,8 @@ namespace HKCardOUT
///
protected override void Configure()
{
+ var configer = (new ConfigurationBuilder()).AddJsonFile("options.json").Build();
+ DataBus.ConnectionString = configer.GetConnectionString("Sqlite");
base.Configure();
}
@@ -68,6 +73,7 @@ namespace HKCardOUT
///
protected override void OnUnhandledException(DispatcherUnhandledExceptionEventArgs e)
{
+ HKLog.HKLogImport.WriteError(e.Exception.InnerException != null ? e.Exception.InnerException : e.Exception);
GC.Collect();
}
}
diff --git a/HKCardOUT/HKCardOUT.csproj b/HKCardOUT/HKCardOUT.csproj
index 9a33e6e..77fb2e6 100644
--- a/HKCardOUT/HKCardOUT.csproj
+++ b/HKCardOUT/HKCardOUT.csproj
@@ -19,16 +19,30 @@
TRACE;Core
+
+
+
+
+
+
+
+
Always
+
+
+
+
+
+
diff --git a/HKCardOUT/HKResouces/背景.jpg b/HKCardOUT/HKResouces/背景.jpg
new file mode 100644
index 0000000..79dfc04
Binary files /dev/null and b/HKCardOUT/HKResouces/背景.jpg differ
diff --git a/HKCardOUT/Helper/DataBus.cs b/HKCardOUT/Helper/DataBus.cs
new file mode 100644
index 0000000..4b0e545
--- /dev/null
+++ b/HKCardOUT/Helper/DataBus.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using XExten.Advance.StaticFramework;
+
+namespace HKCardOUT.Helper
+{
+ public class DataBus
+ {
+ private static string _ConnectionString;
+ public static string ConnectionString
+ {
+ get => _ConnectionString;
+ set
+ {
+ var Route = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DATA");
+ _ConnectionString = SyncStatic.CreateFile(Path.Combine(SyncStatic.CreateDir(Route), value));
+ }
+ }
+ }
+}
diff --git a/HKCardOUT/Logic/DbContext.cs b/HKCardOUT/Logic/DbContext.cs
new file mode 100644
index 0000000..3be36cf
--- /dev/null
+++ b/HKCardOUT/Logic/DbContext.cs
@@ -0,0 +1,26 @@
+using HKCardOUT.Helper;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HKCardOUT.Logic
+{
+ public class DbContext
+ {
+ public static SqlSugarScope Context = new(new ConnectionConfig()
+ {
+ ConnectionString = DataBus.ConnectionString,//连接符字串
+ DbType = DbType.Sqlite,//数据库类型
+ IsAutoCloseConnection = true //不设成true要手动close
+ }, db =>
+ {
+ db.Aop.OnLogExecuting = (sql, pars) =>
+ {
+
+ };
+ });
+ }
+}
diff --git a/HKCardOUT/Views/RootView.xaml b/HKCardOUT/Views/RootView.xaml
index 1134c78..2f61bb6 100644
--- a/HKCardOUT/Views/RootView.xaml
+++ b/HKCardOUT/Views/RootView.xaml
@@ -1,16 +1,22 @@
-
-
+
+
+
+
+
diff --git a/HKCardOUT/options.json b/HKCardOUT/options.json
index 1f26806..b32804d 100644
--- a/HKCardOUT/options.json
+++ b/HKCardOUT/options.json
@@ -1,4 +1,7 @@
{
"SaasRoute": "",
- "Cron": ""
+ "Cron": "",
+ "ConnectionStrings": {
+ "Sqlite": "HKSQL.db3"
+ }
}
diff --git a/HKLog/HKLog.csproj b/HKLog/HKLog.csproj
new file mode 100644
index 0000000..df573dc
--- /dev/null
+++ b/HKLog/HKLog.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/HKLog/HKLogImport.cs b/HKLog/HKLogImport.cs
new file mode 100644
index 0000000..765ddb1
--- /dev/null
+++ b/HKLog/HKLogImport.cs
@@ -0,0 +1,24 @@
+using Serilog;
+
+namespace HKLog
+{
+ public class HKLogImport
+ {
+ public static void Init(string input)
+ {
+ //日志
+ Log.Logger = new LoggerConfiguration()
+ .MinimumLevel.Information()
+ .WriteTo.File($"Logs/{input}.log", rollingInterval: RollingInterval.Day)
+ .CreateLogger();
+ }
+ public static void WriteInfo(string msg)
+ {
+ Log.Logger.Information(msg);
+ }
+ public static void WriteError(Exception ex)
+ {
+ Log.Logger.Error(ex, ex.Message);
+ }
+ }
+}
\ No newline at end of file