阳光名岛车辆协议开发

master
rszn 5 months ago
parent 2f186ebb1e
commit 97d3118669

@ -26,7 +26,7 @@
</ItemGroup>
<ItemGroup>
<None Update="log4net.xml">
<None Update="log4net.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

@ -7,8 +7,8 @@ internal class Program
{
public static void Main(string[] args)
{
XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + @"\log4net.xml"));
XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + @"\log4net.config"));
var exportDb = new ExportDb();
exportDb.Export();
}
}
}

@ -4,6 +4,7 @@ using HybirdFrameworkDriver.Session;
using log4net;
using Service.Car.Msg.Car.Req;
using Service.Car.Msg.Host.Resp;
using Service.Car.Server;
namespace Service.Car.Handler;
@ -24,7 +25,7 @@ public class ElecMsgHandler : SimpleChannelInboundHandler<ElecMsg>, IBaseHandler
protected override void ChannelRead0(IChannelHandlerContext ctx, ElecMsg msg)
{
Log.Info($"receive ElecMsg = {msg}");
IoSession? ioSession = SessionMgr.GetSession(msg.CarNo);
IoSession? ioSession = CarServerMgr.CarServer?.SessionMgr.GetSession(msg.CarNo);
ioSession?.BusinessMap.AddOrUpdate("ElecMsg", msg, ((s, o) => msg));
ioSession?.BusinessMap.AddOrUpdate("Connected", true, ((s, o) => true));

@ -27,15 +27,15 @@ public class HeartBeatMsgHandler : SimpleChannelInboundHandler<HeartBeatMsg>, IB
{
Log.Info($"receive HeartBeatMsg = {msg}");
IoSession? ioSession = SessionMgr.GetSession(ctx.Channel.Id.ToString());
IoSession? ioSession = CarServerMgr.CarServer?.SessionMgr.GetSession(ctx.Channel.Id.ToString());
if (ioSession != null && ioSession.Key != msg.CarNo)
{
SessionMgr.ChangeSessionKey(ioSession, msg.CarNo);
CarServerMgr.CarServer?.SessionMgr.ChangeSessionKey(ioSession, msg.CarNo);
}
if (ioSession == null)
{
ioSession = SessionMgr.GetSession(msg.CarNo);
ioSession = CarServerMgr.CarServer?.SessionMgr.GetSession(msg.CarNo);
}
ioSession.BusinessMap.AddOrUpdate("HeartBeatMsg", msg, ((s, o) => msg));

@ -0,0 +1,49 @@
using DotNetty.Buffers;
using DotNetty.Codecs;
using DotNetty.Transport.Channels;
using HybirdFrameworkCore.Utils;
using log4net;
using Service.TBox.Msg;
using Service.TBox.Msg.TBox;
namespace Service.TBox.Codec;
public class Decoder : ByteToMessageDecoder
{
//TODO 实际开发时去掉
public static Queue<BaseMsg> Msgs { get; set; } = new();
//TODO 实际开发时去掉
public static Queue<byte[]> BytesQueue { get; set; } = new();
private static readonly ILog Log = LogManager.GetLogger(typeof(Decoder));
private readonly int _fixedLength = 18;
protected override void Decode(IChannelHandlerContext context, IByteBuffer input, List<object> output)
{
if (_fixedLength <= input.ReadableBytes)
{
byte[] bytes = new byte[_fixedLength];
input.ReadBytes(bytes);
//TODO 实际开发时去掉
BytesQueue.Enqueue(bytes);
Log.Info($"receive {BitUtls.BytesToHexStr(bytes)}");
int id = BitConverter.ToInt32(new byte[] { bytes[3], bytes[2], bytes[1], bytes[0] }, 0);
Log.Info(
$"receive id={id} {BitUtls.BytesToHexStr(BitConverter.GetBytes(0x1882D0F3))} {BitUtls.BytesToHexStr(BitConverter.GetBytes(4090528280))}");
BaseMsg baseMsg = id switch
{
0x1882D0F3 => ModelConvert.Decode<SocMsg>(bytes),
0x18FF48A8 => ModelConvert.Decode<StatusMsg>(bytes),
_ => ModelConvert.Decode<OtherMsg>(bytes),
};
//TODO 实际开发时去掉
Msgs.Enqueue(baseMsg);
output.Add(baseMsg);
}
}
}

@ -0,0 +1,24 @@
using DotNetty.Buffers;
using DotNetty.Codecs;
using DotNetty.Transport.Channels;
using log4net;
using Service.TBox.Msg;
namespace Service.TBox.Codec;
public class Encoder : MessageToByteEncoder<BaseMsg>
{
private static readonly ILog Log = LogManager.GetLogger(typeof(Encoder));
/// <summary>
///
/// </summary>
/// <param name="context"></param>
/// <param name="obj"></param>
/// <param name="output"></param>
protected override void Encode(IChannelHandlerContext context, BaseMsg obj, IByteBuffer output)
{
byte[] bytes = obj.ToBytes();
output.WriteBytes(bytes);
}
}

@ -0,0 +1,8 @@
using DotNetty.Transport.Channels;
namespace Service.TBox.Handler;
public interface IBaseHandler: IChannelHandler
{
}

@ -0,0 +1,18 @@
using DotNetty.Transport.Channels;
using HybirdFrameworkCore.Autofac.Attribute;
using log4net;
using Service.TBox.Msg.TBox;
namespace Service.TBox.Handler;
[Order(8)]
[Scope("InstancePerDependency")]
public class OtherMsgHandler : SimpleChannelInboundHandler<OtherMsg>, IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(OtherMsgHandler));
protected override void ChannelRead0(IChannelHandlerContext ctx, OtherMsg msg)
{
Log.Info($"receive OtherMsg={msg}");
}
}

@ -0,0 +1,19 @@
using DotNetty.Transport.Channels;
using HybirdFrameworkCore.Autofac.Attribute;
using log4net;
using Newtonsoft.Json;
using Service.TBox.Msg.TBox;
namespace Service.TBox.Handler;
[Order(8)]
[Scope("InstancePerDependency")]
public class SocMsgHandler : SimpleChannelInboundHandler<SocMsg>, IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(SocMsgHandler));
protected override void ChannelRead0(IChannelHandlerContext ctx, SocMsg msg)
{
Log.Info($"receive SocMsg={JsonConvert.SerializeObject(msg)}");
}
}

