zoule 8 月之前
父节点
当前提交
12102f5659

+ 1 - 11
Service/CgDbScan/Program.cs

@@ -85,17 +85,7 @@ namespace CheckServer
         [STAThread]
         [STAThread]
         static void Main(string[] args)
         static void Main(string[] args)
         {
         {
-            string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
-            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
-                .WriteTo.Console(outputTemplate: outputTemplate)
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Information)
-                    .WriteTo.File("Logs\\Info\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Warning)
-                    .WriteTo.File("Logs\\Warning\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Error)
-                    .WriteTo.File("Logs\\Error\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
-                .CreateLogger();
-           
+            XdCxRhDW.Framework.SerilogHelper.BuildLogger();
             if (IsRunningAsAdmin())
             if (IsRunningAsAdmin())
             {
             {
                 MainForm mainForm = new MainForm();
                 MainForm mainForm = new MainForm();

+ 1 - 11
Service/CheckServer/Program.cs

@@ -85,17 +85,7 @@ namespace CheckServer
         [STAThread]
         [STAThread]
         static void Main(string[] args)
         static void Main(string[] args)
         {
         {
-            string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
-            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
-                .WriteTo.Console(outputTemplate: outputTemplate)
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Information)
-                    .WriteTo.File("Logs\\Info\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Warning)
-                    .WriteTo.File("Logs\\Warning\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Error)
-                    .WriteTo.File("Logs\\Error\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
-                .CreateLogger();
-
+            XdCxRhDW.Framework.SerilogHelper.BuildLogger();
             if (IsRunningAsAdmin())
             if (IsRunningAsAdmin())
             {
             {
                 MainForm mainForm = new MainForm();
                 MainForm mainForm = new MainForm();

+ 1 - 11
Service/CpuCgServer/Program.cs

@@ -85,17 +85,7 @@ namespace CpuCgServer
         [STAThread]
         [STAThread]
         static void Main(string[] args)
         static void Main(string[] args)
         {
         {
-            string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
-            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
-                .WriteTo.Console(outputTemplate: outputTemplate)
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Information)
-                    .WriteTo.File("Logs\\Info\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Warning)
-                    .WriteTo.File("Logs\\Warning\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Error)
-                    .WriteTo.File("Logs\\Error\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
-                .CreateLogger();
-         
+            XdCxRhDW.Framework.SerilogHelper.BuildLogger();
             if (IsRunningAsAdmin())
             if (IsRunningAsAdmin())
             {
             {
                 MainForm mainForm = new MainForm();
                 MainForm mainForm = new MainForm();

+ 1 - 11
Service/GpuCgServer/Program.cs

@@ -85,17 +85,7 @@ namespace GpuCgServer
         [STAThread]
         [STAThread]
         static void Main(string[] args)
         static void Main(string[] args)
         {
         {
-            string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
-            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
-                .WriteTo.Console(outputTemplate: outputTemplate)
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Information)
-                    .WriteTo.File("Logs\\Info\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Warning)
-                    .WriteTo.File("Logs\\Warning\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Error)
-                    .WriteTo.File("Logs\\Error\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
-                .CreateLogger();
-
+            XdCxRhDW.Framework.SerilogHelper.BuildLogger();
             if (IsRunningAsAdmin())
             if (IsRunningAsAdmin())
             {
             {
                 MainForm mainForm = new MainForm();
                 MainForm mainForm = new MainForm();

+ 1 - 11
Service/X1LeoTaskServer54/Program.cs

@@ -108,17 +108,7 @@ namespace X1LeoTaskServer54
         [STAThread]
         [STAThread]
         static void Main()
         static void Main()
         {
         {
-            string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
-            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
-                .WriteTo.Console(outputTemplate: outputTemplate)
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Information)
-                    .WriteTo.File("Logs\\Info\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Warning)
-                    .WriteTo.File("Logs\\Warning\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Error)
-                    .WriteTo.File("Logs\\Error\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
-                .CreateLogger();
-
+            XdCxRhDW.Framework.SerilogHelper.BuildLogger();
             if (IsRunningAsAdmin())
             if (IsRunningAsAdmin())
             {
             {
                 MainForm mainForm = new MainForm();
                 MainForm mainForm = new MainForm();

+ 1 - 11
Service/X2D1TaskServer/Program.cs

@@ -81,17 +81,7 @@ namespace X2D1TaskServer54
         [STAThread]
         [STAThread]
         static void Main(string[] args)
         static void Main(string[] args)
         {
         {
-            string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
-            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
-                .WriteTo.Console(outputTemplate: outputTemplate)
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Information)
-                    .WriteTo.File("Logs\\Info\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Warning)
-                    .WriteTo.File("Logs\\Warning\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Error)
-                    .WriteTo.File("Logs\\Error\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
-                .CreateLogger();
-
+            XdCxRhDW.Framework.SerilogHelper.BuildLogger();
             if (IsRunningAsAdmin())
             if (IsRunningAsAdmin())
             {
             {
                 MainForm mainForm = new MainForm();
                 MainForm mainForm = new MainForm();

+ 1 - 11
Service/X2D1TaskServer54/Program.cs

@@ -108,17 +108,7 @@ namespace X2D1NoRefTaskServer54
         [STAThread]
         [STAThread]
         static void Main()
         static void Main()
         {
         {
-            string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
-            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
-                .WriteTo.Console(outputTemplate: outputTemplate)
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Information)
-                    .WriteTo.File("Logs\\Info\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Warning)
-                    .WriteTo.File("Logs\\Warning\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Error)
-                    .WriteTo.File("Logs\\Error\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
-                .CreateLogger();
-
+            XdCxRhDW.Framework.SerilogHelper.BuildLogger();
             if (IsRunningAsAdmin())
             if (IsRunningAsAdmin())
             {
             {
                 MainForm mainForm = new MainForm();
                 MainForm mainForm = new MainForm();

+ 1 - 11
Service/X2LeoTaskServer54/Program.cs

@@ -108,17 +108,7 @@ namespace X2LeoTaskServer54
         [STAThread]
         [STAThread]
         static void Main()
         static void Main()
         {
         {
-            string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
-            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
-                .WriteTo.Console(outputTemplate: outputTemplate)
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Information)
-                    .WriteTo.File("Logs\\Info\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Warning)
-                    .WriteTo.File("Logs\\Warning\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Error)
-                    .WriteTo.File("Logs\\Error\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
-                .CreateLogger();
-
+            XdCxRhDW.Framework.SerilogHelper.BuildLogger();
             if (IsRunningAsAdmin())
             if (IsRunningAsAdmin())
             {
             {
                 MainForm mainForm = new MainForm();
                 MainForm mainForm = new MainForm();

+ 1 - 11
Service/X3Leo1TaskServer54/Program.cs

@@ -81,17 +81,7 @@ namespace X3Leo1TaskServer54
         [STAThread]
         [STAThread]
         static void Main(string[] args)
         static void Main(string[] args)
         {
         {
-            string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
-            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
-                .WriteTo.Console(outputTemplate: outputTemplate)
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Information)
-                    .WriteTo.File("Logs\\Info\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Warning)
-                    .WriteTo.File("Logs\\Warning\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Error)
-                    .WriteTo.File("Logs\\Error\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
-                .CreateLogger();
-
+            XdCxRhDW.Framework.SerilogHelper.BuildLogger();
             if (IsRunningAsAdmin())
             if (IsRunningAsAdmin())
             {
             {
                 MainForm mainForm = new MainForm();
                 MainForm mainForm = new MainForm();

+ 1 - 11
Service/X3LeoTaskServer54/Program.cs

@@ -108,17 +108,7 @@ namespace X3LeoTaskServer54
         [STAThread]
         [STAThread]
         static void Main()
         static void Main()
         {
         {
-            string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
-            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
-                .WriteTo.Console(outputTemplate: outputTemplate)
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Information)
-                    .WriteTo.File("Logs\\Info\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Warning)
-                    .WriteTo.File("Logs\\Warning\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Error)
-                    .WriteTo.File("Logs\\Error\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
-                .CreateLogger();
-
+            XdCxRhDW.Framework.SerilogHelper.BuildLogger();
             if (IsRunningAsAdmin())
             if (IsRunningAsAdmin())
             {
             {
                 MainForm mainForm = new MainForm();
                 MainForm mainForm = new MainForm();

+ 1 - 11
Service/X3RefTaskServer54/Program.cs

@@ -81,17 +81,7 @@ namespace X3RefTaskServer54
         [STAThread]
         [STAThread]
         static void Main(string[] args)
         static void Main(string[] args)
         {
         {
-            string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
-            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
-                .WriteTo.Console(outputTemplate: outputTemplate)
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Information)
-                    .WriteTo.File("Logs\\Info\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Warning)
-                    .WriteTo.File("Logs\\Warning\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Error)
-                    .WriteTo.File("Logs\\Error\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
-                .CreateLogger();
-
+            XdCxRhDW.Framework.SerilogHelper.BuildLogger();
             if (IsRunningAsAdmin())
             if (IsRunningAsAdmin())
             {
             {
                 MainForm mainForm = new MainForm();
                 MainForm mainForm = new MainForm();

+ 1 - 11
Service/X3TaskServer54/Program.cs

@@ -108,17 +108,7 @@ namespace X3TaskServer54
         [STAThread]
         [STAThread]
         static void Main()
         static void Main()
         {
         {
-            string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
-            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
-                .WriteTo.Console(outputTemplate: outputTemplate)
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Information)
-                    .WriteTo.File("Logs\\Info\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Warning)
-                    .WriteTo.File("Logs\\Warning\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Error)
-                    .WriteTo.File("Logs\\Error\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
-                .CreateLogger();
-
+            XdCxRhDW.Framework.SerilogHelper.BuildLogger();
             if (IsRunningAsAdmin())
             if (IsRunningAsAdmin())
             {
             {
                 MainForm mainForm = new MainForm();
                 MainForm mainForm = new MainForm();

+ 35 - 21
XdCxRhDW.App/EditForms/X3DTOParamEditor.cs

@@ -83,7 +83,7 @@ namespace XdCxRhDW.App.EditForms
                 var adja2Eph = (cg.Adja2X, cg.Adja2Y, cg.Adja2Z);
                 var adja2Eph = (cg.Adja2X, cg.Adja2Y, cg.Adja2Z);
                 ucEphXYZAdja2.SetXYZ($"邻星2", cg.Adja2Code, adja2Eph, Color.Black);
                 ucEphXYZAdja2.SetXYZ($"邻星2", cg.Adja2Code, adja2Eph, Color.Black);
 
 
-              
+
 
 
             }
             }
             if (station != null)
             if (station != null)
@@ -95,10 +95,10 @@ namespace XdCxRhDW.App.EditForms
             }
             }
             if (info.PosResType != EnumPosResType.X3TwoDto)
             if (info.PosResType != EnumPosResType.X3TwoDto)
             {
             {
-                txtYbMain.Properties.ReadOnly = true;
-                txtYbAdja.Properties.ReadOnly = true;
-                txtYbAdja1.Properties.ReadOnly = true;
-                txtRefLocation.Properties.ReadOnly = true;
+                //txtYbMain.Properties.ReadOnly = true;
+                //txtYbAdja.Properties.ReadOnly = true;
+                //txtYbAdja1.Properties.ReadOnly = true;
+                //txtRefLocation.Properties.ReadOnly = true;
                 this.txtRefLocation.Text = $"{0},{0}";
                 this.txtRefLocation.Text = $"{0},{0}";
             }
             }
 
 
@@ -111,7 +111,7 @@ namespace XdCxRhDW.App.EditForms
             {
             {
                 return false;
                 return false;
             }
             }
-            if (info.PosResType == EnumPosResType.X3TwoDto && !txtRefLocation.CheckLonLat(dxErrorProvider, "参考站"))
+            if (!string.IsNullOrWhiteSpace(txtRefLocation.Text) && !txtRefLocation.CheckLonLat(dxErrorProvider, "参考站"))
             {
             {
                 return false;
                 return false;
             }
             }
@@ -123,15 +123,15 @@ namespace XdCxRhDW.App.EditForms
             {
             {
                 return false;
                 return false;
             }
             }
-            if (info.PosResType == EnumPosResType.X3TwoDto && !txtYbMain.CheckDouble(dxErrorProvider, "样本主星时差"))
+            if (!string.IsNullOrWhiteSpace(txtYbMain.Text) && !txtYbMain.CheckDouble(dxErrorProvider, "样本主星时差"))
             {
             {
                 return false;
                 return false;
             }
             }
-            if (info.PosResType == EnumPosResType.X3TwoDto && !txtYbAdja.CheckDouble(dxErrorProvider, "样本邻星1时差"))
+            if (!string.IsNullOrWhiteSpace(txtYbAdja.Text) && !txtYbAdja.CheckDouble(dxErrorProvider, "样本邻星1时差"))
             {
             {
                 return false;
                 return false;
             }
             }
-            if (info.PosResType == EnumPosResType.X3TwoDto && !txtYbAdja1.CheckDouble(dxErrorProvider, "样本邻星2时差"))
+            if (!string.IsNullOrWhiteSpace(txtYbAdja1.Text) && !txtYbAdja1.CheckDouble(dxErrorProvider, "样本邻星2时差"))
             {
             {
                 return false;
                 return false;
             }
             }
@@ -160,14 +160,13 @@ namespace XdCxRhDW.App.EditForms
                 var MsAnt = txtsatStation1.GetLonLat();
                 var MsAnt = txtsatStation1.GetLonLat();
                 var Ns1Ant = txtsatStation2.GetLonLat();
                 var Ns1Ant = txtsatStation2.GetLonLat();
                 var Ns2Ant = txtsatStation3.GetLonLat();
                 var Ns2Ant = txtsatStation3.GetLonLat();
-                var RefGeod = info.PosResType == EnumPosResType.X3TwoDto ? txtRefLocation.GetLonLat() : new double[3] { 0, 0, 0 };
+                var RefGeod = string.IsNullOrWhiteSpace(txtRefLocation.Text) ? new double[3] { 0, 0, 0 } : txtRefLocation.GetLonLat();
 
 
                 var DtoSx = Convert.ToDouble(this.txtDtoSx.Text);
                 var DtoSx = Convert.ToDouble(this.txtDtoSx.Text);
                 var DtoSx1 = Convert.ToDouble(this.txtDtoSx1.Text);
                 var DtoSx1 = Convert.ToDouble(this.txtDtoSx1.Text);
-                var YbMainDto = info.PosResType == EnumPosResType.X3TwoDto ? Convert.ToDouble(this.txtYbMain.Text) : 0;
-                var YbAdja1Dto = info.PosResType == EnumPosResType.X3TwoDto ? Convert.ToDouble(this.txtYbAdja.Text) : 0;
-                var YbAdja2Dto = info.PosResType == EnumPosResType.X3TwoDto ? Convert.ToDouble(this.txtYbAdja1.Text) : 0;
-
+                var YbMainDto = string.IsNullOrWhiteSpace(txtYbMain.Text) ? 0 : Convert.ToDouble(this.txtYbMain.Text);
+                var YbAdja1Dto = string.IsNullOrWhiteSpace(txtYbAdja.Text) ? 0 : Convert.ToDouble(this.txtYbAdja.Text);
+                var YbAdja2Dto = string.IsNullOrWhiteSpace(txtYbAdja1.Text) ? 0 : Convert.ToDouble(this.txtYbAdja1.Text);
 
 
                 double[] msEph = ucEphXYZMain.EphXYZ();
                 double[] msEph = ucEphXYZMain.EphXYZ();
                 double[] Ns1Eph = ucEphXYZAdja1.EphXYZ();
                 double[] Ns1Eph = ucEphXYZAdja1.EphXYZ();
@@ -190,7 +189,10 @@ namespace XdCxRhDW.App.EditForms
                 if (string.IsNullOrWhiteSpace(nsat)) nsat = cg.Adja1Code.Value.ToString();
                 if (string.IsNullOrWhiteSpace(nsat)) nsat = cg.Adja1Code.Value.ToString();
                 var ad2sat = listSat.FirstOrDefault(m => m.SatCode == cg.Adja2Code.Value)?.Sat;
                 var ad2sat = listSat.FirstOrDefault(m => m.SatCode == cg.Adja2Code.Value)?.Sat;
                 if (string.IsNullOrWhiteSpace(ad2sat)) ad2sat = cg.Adja2Code.Value.ToString();
                 if (string.IsNullOrWhiteSpace(ad2sat)) ad2sat = cg.Adja2Code.Value.ToString();
-                if (info.PosResType == EnumPosResType.X3TwoDto)
+                if (!string.IsNullOrWhiteSpace(txtRefLocation.Text)
+                  && !string.IsNullOrWhiteSpace(txtYbMain.Text)
+                  && !string.IsNullOrWhiteSpace(txtYbAdja.Text)
+                  && !string.IsNullOrWhiteSpace(txtYbAdja1.Text))
                 {
                 {
                     var tsDtoLine = DrawDtoLineHelper.DtoLine2XStart(twoStartOption);
                     var tsDtoLine = DrawDtoLineHelper.DtoLine2XStart(twoStartOption);
                     mapControl1.DrawDtoLine($"[{msat},{nsat}]带参时差线", tsDtoLine);
                     mapControl1.DrawDtoLine($"[{msat},{nsat}]带参时差线", tsDtoLine);
@@ -283,14 +285,14 @@ namespace XdCxRhDW.App.EditForms
                 var MsAnt = txtsatStation1.GetLonLat();
                 var MsAnt = txtsatStation1.GetLonLat();
                 var Ns1Ant = txtsatStation2.GetLonLat();
                 var Ns1Ant = txtsatStation2.GetLonLat();
                 var Ns2Ant = txtsatStation3.GetLonLat();
                 var Ns2Ant = txtsatStation3.GetLonLat();
-                var RefGeod = info.PosResType == EnumPosResType.X3TwoDto ? txtRefLocation.GetLonLat() : new double[3] { 0, 0, 0 };
+                var RefGeod = string.IsNullOrWhiteSpace(txtRefLocation.Text) ? new double[3] { 0, 0, 0 } : txtRefLocation.GetLonLat();
 
 
                 var sigTime = this.sigTime.DateTime;
                 var sigTime = this.sigTime.DateTime;
                 var DtoSx = Convert.ToDouble(this.txtDtoSx.Text);
                 var DtoSx = Convert.ToDouble(this.txtDtoSx.Text);
                 var DtoSx1 = Convert.ToDouble(this.txtDtoSx1.Text);
                 var DtoSx1 = Convert.ToDouble(this.txtDtoSx1.Text);
-                var YbMainDto = info.PosResType == EnumPosResType.X3TwoDto ? Convert.ToDouble(this.txtYbMain.Text) : 0;
-                var YbAdja1Dto = info.PosResType == EnumPosResType.X3TwoDto ? Convert.ToDouble(this.txtYbAdja.Text) : 0;
-                var YbAdja2Dto = info.PosResType == EnumPosResType.X3TwoDto ? Convert.ToDouble(this.txtYbAdja1.Text) : 0;
+                var YbMainDto = string.IsNullOrWhiteSpace(txtYbMain.Text) ? 0 : Convert.ToDouble(this.txtYbMain.Text);
+                var YbAdja1Dto = string.IsNullOrWhiteSpace(txtYbAdja.Text) ? 0 : Convert.ToDouble(this.txtYbAdja.Text);
+                var YbAdja2Dto = string.IsNullOrWhiteSpace(txtYbAdja1.Text) ? 0 : Convert.ToDouble(this.txtYbAdja1.Text);
 
 
                 double[] msEph = ucEphXYZMain.EphXYZ();
                 double[] msEph = ucEphXYZMain.EphXYZ();
                 double[] Ns1Eph = ucEphXYZAdja1.EphXYZ();
                 double[] Ns1Eph = ucEphXYZAdja1.EphXYZ();
@@ -327,8 +329,20 @@ namespace XdCxRhDW.App.EditForms
                     Adja2Y = Ns2Eph[1],
                     Adja2Y = Ns2Eph[1],
                     Adja2Z = Ns2Eph[2],
                     Adja2Z = Ns2Eph[2],
                 };
                 };
-                var res = info.PosResType == EnumPosResType.X3TwoDto ? PosApi.X3_Pos(cgRes, StationRes) : PosApi.X3_PosNoRef(cgRes, StationRes);
-                this.txtPosRes.Text = $"{info.PosResType.GetEnumDisplayName()}定位点:[{res[0]:f4},{res[1]:f4}] 镜像点:[{res[3]:f4},{res[4]:f4}]";
+                if (!string.IsNullOrWhiteSpace(txtRefLocation.Text)
+                    && !string.IsNullOrWhiteSpace(txtYbMain.Text)
+                    && !string.IsNullOrWhiteSpace(txtYbAdja.Text)
+                    && !string.IsNullOrWhiteSpace(txtYbAdja1.Text))
+                {
+                    var res = PosApi.X3_Pos(cgRes, StationRes);
+                    this.txtPosRes.Text = $"带参定位点:[{res[0]:f4},{res[1]:f4}] 镜像点:[{res[3]:f4},{res[4]:f4}]";
+                }
+                else
+                {
+                    var res = PosApi.X3_PosNoRef(cgRes, StationRes);
+                    this.txtPosRes.Text = $"无参定位点:[{res[0]:f4},{res[1]:f4}] 镜像点:[{res[3]:f4},{res[4]:f4}]";
+                }
+
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {

+ 1 - 11
XdCxRhDW.App/Program.cs

@@ -115,17 +115,7 @@ namespace XdCxRhDW
         [STAThread]
         [STAThread]
         static void Main()
         static void Main()
        {
        {
-            string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
-            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
-                .WriteTo.Console(outputTemplate: outputTemplate)
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Information)
-                    .WriteTo.File("Logs\\Info\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Warning)
-                    .WriteTo.File("Logs\\Warning\\.log", rollingInterval: Serilog.RollingInterval.Day))
-                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Error)
-                    .WriteTo.File("Logs\\Error\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
-                .CreateLogger();
-
+            XdCxRhDW.Framework.SerilogHelper.BuildLogger();
             WindowsFormsSettings.AllowDpiScale = true;
             WindowsFormsSettings.AllowDpiScale = true;
             WindowsFormsSettings.AllowHoverAnimation = DevExpress.Utils.DefaultBoolean.True;
             WindowsFormsSettings.AllowHoverAnimation = DevExpress.Utils.DefaultBoolean.True;
             WindowsFormsSettings.AllowDefaultSvgImages = DevExpress.Utils.DefaultBoolean.True;
             WindowsFormsSettings.AllowDefaultSvgImages = DevExpress.Utils.DefaultBoolean.True;

+ 68 - 0
XdCxRhDW.Framework/SerilogHelper.cs

@@ -0,0 +1,68 @@
+using Serilog;
+using Serilog.Core;
+using Serilog.Events;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace XdCxRhDW.Framework
+{
+    public static class SerilogHelper
+    {
+        public static void BuildLogger(bool usePID = true)
+        {
+            string outputTemplate;
+            if (usePID)
+                outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff}[线程={ThreadId}][PID={PID}][{Level:u3}]{Message:lj}{NewLine}\t{Exception}";
+            else
+                outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff}[线程={ThreadId}][{Level:u3}]{Message:lj}{NewLine}\t{Exception}";
+            Serilog.Log.Logger = new Serilog.LoggerConfiguration()
+                .Enrich.FromLogContext()
+                .Enrich.With(new SerilogEnricher(usePID))
+                .WriteTo.Console(outputTemplate: outputTemplate)
+                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Information)
+                    .WriteTo.File("Logs\\Info\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
+                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Warning)
+                    .WriteTo.File("Logs\\Warning\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
+                .WriteTo.Logger(p => p.Filter.ByIncludingOnly(e => e.Level == Serilog.Events.LogEventLevel.Error)
+                    .WriteTo.File("Logs\\Error\\.log", rollingInterval: Serilog.RollingInterval.Day, outputTemplate: outputTemplate))
+                .CreateLogger();
+        }
+    }
+    /// <summary>
+    /// Serilog日志添加线程ID
+    /// </summary>
+    public class SerilogEnricher : ILogEventEnricher
+    {
+        private bool useProcessId;
+        private string PID;
+        public SerilogEnricher(bool useProcessId = false)
+        {
+            this.useProcessId = useProcessId;
+            if (useProcessId)
+            {
+                this.PID = Process.GetCurrentProcess().Id.ToString("D5");
+            }
+        }
+        /// <summary>
+        /// 在日志中添加线程ID
+        /// </summary>
+        /// <param name="logEvent"></param>
+        /// <param name="propertyFactory"></param>
+        public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
+        {
+            logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty(
+              "ThreadId", Thread.CurrentThread.ManagedThreadId.ToString("D3")));
+            if (useProcessId)
+            {
+                logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("PID", PID));
+            }
+
+        }
+
+    }
+}