@ -0,0 +1,22 @@
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Utils;
using HybirdFrameworkDriver.Common;
namespace Service.TBox.Msg;
public class BaseMsg : IToBytes
{
[Property(0, 32)] public UInt32 Id { get; set; }
[Property(32, 8)] public byte P { get; set; }
[Property(40, 8)] public byte R { get; set; }
[Property(48, 8)] public byte Dp { get; set; }
[Property(56, 8)] public byte Pf { get; set; }
[Property(64, 8)] public byte Ps { get; set; }
[Property(72, 8)] public byte Sa { get; set; }
public byte[] ToBytes()
{
return ModelConvert.Encode(this);
}
}

@ -0,0 +1,18 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.Host;
public class LockMsg : BaseMsg
{
/// <summary>
/// 0断开连接 1加锁 2解锁 3无效
/// </summary>
[Property(80, 2)]
public byte Lock { get; set; }
public LockMsg(byte @lock)
{
Id = 0x1880D0F3;
Lock = @lock;
}
}

@ -0,0 +1,18 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.Host;
public class RestartMsg : BaseMsg
{
/// <summary>
/// "0无指令 1重启指令"
/// </summary>
[Property(80, 2)]
public byte Restart { get; set; }
public RestartMsg(byte restart)
{
Id = 0x18FFF8A8;
Restart = restart;
}
}

@ -0,0 +1,20 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.Host;
public class VinMsg : BaseMsg
{
[Property(80, 8)] public byte Seq { get; set; }
[Property(88, 8)] public byte B2 { get; set; }
[Property(96, 8)] public byte B3 { get; set; }
[Property(104, 8)] public byte B4 { get; set; }
[Property(112, 8)] public byte B5 { get; set; }
[Property(120, 8)] public byte B6 { get; set; }
[Property(128, 8)] public byte B7 { get; set; }
[Property(136, 8)] public byte B8 { get; set; }
public VinMsg()
{
Id = 0x18E1F3D1;
}
}

@ -0,0 +1,16 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.TBox;
public class BatteryFourSn : BaseMsg
{
[Property(80, 8)] public byte CheckSum { get; set; }
[Property(91, 5)] public byte Length { get; set; }
[Property(88, 3)] public byte Factory { get; set; }
[Property(96, 8)] public byte Sn1 { get; set; }
[Property(104, 8)] public byte Sn2 { get; set; }
[Property(112, 8)] public byte Sn3 { get; set; }
[Property(120, 8)] public byte Sn4 { get; set; }
[Property(128, 8)] public byte Sn5 { get; set; }
[Property(136, 8)] public byte Sn6 { get; set; }
}

@ -0,0 +1,13 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.TBox;
public class BatteryInfo1 : BaseMsg
{
[Property(80, 4)] public byte TypeCode { get; set; }
[Property(84, 8)] public byte Reserved1 { get; set; }
[Property(88, 16, scale: 0.1, round: 1)]
public float Soe { get; set; }
}

@ -0,0 +1,16 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.TBox;
public class BatteryOneSn : BaseMsg
{
[Property(80, 8)] public byte CheckSum { get; set; }
[Property(91, 5)] public byte Length { get; set; }
[Property(88, 3)] public byte Factory { get; set; }
[Property(96, 8)] public byte Sn1 { get; set; }
[Property(104, 8)] public byte Sn2 { get; set; }
[Property(112, 8)] public byte Sn3 { get; set; }
[Property(120, 8)] public byte Sn4 { get; set; }
[Property(128, 8)] public byte Sn5 { get; set; }
[Property(136, 8)] public byte Sn6 { get; set; }
}

@ -0,0 +1,16 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.TBox;
public class BatteryThreeSn : BaseMsg
{
[Property(80, 8)] public byte CheckSum { get; set; }
[Property(91, 5)] public byte Length { get; set; }
[Property(88, 3)] public byte Factory { get; set; }
[Property(96, 8)] public byte Sn1 { get; set; }
[Property(104, 8)] public byte Sn2 { get; set; }
[Property(112, 8)] public byte Sn3 { get; set; }
[Property(120, 8)] public byte Sn4 { get; set; }
[Property(128, 8)] public byte Sn5 { get; set; }
[Property(136, 8)] public byte Sn6 { get; set; }
}

@ -0,0 +1,16 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.TBox;
public class BatteryTwoSn : BaseMsg
{
[Property(80, 8)] public byte CheckSum { get; set; }
[Property(91, 5)] public byte Length { get; set; }
[Property(88, 3)] public byte Factory { get; set; }
[Property(96, 8)] public byte Sn1 { get; set; }
[Property(104, 8)] public byte Sn2 { get; set; }
[Property(112, 8)] public byte Sn3 { get; set; }
[Property(120, 8)] public byte Sn4 { get; set; }
[Property(128, 8)] public byte Sn5 { get; set; }
[Property(136, 8)] public byte Sn6 { get; set; }
}

@ -0,0 +1,8 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.TBox;
public class LockStatusMsg : BaseMsg
{
[Property(80, 2)] public byte LockStatus { get; set; }
}

@ -0,0 +1,9 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.TBox;
public class OtherMsg : BaseMsg
{
[Property(80, 64)]
public byte[] Data { get; set; }
}

@ -0,0 +1,8 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.TBox;
public class SocMsg : BaseMsg
{
[Property(80, 8)] public ushort Soc { get; set; }
}

@ -0,0 +1,8 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.TBox;
public class SohMsg : BaseMsg
{
[Property(80, 16)] public float Soh { get; set; }
}

@ -0,0 +1,23 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.TBox;
public class StatusMsg : BaseMsg
{
[Property(80,4)]
public byte Gear { get; set; }
[Property(84,2)]
public byte Break { get; set; }
[Property(86,2)]
public byte Keys { get; set; }
[Property(88,2)]
public byte MainRelay { get; set; }
[Property(90,2)]
public byte CarType { get; set; }
[Property(92,2)]
public byte Solenoid { get; set; }
[Property(94,2)]
public byte Online { get; set; }
[Property(96,2)]
public byte WifiError { get; set; }
}

@ -0,0 +1,8 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.TBox;
public class SubMileMsg : BaseMsg
{
[Property(80, 32)] public double SubMile { get; set; }
}

@ -0,0 +1,8 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.TBox;
public class TotalMileMsg : BaseMsg
{
[Property(80, 32)] public double TotalMile { get; set; }
}

@ -0,0 +1,11 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.TBox;
public class VersionMsg : BaseMsg
{
[Property(80, 8)] public byte SoftR { get; set; }
[Property(88, 8)] public byte SoftB { get; set; }
[Property(96, 8)] public byte HardV { get; set; }
[Property(104, 8)] public byte HardB { get; set; }
}

@ -0,0 +1,15 @@
using HybirdFrameworkCore.Autofac.Attribute;
namespace Service.TBox.Msg.TBox;
public class VinMsg : BaseMsg
{
[Property(80, 8)] public byte Seq { get; set; }
[Property(88, 8)] public byte B2 { get; set; }
[Property(96, 8)] public byte B3 { get; set; }
[Property(104, 8)] public byte B4 { get; set; }
[Property(112, 8)] public byte B5 { get; set; }
[Property(120, 8)] public byte B6 { get; set; }
[Property(128, 8)] public byte B7 { get; set; }
[Property(136, 8)] public byte B8 { get; set; }
}

@ -0,0 +1,42 @@
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.AutoTask;
using Service.TBox.Server;
namespace Service.TBox.MyTask;
[Scope]
public class LockTask : ITask
{
public static readonly string TaskName = "LockTask";
private volatile bool _stop;
public string Name()
{
return TaskName;
}
public int Interval()
{
return 500;
}
public void Handle()
{
TBoxServerMgr.Server?.SessionMgr.Broadcast(TBoxServerMgr.Server?.LockMsg);
}
public bool Stoped()
{
return _stop;
}
public void Stop()
{
_stop = true;
}
public void ResetStop()
{
_stop = false;
}
}

@ -0,0 +1,48 @@
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.AutoTask;
using Service.TBox.Server;
namespace Service.TBox.MyTask;
[Scope]
public class VinTask : ITask
{
public static readonly string TaskName = "VinTask";
private volatile bool _stop = true;
public string Name()
{
return TaskName;
}
public int Interval()
{
return 100;
}
public void Handle()
{
foreach (var vinMsg in TBoxServerMgr.Server?.SendVinMsg)
{
if (vinMsg != null)
{
TBoxServerMgr.Server?.SessionMgr.Broadcast(vinMsg);
}
}
}
public bool Stoped()
{
return _stop;
}
public void Stop()
{
_stop = true;
}
public void ResetStop()
{
_stop = false;
}
}

@ -0,0 +1,150 @@
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.AutoTask;
using HybirdFrameworkDriver.TcpServer;
using log4net;
using Service.TBox.Codec;
using Service.TBox.Handler;
using Service.TBox.Msg.Host;
using Service.TBox.Msg.TBox;
using Service.TBox.MyTask;
using VinMsg = Service.TBox.Msg.Host.VinMsg;
namespace Service.TBox.Server;
[Scope]
public class TBoxServer : TcpServer<IBaseHandler, Decoder, Encoder>
{
private static readonly ILog Log = LogManager.GetLogger(typeof(TBoxServer));
#region HostMsg
public LockMsg LockMsg = new LockMsg(3);
public VinMsg[] SendVinMsg = new VinMsg[3];
public string SendVin { get; set; }
#endregion
#region TBoxMsg
public BatteryOneSn? BatteryOneSn { get; set; }
public BatteryTwoSn? BatteryTwoSn { get; set; }
public BatteryThreeSn BatteryThreeSn { get; set; }
public BatteryFourSn BatteryFourSn { get; set; }
public BatteryInfo1 BatteryInfo1 { get; set; }
public LockStatusMsg LockStatusMsg { get; set; }
public SocMsg SocMsg { get; set; }
public SohMsg SohMsg { get; set; }
public StatusMsg StatusMsg { get; set; }
public SubMileMsg SubMileMsg { get; set; }
public TotalMileMsg TotalMileMsg { get; set; }
public VersionMsg VersionMsg { get; set; }
public Msg.TBox.VinMsg VinMsg { get; set; }
#endregion
#region func
/// <summary>
///
/// </summary>
/// <param name="@lock">0断开连接 1加锁 2解锁 3无效</param>
public void StartSendLock(byte @lock)
{
LockMsg.Lock = @lock;
if (TaskInit.TaskMap.TryGetValue(LockTask.TaskName, out var task))
{
task.Start();
}
}
/// <summary>
///
/// </summary>
public void StopSendLock()
{
if (TaskInit.TaskMap.TryGetValue(LockTask.TaskName, out var task))
{
task.Stop();
}
}
/// <summary>
///
/// </summary>
/// <param name="vin"></param>
public void StartSendVin(string vin)
{
SendVin = vin;
EncodeVin(vin);
if (TaskInit.TaskMap.TryGetValue(VinTask.TaskName, out var task))
{
task.Start();
}
}
/// <summary>
///
/// </summary>
/// <param name="vin"></param>
private void EncodeVin(string vin)
{
if (vin.Length != 17)
{
Log.Info("vin length is not 17");
return;
}
SendVinMsg[0] = new VinMsg()
{
Seq = 1,
B2 = (byte)vin[0],
B3 = (byte)vin[1],
B4 = (byte)vin[2],
B5 = (byte)vin[3],
B6 = (byte)vin[4],
B7 = (byte)vin[5],
B8 = (byte)vin[6],
};
SendVinMsg[1] = new VinMsg()
{
Seq = 2,
B2 = (byte)vin[7+0],
B3 = (byte)vin[7+1],
B4 = (byte)vin[7+2],
B5 = (byte)vin[7+3],
B6 = (byte)vin[7+4],
B7 = (byte)vin[7+5],
B8 = (byte)vin[7+6],
};
SendVinMsg[2] = new VinMsg()
{
Seq = 3,
B2 = (byte)vin[14+0],
B3 = (byte)vin[14+1],
B4 = (byte)vin[14+2],
};
}
/// <summary>
///
/// </summary>
public void StopSendVin()
{
if (TaskInit.TaskMap.TryGetValue(VinTask.TaskName, out var task))
{
task.Stop();
}
}
/// <summary>
/// "0无指令 1重启指令"
/// </summary>
/// <param name="restart"></param>
public void SendRestart(byte restart)
{
TBoxServerMgr.Server?.SessionMgr.Broadcast(new RestartMsg(restart));
}
#endregion
}

@ -0,0 +1,18 @@
using Autofac;
using HybirdFrameworkCore.Autofac;
namespace Service.TBox.Server;
public class TBoxServerMgr
{
public static TBoxServer? Server { get; private set; }
public static void InitTBoxServer(int port)
{
if (Server == null)
{
Server = AppInfo.Container.Resolve<TBoxServer>();
Server.Start(port);
}
}
}

@ -26,7 +26,7 @@ public class CarController : ControllerBase{
[HttpGet("/getCarInfo/{carNo}")]
public CarInfoResp? GetCarInfo(string carNo)
{
IoSession? ioSession = SessionMgr.GetSession(carNo);
IoSession? ioSession = CarServerMgr.CarServer?.SessionMgr.GetSession(carNo);
CarInfoResp carInfoResp = new CarInfoResp()
{
Connected = CarServerMgr.CarServer != null && ioSession != null,
@ -61,7 +61,7 @@ public class CarController : ControllerBase{
public List<CarInfoResp> GetCarInfoList()
{
List<CarInfoResp> result = new List<CarInfoResp>();
List<IoSession> sessionList = SessionMgr.GetSessionList();
List<IoSession> sessionList = CarServerMgr.CarServer?.SessionMgr.GetSessionList();
foreach (var ioSession in sessionList)
{
@ -99,7 +99,7 @@ public class CarController : ControllerBase{
{
Log.Info($"Lock {carNo}");
IoSession? ioSession = SessionMgr.GetSession(carNo);
IoSession? ioSession = CarServerMgr.CarServer?.SessionMgr.GetSession(carNo);
if (CarServerMgr.CarServer == null || ioSession?.Channel == null)
{
Log.Info("ioSession is null return false");
@ -111,7 +111,7 @@ public class CarController : ControllerBase{
CarNo = carNo
};
CarServerMgr.CarServer.LockMsgPair.Req = lockMsg;
ioSession.Channel.WriteAndFlushAsync(lockMsg);
ioSession.Send(lockMsg);
return CarServerMgr.CarServer.LockMsgPair.GetResp(TimeSpan.FromSeconds(5))?.Result == 0;
}
@ -125,7 +125,7 @@ public class CarController : ControllerBase{
public bool UnLock(string carNo)
{
Log.Info($"UnLock {carNo} ");
IoSession? ioSession = SessionMgr.GetSession(carNo);
IoSession? ioSession = CarServerMgr.CarServer?.SessionMgr.GetSession(carNo);
if (CarServerMgr.CarServer == null || ioSession?.Channel == null)
{
Log.Info("ioSession is null return false");
@ -138,7 +138,7 @@ public class CarController : ControllerBase{
};
CarServerMgr.CarServer.UnLockMsgPair.Req = unLockMsg;
ioSession.Channel.WriteAndFlushAsync(unLockMsg);
ioSession.Send(unLockMsg);
return CarServerMgr.CarServer.UnLockMsgPair.GetResp(TimeSpan.FromSeconds(5))?.Result == 0;
}
@ -152,7 +152,7 @@ public class CarController : ControllerBase{
public bool SettleConfirm(string carNo)
{
Log.Info($"SettleConfirm {carNo}");
IoSession? ioSession = SessionMgr.GetSession(carNo);
IoSession? ioSession = CarServerMgr.CarServer?.SessionMgr.GetSession(carNo);
if (CarServerMgr.CarServer == null || ioSession?.Channel == null)
{
Log.Info("ioSession is null return false");
@ -161,7 +161,7 @@ public class CarController : ControllerBase{
var settleConfirmMsg = new SettleConfirmMsg() { CarNo = carNo };
CarServerMgr.CarServer.SettleConfirmMsgPair.Req = settleConfirmMsg;
ioSession.Channel.WriteAndFlushAsync(settleConfirmMsg);
ioSession.Send(settleConfirmMsg);
return CarServerMgr.CarServer.SettleConfirmMsgPair.GetResp(TimeSpan.FromSeconds(5))?.Result == 0;
}
@ -174,7 +174,7 @@ public class CarController : ControllerBase{
public bool SetParam(SetParam setParam)
{
Log.Info($"SetParam {JsonConvert.SerializeObject(setParam)}");
IoSession? ioSession = SessionMgr.GetSession(setParam.CarNo);
IoSession? ioSession = CarServerMgr.CarServer?.SessionMgr.GetSession(setParam.CarNo);
if (CarServerMgr.CarServer == null || ioSession?.Channel == null)
{
Log.Info("ioSession is null return false");
@ -198,7 +198,7 @@ public class CarController : ControllerBase{
ElectricityToBeSettled = setParam.ElectricityToBeSettled,
};
CarServerMgr.CarServer.SetParamMsgPair.Req = setParamMsg;
SessionMgr.Broadcast(setParamMsg);
ioSession.Send(setParamMsg);
return CarServerMgr.CarServer.SetParamMsgPair.GetResp(TimeSpan.FromSeconds(5))?.Result ==0;
}
@ -216,7 +216,7 @@ public class CarController : ControllerBase{
return true;
}
IoSession? session = SessionMgr.GetSession(carNo);
IoSession? session = CarServerMgr.CarServer?.SessionMgr.GetSession(carNo);
if (session == null)
{
CarServerMgr.CarServer.Clean();

@ -31,11 +31,174 @@ partial class Form2
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form2";
groupBox1 = new GroupBox();
btnConn = new Button();
txtPort = new TextBox();
label2 = new Label();
groupBox2 = new GroupBox();
splitContainer1 = new SplitContainer();
rTxtOriginal = new RichTextBox();
label3 = new Label();
rTxtParsed = new RichTextBox();
label5 = new Label();
label4 = new Label();
groupBox1.SuspendLayout();
groupBox2.SuspendLayout();
((ISupportInitialize)splitContainer1).BeginInit();
splitContainer1.Panel1.SuspendLayout();
splitContainer1.Panel2.SuspendLayout();
splitContainer1.SuspendLayout();
SuspendLayout();
//
// groupBox1
//
groupBox1.Controls.Add(btnConn);
groupBox1.Controls.Add(txtPort);
groupBox1.Controls.Add(label2);
groupBox1.Dock = DockStyle.Top;
groupBox1.Location = new Point(0, 0);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(800, 100);
groupBox1.TabIndex = 0;
groupBox1.TabStop = false;
groupBox1.Text = "连接参数";
//
// btnConn
//
btnConn.Location = new Point(502, 26);
btnConn.Name = "btnConn";
btnConn.Size = new Size(75, 23);
btnConn.TabIndex = 4;
btnConn.Text = "连接";
btnConn.UseVisualStyleBackColor = true;
btnConn.Click += btnConn_Click;
//
// txtPort
//
txtPort.Location = new Point(232, 26);
txtPort.Name = "txtPort";
txtPort.Size = new Size(100, 23);
txtPort.TabIndex = 3;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(186, 26);
label2.Name = "label2";
label2.Size = new Size(40, 17);
label2.TabIndex = 2;
label2.Text = "PORT";
//
// groupBox2
//
groupBox2.Controls.Add(splitContainer1);
groupBox2.Dock = DockStyle.Fill;
groupBox2.Location = new Point(0, 100);
groupBox2.Name = "groupBox2";
groupBox2.Size = new Size(800, 187);
groupBox2.TabIndex = 1;
groupBox2.TabStop = false;
groupBox2.Text = "报文展示";
//
// splitContainer1
//
splitContainer1.Dock = DockStyle.Fill;
splitContainer1.Location = new Point(3, 19);
splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
splitContainer1.Panel1.Controls.Add(rTxtOriginal);
splitContainer1.Panel1.Controls.Add(label3);
//
// splitContainer1.Panel2
//
splitContainer1.Panel2.Controls.Add(rTxtParsed);
splitContainer1.Panel2.Controls.Add(label5);
splitContainer1.Panel2.Controls.Add(label4);
splitContainer1.Size = new Size(794, 165);
splitContainer1.SplitterDistance = 381;
splitContainer1.TabIndex = 0;
//
// rTxtOriginal
//
rTxtOriginal.Dock = DockStyle.Fill;
rTxtOriginal.Location = new Point(0, 17);
rTxtOriginal.Name = "rTxtOriginal";
rTxtOriginal.Size = new Size(381, 148);
rTxtOriginal.TabIndex = 1;
rTxtOriginal.Text = "";
//
// label3
//
label3.AutoSize = true;
label3.Dock = DockStyle.Top;
label3.Location = new Point(0, 0);
label3.Name = "label3";
label3.Size = new Size(56, 17);
label3.TabIndex = 0;
label3.Text = "原始报文";
//
// rTxtParsed
//
rTxtParsed.Dock = DockStyle.Fill;
rTxtParsed.Location = new Point(0, 17);
rTxtParsed.Name = "rTxtParsed";
rTxtParsed.Size = new Size(409, 148);
rTxtParsed.TabIndex = 3;
rTxtParsed.Text = "";
//
// label5
//
label5.AutoSize = true;
label5.Dock = DockStyle.Top;
label5.Location = new Point(0, 0);
label5.Name = "label5";
label5.Size = new Size(56, 17);
label5.TabIndex = 2;
label5.Text = "解析数据";
//
// label4
//
label4.AutoSize = true;
label4.Location = new Point(146, 56);
label4.Name = "label4";
label4.Size = new Size(43, 17);
label4.TabIndex = 0;
label4.Text = "label4";
//
// Form2
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(groupBox2);
Controls.Add(groupBox1);
Name = "Form2";
Text = "Form2";
groupBox1.ResumeLayout(false);
groupBox1.PerformLayout();
groupBox2.ResumeLayout(false);
splitContainer1.Panel1.ResumeLayout(false);
splitContainer1.Panel1.PerformLayout();
splitContainer1.Panel2.ResumeLayout(false);
splitContainer1.Panel2.PerformLayout();
((ISupportInitialize)splitContainer1).EndInit();
splitContainer1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
}
private GroupBox groupBox1;
private Button btnConn;
private TextBox txtPort;
private Label label2;
private GroupBox groupBox2;
private SplitContainer splitContainer1;
private RichTextBox rTxtOriginal;
private Label label3;
private RichTextBox rTxtParsed;
private Label label5;
private Label label4;
}

@ -1,9 +1,83 @@
namespace WinFormStarter;
using Autofac;
using Autofac.Core;
using DotNetty.Handlers.Logging;
using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Utils;
using log4net;
using Newtonsoft.Json;
using Service.TBox;
using Service.TBox.Codec;
using Service.TBox.Server;
namespace WinFormStarter;
public partial class Form2 : Form
{
private static readonly ILog Log = LogManager.GetLogger(typeof(Form2));
private TBoxServer? server = null;
public Form2()
{
InitializeComponent();
this.txtPort.Text = "9000";
Task.Run(() =>
{
while (true)
{
if (Decoder.Msgs.TryDequeue(out var msg))
{
AppendText(rTxtParsed, JsonConvert.SerializeObject(msg) + "\r\n");
}
if (Decoder.BytesQueue.TryDequeue(out var bytes))
{
AppendText(rTxtOriginal, BitUtls.BytesToHexStr(bytes) + "\r\n");
}
Thread.Sleep(50);
}
});
}
private void AppendText(RichTextBox r, string msg)
{
if (r.InvokeRequired)
{
r.Invoke(() =>
{
r.AppendText(msg);
});
}
else
{
r.AppendText(msg);
}
}
private void btnConn_Click(object sender, EventArgs e)
{
string portTxt = txtPort.Text;
if (!int.TryParse(portTxt, out var port))
{
MessageBox.Show("请输入端口号");
return;
}
if (server == null)
{
foreach (var reg in AppInfo.Container.ComponentRegistry.Registrations)
foreach (var service in reg.Services)
if (service is TypedService ts)
Log.Info(ts.ServiceType);
server = AppInfo.Container.Resolve<TBoxServer>();
server.LogLevel = LogLevel.TRACE;
server.Start(port);
}
MessageBox.Show($"启动成功, 监听{port}");
}
}
}

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -23,7 +23,7 @@ internal static class Program
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + @"\log4net.xml"));
XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + @"\log4net.config"));
Application.ThreadException += Application_ThreadException;
// 创建容器
var builder = new ContainerBuilder();

@ -12,6 +12,7 @@
<PackageReference Include="Autofac" Version="7.1.0"/>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0"/>
<PackageReference Include="log4net" Version="2.0.15"/>
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
@ -35,8 +36,8 @@
<None Update="appsettings.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="log4net.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<None Update="log4net.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

@ -1,6 +0,0 @@
2024-04-01 15:25:31,520 INFO 1 WinFormStarter.Form1 - this is a test
2024-04-01 15:26:58,070 INFO 1 WinFormStarter.Form1 - this is a test
2024-04-01 15:27:48,840 INFO 1 WinFormStarter.Form1 - this is a test
2024-04-01 15:28:25,776 INFO 1 WinFormStarter.Form1 - this is a test
2024-04-01 15:41:18,104 INFO 1 WinFormStarter.Form1 - this is a test
2024-04-01 15:46:44,052 INFO 1 WinFormStarter.Form1 - this is a test

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<log4net>
<!-- 控制台日志配置 -->
<appender name="Console" type="log4net.Appender.ConsoleAppender">
<!-- 日志输出格式 -->
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %5level [%thread] (%file:%line) - %message%newline"/>
</layout>
</appender>
<!-- 文件存储日志配置 -->
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<!-- 保存文件的名称 -->
<file value="logs\WinForm.log"/>
<appendToFile value="true"/>
<!-- 文件的编码方式 -->
<param name="Encoding" value="UTF-8"/>
<!-- 每个文件的大小 -->
<maximumFileSize value="100MB"/>
<!-- 保存文件数量 -->
<maxSizeRollBackups value="2"/>
<lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
<!-- 日志输出格式 -->
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %level %thread %logger - %message%newline"/>
</layout>
</appender>
<root>
<level value="ALL"/>
<appender-ref ref="Console"/>
<appender-ref ref="RollingFile"/>
</root>
</log4net>

@ -8,7 +8,7 @@
".NETCoreApp,Version=v6.0": {
"Autofac/7.1.0": {
"dependencies": {
"System.Diagnostics.DiagnosticSource": "4.7.1"
"System.Diagnostics.DiagnosticSource": "6.0.0"
},
"runtime": {
"lib/net6.0/Autofac.dll": {
@ -29,6 +29,17 @@
}
}
},
"AutoMapper/13.0.1": {
"dependencies": {
"Microsoft.Extensions.Options": "6.0.0"
},
"runtime": {
"lib/net6.0/AutoMapper.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.1.0"
}
}
},
"DotNetty.Buffers/0.7.5": {
"dependencies": {
"DotNetty.Common": "0.7.5",
@ -71,7 +82,7 @@
},
"DotNetty.Common/0.7.5": {
"dependencies": {
"Microsoft.Extensions.Logging": "5.0.0",
"Microsoft.Extensions.Logging": "6.0.0",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
},
"runtime": {
@ -127,7 +138,7 @@
"Microsoft.IdentityModel.Protocols.OpenIdConnect": "6.8.0",
"Microsoft.Win32.Registry": "4.7.0",
"System.Configuration.ConfigurationManager": "6.0.0",
"System.Diagnostics.DiagnosticSource": "4.7.1",
"System.Diagnostics.DiagnosticSource": "6.0.0",
"System.Runtime.Caching": "4.7.0",
"System.Security.Principal.Windows": "4.7.0",
"System.Text.Encoding.CodePages": "5.0.0"
@ -217,6 +228,17 @@
}
}
},
"Microsoft.Extensions.Configuration.Binder/6.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "7.0.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.Configuration.Binder.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Configuration.FileExtensions/7.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration": "7.0.0",
@ -247,14 +269,15 @@
}
}
},
"Microsoft.Extensions.DependencyInjection/5.0.0": {
"Microsoft.Extensions.DependencyInjection/6.0.0": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0"
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
},
"runtime": {
"lib/net5.0/Microsoft.Extensions.DependencyInjection.dll": {
"assemblyVersion": "5.0.0.0",
"fileVersion": "5.0.20.51904"
"lib/net6.0/Microsoft.Extensions.DependencyInjection.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
@ -298,37 +321,53 @@
}
}
},
"Microsoft.Extensions.Logging/5.0.0": {
"Microsoft.Extensions.Logging/6.0.0": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "5.0.0",
"Microsoft.Extensions.DependencyInjection": "6.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
"Microsoft.Extensions.Logging.Abstractions": "5.0.0",
"Microsoft.Extensions.Options": "5.0.0"
"Microsoft.Extensions.Logging.Abstractions": "6.0.0",
"Microsoft.Extensions.Options": "6.0.0",
"System.Diagnostics.DiagnosticSource": "6.0.0"
},
"runtime": {
"lib/netstandard2.1/Microsoft.Extensions.Logging.dll": {
"assemblyVersion": "5.0.0.0",
"fileVersion": "5.0.20.51904"
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Logging.Abstractions/5.0.0": {
"Microsoft.Extensions.Logging.Abstractions/6.0.0": {
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.Logging.Abstractions.dll": {
"assemblyVersion": "5.0.0.0",
"fileVersion": "5.0.20.51904"
"lib/net6.0/Microsoft.Extensions.Logging.Abstractions.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.Extensions.Options/5.0.0": {
"Microsoft.Extensions.Logging.Log4Net.AspNetCore/8.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration": "7.0.0",
"Microsoft.Extensions.Configuration.Abstractions": "7.0.0",
"Microsoft.Extensions.Configuration.Binder": "6.0.0",
"Microsoft.Extensions.Logging": "6.0.0",
"log4net": "2.0.15"
},
"runtime": {
"lib/net6.0/Microsoft.Extensions.Logging.Log4Net.AspNetCore.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.0.0.0"
}
}
},
"Microsoft.Extensions.Options/6.0.0": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
"Microsoft.Extensions.Primitives": "7.0.0"
},
"runtime": {
"lib/net5.0/Microsoft.Extensions.Options.dll": {
"assemblyVersion": "5.0.0.0",
"fileVersion": "5.0.20.51904"
"lib/netstandard2.1/Microsoft.Extensions.Options.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
@ -459,11 +498,11 @@
}
}
},
"Newtonsoft.Json/13.0.3": {
"Newtonsoft.Json/13.0.2": {
"runtime": {
"lib/net6.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.3.27908"
"fileVersion": "13.0.2.27524"
}
}
},
@ -491,6 +530,17 @@
}
}
},
"Pipelines.Sockets.Unofficial/2.2.8": {
"dependencies": {
"System.IO.Pipelines": "5.0.1"
},
"runtime": {
"lib/net5.0/Pipelines.Sockets.Unofficial.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "2.2.8.1080"
}
}
},
"SQLitePCLRaw.bundle_e_sqlite3/2.1.4": {
"dependencies": {
"SQLitePCLRaw.lib.e_sqlite3": "2.1.4",
@ -656,12 +706,12 @@
}
}
},
"SqlSugarCore/5.1.4.95": {
"SqlSugarCore/5.1.4.115": {
"dependencies": {
"Microsoft.Data.SqlClient": "2.1.4",
"Microsoft.Data.Sqlite": "7.0.5",
"MySqlConnector": "2.2.5",
"Newtonsoft.Json": "13.0.3",
"Newtonsoft.Json": "13.0.2",
"Npgsql": "5.0.7",
"Oracle.ManagedDataAccess.Core": "3.21.100",
"SqlSugarCore.Dm": "1.2.0",
@ -671,8 +721,8 @@
},
"runtime": {
"lib/netstandard2.1/SqlSugar.dll": {
"assemblyVersion": "5.1.4.94",
"fileVersion": "5.1.4.94"
"assemblyVersion": "5.1.4.115",
"fileVersion": "5.1.4.115"
}
}
},
@ -695,6 +745,18 @@
}
}
},
"StackExchange.Redis/2.7.33": {
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "6.0.0",
"Pipelines.Sockets.Unofficial": "2.2.8"
},
"runtime": {
"lib/net6.0/StackExchange.Redis.dll": {
"assemblyVersion": "2.0.0.0",
"fileVersion": "2.7.33.41805"
}
}
},
"System.Collections/4.3.0": {
"dependencies": {
"Microsoft.NETCore.Platforms": "5.0.0",
@ -740,11 +802,14 @@
}
}
},
"System.Diagnostics.DiagnosticSource/4.7.1": {
"System.Diagnostics.DiagnosticSource/6.0.0": {
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
},
"runtime": {
"lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": {
"assemblyVersion": "4.0.5.0",
"fileVersion": "4.700.20.21406"
"lib/net6.0/System.Diagnostics.DiagnosticSource.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
@ -868,6 +933,14 @@
"System.Threading.Tasks": "4.3.0"
}
},
"System.IO.Pipelines/5.0.1": {
"runtime": {
"lib/netcoreapp3.0/System.IO.Pipelines.dll": {
"assemblyVersion": "5.0.0.1",
"fileVersion": "5.0.120.57516"
}
}
},
"System.Memory/4.5.3": {},
"System.Reflection/4.3.0": {
"dependencies": {
@ -1167,6 +1240,13 @@
"path": "autofac.extensions.dependencyinjection/8.0.0",
"hashPath": "autofac.extensions.dependencyinjection.8.0.0.nupkg.sha512"
},
"AutoMapper/13.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-/Fx1SbJ16qS7dU4i604Sle+U9VLX+WSNVJggk6MupKVkYvvBm4XqYaeFuf67diHefHKHs50uQIS2YEDFhPCakQ==",
"path": "automapper/13.0.1",
"hashPath": "automapper.13.0.1.nupkg.sha512"
},
"DotNetty.Buffers/0.7.5": {
"type": "package",
"serviceable": true,
@ -1265,6 +1345,13 @@
"path": "microsoft.extensions.configuration.abstractions/7.0.0",
"hashPath": "microsoft.extensions.configuration.abstractions.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.Binder/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-b3ErKzND8LIC7o08QAVlKfaEIYEvLJbtmVbFZVBRXeu9YkKfSSzLZfR1SUfQPBIy9mKLhEtJgGYImkcMNaKE0A==",
"path": "microsoft.extensions.configuration.binder/6.0.0",
"hashPath": "microsoft.extensions.configuration.binder.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.FileExtensions/7.0.0": {
"type": "package",
"serviceable": true,
@ -1279,12 +1366,12 @@
"path": "microsoft.extensions.configuration.json/7.0.0",
"hashPath": "microsoft.extensions.configuration.json.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.DependencyInjection/5.0.0": {
"Microsoft.Extensions.DependencyInjection/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Rc2kb/p3Ze6cP6rhFC3PJRdWGbLvSHZc0ev7YlyeU6FmHciDMLrhoVoTUEzKPhN5ZjFgKF1Cf5fOz8mCMIkvpA==",
"path": "microsoft.extensions.dependencyinjection/5.0.0",
"hashPath": "microsoft.extensions.dependencyinjection.5.0.0.nupkg.sha512"
"sha512": "sha512-k6PWQMuoBDGGHOQTtyois2u4AwyVcIwL2LaSLlTZQm2CYcJ1pxbt6jfAnpWmzENA/wfrYRI/X9DTLoUkE4AsLw==",
"path": "microsoft.extensions.dependencyinjection/6.0.0",
"hashPath": "microsoft.extensions.dependencyinjection.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.DependencyInjection.Abstractions/6.0.0": {
"type": "package",
@ -1314,26 +1401,33 @@
"path": "microsoft.extensions.filesystemglobbing/7.0.0",
"hashPath": "microsoft.extensions.filesystemglobbing.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Logging/5.0.0": {
"Microsoft.Extensions.Logging/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-MgOwK6tPzB6YNH21wssJcw/2MKwee8b2gI7SllYfn6rvTpIrVvVS5HAjSU2vqSku1fwqRvWP0MdIi14qjd93Aw==",
"path": "microsoft.extensions.logging/5.0.0",
"hashPath": "microsoft.extensions.logging.5.0.0.nupkg.sha512"
"sha512": "sha512-eIbyj40QDg1NDz0HBW0S5f3wrLVnKWnDJ/JtZ+yJDFnDj90VoPuoPmFkeaXrtu+0cKm5GRAwoDf+dBWXK0TUdg==",
"path": "microsoft.extensions.logging/6.0.0",
"hashPath": "microsoft.extensions.logging.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Logging.Abstractions/5.0.0": {
"Microsoft.Extensions.Logging.Abstractions/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-NxP6ahFcBnnSfwNBi2KH2Oz8Xl5Sm2krjId/jRR3I7teFphwiUoUeZPwTNA21EX+5PtjqmyAvKaOeBXcJjcH/w==",
"path": "microsoft.extensions.logging.abstractions/5.0.0",
"hashPath": "microsoft.extensions.logging.abstractions.5.0.0.nupkg.sha512"
"sha512": "sha512-/HggWBbTwy8TgebGSX5DBZ24ndhzi93sHUBDvP1IxbZD7FDokYzdAr6+vbWGjw2XAfR2EJ1sfKUotpjHnFWPxA==",
"path": "microsoft.extensions.logging.abstractions/6.0.0",
"hashPath": "microsoft.extensions.logging.abstractions.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Options/5.0.0": {
"Microsoft.Extensions.Logging.Log4Net.AspNetCore/8.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-CBvR92TCJ5uBIdd9/HzDSrxYak+0W/3+yxrNg8Qm6Bmrkh5L+nu6m3WeazQehcZ5q1/6dDA7J5YdQjim0165zg==",
"path": "microsoft.extensions.options/5.0.0",
"hashPath": "microsoft.extensions.options.5.0.0.nupkg.sha512"
"sha512": "sha512-NShPLGSM/PBGJIOK/cmlh3a+QlrtCLcSpb+vfqwxRmZK38Cy4prsOjuODpAIvqWL93zt9PZOTcHOVqyaQRNuEg==",
"path": "microsoft.extensions.logging.log4net.aspnetcore/8.0.0",
"hashPath": "microsoft.extensions.logging.log4net.aspnetcore.8.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Options/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-dzXN0+V1AyjOe2xcJ86Qbo233KHuLEY0njf/P2Kw8SfJU+d45HNS2ctJdnEnrWbM9Ye2eFgaC5Mj9otRMU6IsQ==",
"path": "microsoft.extensions.options/6.0.0",
"hashPath": "microsoft.extensions.options.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Primitives/7.0.0": {
"type": "package",
@ -1419,12 +1513,12 @@
"path": "mysqlconnector/2.2.5",
"hashPath": "mysqlconnector.2.2.5.nupkg.sha512"
},
"Newtonsoft.Json/13.0.3": {
"Newtonsoft.Json/13.0.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==",
"path": "newtonsoft.json/13.0.3",
"hashPath": "newtonsoft.json.13.0.3.nupkg.sha512"
"sha512": "sha512-R2pZ3B0UjeyHShm9vG+Tu0EBb2lC8b0dFzV9gVn50ofHXh9Smjk6kTn7A/FdAsC8B5cKib1OnGYOXxRBz5XQDg==",
"path": "newtonsoft.json/13.0.2",
"hashPath": "newtonsoft.json.13.0.2.nupkg.sha512"
},
"Npgsql/5.0.7": {
"type": "package",
@ -1440,6 +1534,13 @@
"path": "oracle.manageddataaccess.core/3.21.100",
"hashPath": "oracle.manageddataaccess.core.3.21.100.nupkg.sha512"
},
"Pipelines.Sockets.Unofficial/2.2.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-zG2FApP5zxSx6OcdJQLbZDk2AVlN2BNQD6MorwIfV6gVj0RRxWPEp2LXAxqDGZqeNV1Zp0BNPcNaey/GXmTdvQ==",
"path": "pipelines.sockets.unofficial/2.2.8",
"hashPath": "pipelines.sockets.unofficial.2.2.8.nupkg.sha512"
},
"SQLitePCLRaw.bundle_e_sqlite3/2.1.4": {
"type": "package",
"serviceable": true,
@ -1475,12 +1576,12 @@
"path": "sqlsugar.ioc/2.0.0",
"hashPath": "sqlsugar.ioc.2.0.0.nupkg.sha512"
},
"SqlSugarCore/5.1.4.95": {
"SqlSugarCore/5.1.4.115": {
"type": "package",
"serviceable": true,
"sha512": "sha512-7+xQXOZhe0dHplO6AJC3V9VAcO7XPhprrgpjMsrj+LUUJ/k1yVrbag8vHVFZyPyC3PfvHTcpJsepuTJMruUPEw==",
"path": "sqlsugarcore/5.1.4.95",
"hashPath": "sqlsugarcore.5.1.4.95.nupkg.sha512"
"sha512": "sha512-D/1b4vxR0rECaRsIDqk3tkkAwf7wEEkO1+VAAnHLECu5mbPESS6T5o+l/DCDvdWDgD0koCHgKhlU1c/SYR9Sig==",
"path": "sqlsugarcore/5.1.4.115",
"hashPath": "sqlsugarcore.5.1.4.115.nupkg.sha512"
},
"SqlSugarCore.Dm/1.2.0": {
"type": "package",
@ -1496,6 +1597,13 @@
"path": "sqlsugarcore.kdbndp/7.4.0",
"hashPath": "sqlsugarcore.kdbndp.7.4.0.nupkg.sha512"
},
"StackExchange.Redis/2.7.33": {
"type": "package",
"serviceable": true,
"sha512": "sha512-2kCX5fvhEE824a4Ab5Imyi8DRuGuTxyklXV01kegkRpsWJcPmO6+GAQ+HegKxvXAxlXZ8yaRspvWJ8t3mMClfQ==",
"path": "stackexchange.redis/2.7.33",
"hashPath": "stackexchange.redis.2.7.33.nupkg.sha512"
},
"System.Collections/4.3.0": {
"type": "package",
"serviceable": true,
@ -1524,12 +1632,12 @@
"path": "system.data.common/4.3.0",
"hashPath": "system.data.common.4.3.0.nupkg.sha512"
},
"System.Diagnostics.DiagnosticSource/4.7.1": {
"System.Diagnostics.DiagnosticSource/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-j81Lovt90PDAq8kLpaJfJKV/rWdWuEk6jfV+MBkee33vzYLEUsy4gXK8laa9V2nZlLM9VM9yA/OOQxxPEJKAMw==",
"path": "system.diagnostics.diagnosticsource/4.7.1",
"hashPath": "system.diagnostics.diagnosticsource.4.7.1.nupkg.sha512"
"sha512": "sha512-frQDfv0rl209cKm1lnwTgFPzNigy2EKk1BS3uAvHvlBVKe5cymGyHO+Sj+NLv5VF/AhHsqPIUUwya5oV4CHMUw==",
"path": "system.diagnostics.diagnosticsource/6.0.0",
"hashPath": "system.diagnostics.diagnosticsource.6.0.0.nupkg.sha512"
},
"System.Diagnostics.PerformanceCounter/6.0.1": {
"type": "package",
@ -1580,6 +1688,13 @@
"path": "system.io/4.3.0",
"hashPath": "system.io.4.3.0.nupkg.sha512"
},
"System.IO.Pipelines/5.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-qEePWsaq9LoEEIqhbGe6D5J8c9IqQOUuTzzV6wn1POlfdLkJliZY3OlB0j0f17uMWlqZYjH7txj+2YbyrIA8Yg==",
"path": "system.io.pipelines/5.0.1",
"hashPath": "system.io.pipelines.5.0.1.nupkg.sha512"
},
"System.Memory/4.5.3": {
"type": "package",
"serviceable": true,

@ -12,9 +12,9 @@
}
],
"additionalProbingPaths": [
"C:\\Users\\CZ\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\CZ\\.nuget\\packages",
"D:\\vs2019\\共享组件\\NuGetPackages"
"C:\\Users\\Administrator\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Administrator\\.nuget\\packages",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configProperties": {
"Microsoft.NETCore.DotNetHostPolicy.SetAppPaths": true

@ -1,7 +1,10 @@
using System.Windows;
using System;
using System.IO;
using System.Windows;
using Autofac;
using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Configuration;
using log4net.Config;
using SqlSugar;
using SqlSugar.IOC;
@ -14,6 +17,7 @@ public partial class App : Application
{
public App()
{
XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + @"\log4net.config"));
var cb = new ContainerBuilder();
cb.Register(c =>
{
@ -50,4 +54,4 @@ public partial class App : Application
var mainWindow = AppInfo.Container.Resolve<MainWindow>();
mainWindow.Show();
}
}
}

@ -16,7 +16,7 @@
</ItemGroup>
<ItemGroup>
<None Update="log4net.xml">
<None Update="log4net.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="appsettings.json">

Loading…
Cancel
Save