zoulei 1 жил өмнө
parent
commit
c61a662e46

BIN
Database.db


+ 104 - 102
XdCxRhDW.App/App.config

@@ -1,105 +1,107 @@
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
-  <configSections>
-    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
-    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
-    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System">
-      <section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
-    </sectionGroup>
-  </configSections>
-  <applicationSettings>
-    <DevExpress.LookAndFeel.Design.AppSettings>
-      <setting name="DefaultAppSkin" serializeAs="String">
-        <value>CompactSkin/WXI</value>
-      </setting>
-      <setting name="DefaultPalette" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="TouchUI" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="CompactUI" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="TouchScaleFactor" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="DirectX" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="RegisterUserSkins" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="RegisterBonusSkins" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="FontBehavior" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="DefaultAppFont" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="DPIAwarenessMode" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="CustomPaletteCollection" serializeAs="Xml">
-        <value />
-      </setting>
-    </DevExpress.LookAndFeel.Design.AppSettings>
-  </applicationSettings>
-  <startup>
-    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
-  </startup>
-  <entityFramework>
-    <providers>
-      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
-      <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
-      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
-    </providers>
-  </entityFramework>
-  <system.data>
-    <DbProviderFactories>
-      <remove invariant="System.Data.SQLite.EF6" />
-      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
-      <remove invariant="System.Data.SQLite" />
-      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
-    </DbProviderFactories>
-  </system.data>
-  <connectionStrings>
-    <add name="DbCon" connectionString="Data Source=|DataDirectory|\Database.db" providerName="System.Data.SQLite.EF6" />
-  </connectionStrings>
-  <appSettings>
-    <!--程序标题-->
-    <add key="SystemName" value="多模式融合定位平台" />
-    <!--公司名称(没有则不会显示版权)-->
-    <add key="Company" value="" />
-  </appSettings>
-  <runtime>
-    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
-      <dependentAssembly>
-        <assemblyIdentity name="System.Web.Cors" publicKeyToken="31bf3856ad364e35" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
-      </dependentAssembly>
-    </assemblyBinding>
-  </runtime>
+	<configSections>
+		<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+		<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+		<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System">
+			<section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+		</sectionGroup>
+	</configSections>
+	<applicationSettings>
+		<DevExpress.LookAndFeel.Design.AppSettings>
+			<setting name="DefaultAppSkin" serializeAs="String">
+				<value>CompactSkin/WXI</value>
+			</setting>
+			<setting name="DefaultPalette" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="TouchUI" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="CompactUI" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="TouchScaleFactor" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="DirectX" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="RegisterUserSkins" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="RegisterBonusSkins" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="FontBehavior" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="DefaultAppFont" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="DPIAwarenessMode" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="CustomPaletteCollection" serializeAs="Xml">
+				<value />
+			</setting>
+		</DevExpress.LookAndFeel.Design.AppSettings>
+	</applicationSettings>
+	<startup>
+		<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
+	</startup>
+	<entityFramework>
+		<providers>
+			<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+			<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
+			<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
+		</providers>
+	</entityFramework>
+	<system.data>
+		<DbProviderFactories>
+			<remove invariant="System.Data.SQLite.EF6" />
+			<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
+			<remove invariant="System.Data.SQLite" />
+			<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
+		</DbProviderFactories>
+	</system.data>
+	<connectionStrings>
+		<add name="DbCon" connectionString="Data Source=|DataDirectory|\Database.db" providerName="System.Data.SQLite.EF6" />
+	</connectionStrings>
+	<appSettings>
+		<!--程序标题-->
+		<add key="SystemName" value="多模式融合定位平台" />
+		<!--公司名称(没有则不会显示版权)-->
+		<add key="Company" value="" />
+		<!--本机IP,没有则由程序自动获取-->
+		<add key="LocalIP" value=""/>
+	</appSettings>
+	<runtime>
+		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+			<dependentAssembly>
+				<assemblyIdentity name="System.Web.Cors" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+				<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
+			</dependentAssembly>
+			<dependentAssembly>
+				<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+				<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
+			</dependentAssembly>
+			<dependentAssembly>
+				<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+				<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
+			</dependentAssembly>
+			<dependentAssembly>
+				<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+				<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
+			</dependentAssembly>
+			<dependentAssembly>
+				<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+				<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
+			</dependentAssembly>
+			<dependentAssembly>
+				<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+				<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
+			</dependentAssembly>
+		</assemblyBinding>
+	</runtime>
 </configuration>

+ 42 - 0
XdCxRhDW.App/Basic/IpHelper.cs

@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Sockets;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+using System.Net.NetworkInformation;
+using System.Runtime.InteropServices;
+using System.Configuration;
+
+namespace XdCxRhDW.App.Basic
+{
+    public static class IpHelper
+    {
+        /// <summary>
+        /// 获取本地IP
+        /// </summary>
+        /// <returns></returns>
+        public static string GetLocalIp()
+        {
+            try
+            {
+                string localIP = ConfigurationManager.AppSettings["LocalIP"].Trim();//优先使用本地配置的IP
+                if(string.IsNullOrWhiteSpace(localIP)) 
+                {
+                    using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0))
+                    {
+                        socket.Connect("8.8.8.8", 65530);
+                        IPEndPoint endPoint = socket.LocalEndPoint as IPEndPoint;
+                        localIP = endPoint.Address.ToString();
+                    }
+                }
+                return localIP;
+            }
+            catch 
+            {
+                return "127.0.0.1";
+            }
+        }
+    }
+}

+ 3 - 2
XdCxRhDW.App/CorTools/DetectToolForm.cs

@@ -21,6 +21,7 @@ using System.Web.Http.Results;
 using System.Web.UI.WebControls;
 using System.Windows.Forms;
 using XdCxRhDw.Dto;
+using XdCxRhDW.App.Basic;
 using XdCxRhDW.App.CpuCgTools;
 using XdCxRhDW.App.EFContext;
 using XdCxRhDW.App.WebAPI;
@@ -225,7 +226,7 @@ namespace XdCxRhDW.App.CorTools
                     var res = await db.SysSetings.FirstOrDefaultAsync();
                     if (res != null)
                     {
-                        uploadUrL = $"http://{res.ServerIp}:{res.HttpPort}/api/DetectCg";
+                        uploadUrL = $"http://{IpHelper.GetLocalIp()}:{res.HttpPort}/api/DetectCg";
                     }
                 }
                 dto.file1 = UpLoadFile(btnFile1.Text);
@@ -320,7 +321,7 @@ namespace XdCxRhDW.App.CorTools
                     var res = await db.SysSetings.FirstOrDefaultAsync();
                     if (res != null)
                     {
-                        uploadUrL = $"http://{res.ServerIp}:{res.HttpPort}/api/DetectCg";
+                        uploadUrL = $"http://{IpHelper.GetLocalIp()}:{res.HttpPort}/api/DetectCg";
                     }
                 }
                 xItem.file1 = UpLoadFile(btnFile1.Text);

+ 2 - 1
XdCxRhDW.App/CorTools/XlCalculateForm.cs

@@ -18,6 +18,7 @@ using System.Threading.Tasks;
 using System.Windows.Controls;
 using System.Windows.Documents;
 using System.Windows.Forms;
+using XdCxRhDW.App.Basic;
 using XdCxRhDW.App.EFContext;
 using XdCxRhDW.App.Model;
 using static XdCxRhDW.App.WebAPI.BaseController;
@@ -95,7 +96,7 @@ namespace XdCxRhDW.App.CorTools
                 try
                 {
                    
-                    string url = string.Format("http://{0}:{1}/Api/", settings.ServerIp, settings.HttpPort);
+                    string url = string.Format("http://{0}:{1}/Api/", IpHelper.GetLocalIp(), settings.HttpPort);
                     
                     if (!string.IsNullOrEmpty(txtEndTime.Text) && !string.IsNullOrEmpty(txtSpanSeconds.Text))
                     {

+ 2 - 2
XdCxRhDW.App/EFContext/RHDWContext.cs

@@ -24,7 +24,7 @@ namespace XdCxRhDW.App.EFContext
             //});
             this.Database.Log = msg =>
             {
-                Console.WriteLine(msg);
+                Serilog.Log.Information(msg);
             };
 
             modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
@@ -46,7 +46,7 @@ namespace XdCxRhDW.App.EFContext
 
         public DbSet<TargetInfo> TargetInfos { get; set; }
 
-
+        public DbSet<StationRes> StationRes { get; set; }
         public DbSet<CxRes> CxRes { get; set; }
         public DbSet<CgRes> CgRes { get; set; }
         public DbSet<PosRes> PosRes { get; set; }

+ 3 - 7
XdCxRhDW.App/MainForm.cs

@@ -22,6 +22,7 @@ using System.Data.Entity;
 using System.IO;
 using XdCxRhDW.App.Model;
 using System.Windows.Shapes;
+using XdCxRhDW.App.Basic;
 
 namespace XdCxRhDW
 {
@@ -156,17 +157,12 @@ namespace XdCxRhDW
                     DxHelper.MsgBoxHelper.ShowWarning($"请在系统设置中配置IP地址和Http端口");
                     return;
                 }
-                if (string.IsNullOrEmpty(settings.ServerIp))
-                {
-                    DxHelper.MsgBoxHelper.ShowWarning($"请在系统设置中配置IP地址和Http端口");
-                    return;
-                }
                 if (settings.HttpPort < 1)
                 {
-                    DxHelper.MsgBoxHelper.ShowWarning($"请在系统设置中配置IP地址和Http端口");
+                    DxHelper.MsgBoxHelper.ShowWarning($"请在系统设置中配置Http端口");
                     return;
                 }
-                string addr = $"http://{settings.ServerIp}:{settings.HttpPort}/swagger";
+                string addr = $"http://{IpHelper.GetLocalIp()}:{settings.HttpPort}/swagger";
                 try
                 {
                     System.Diagnostics.Process.Start(addr);

+ 6 - 1
XdCxRhDW.App/Model/PosRes.cs

@@ -8,7 +8,6 @@ using System.Threading.Tasks;
 
 namespace XdCxRhDW.App.Model
 {
-
     [Table("PosRes")]
     public class PosRes : PosData
     {
@@ -18,6 +17,12 @@ namespace XdCxRhDW.App.Model
         [Display(AutoGenerateField = false)]
         public virtual TaskInfo TaskInfo { get;set;}
 
+        [Display(Name = "站点ID")]
+        public long StationResID { get; set; }
+
+        [Display(AutoGenerateField = false)]
+        public virtual StationRes StationRes { get; set; }
+
         [Display(Name = "测向编号")]
         public long? CxResID { get; set; }
 

+ 53 - 0
XdCxRhDW.App/Model/StationRes.cs

@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XdCxRhDW.App.Model
+{
+
+    public class StationRes:BaseModel<long>
+    {
+        /// <summary>
+        /// 卫星接收天线经度
+        /// </summary>
+        public double SatTxLon { get; set; }
+
+        /// <summary>
+        /// 卫星接收天线纬度
+        /// </summary>
+        public double SatTxLat { get; set; }
+
+        /// <summary>
+        /// 超短波天线经度
+        /// </summary>
+        public double CdbTxLon { get; set; }
+
+        /// <summary>
+        /// 超短波接收天线纬度
+        /// </summary>
+        public double CdbTxLat { get; set; }
+
+        /// <summary>
+        /// 测向站经度
+        /// </summary>
+        public double CxLon { get; set; }
+
+        /// <summary>
+        /// 测向站纬度
+        /// </summary>
+        public double CxLat { get; set; }
+
+        /// <summary>
+        /// 参考站经度
+        /// </summary>
+        public double RefLon { get; set; }
+
+        /// <summary>
+        /// 参考站纬度
+        /// </summary>
+        public double RefLat { get; set; }
+
+    }
+}

+ 0 - 2
XdCxRhDW.App/Model/SysSetings.cs

@@ -11,8 +11,6 @@ namespace XdCxRhDW.App.Model
     [Table("SysSetings")]
     public class SysSetings : BaseModel
     {
-        public string ServerIp { get; set; }
-        public int Port { get; set; }
         public int HttpPort { get; set; }
         public string XLDirectory { get; set; }
         public string MapService { get; set; }

+ 0 - 1
XdCxRhDW.App/Model/TxInfo.cs

@@ -11,7 +11,6 @@ namespace XdCxRhDW.App.Model
     [Table("TxInfo")]
     public class TxInfo:BaseModel
     {
-
         public string Name { get; set; }
 
         /// <summary>

+ 49 - 9
XdCxRhDW.App/Program.cs

@@ -8,6 +8,7 @@ using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Reflection;
+using System.Security.Principal;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Windows.Forms;
@@ -35,6 +36,38 @@ namespace XdCxRhDW
                 Serilog.Log.Error(e.Exception, "出现未处理的线程异常");
             };
         }
+        static bool IsRunningAsAdmin()
+        {
+            bool result;
+            try
+            {
+                WindowsIdentity identity = WindowsIdentity.GetCurrent();
+                WindowsPrincipal principal = new WindowsPrincipal(identity);
+                result = principal.IsInRole(WindowsBuiltInRole.Administrator);
+            }
+            catch
+            {
+                result = false;
+            }
+            return result;
+        }
+        static void RestartAsAdmin()
+        {
+            var startInfo = new ProcessStartInfo();
+            startInfo.FileName = Application.ExecutablePath;
+            startInfo.Verb = "runas"; // 以管理员身份运行
+            try
+            {
+                Process.Start(startInfo);
+            }
+            catch (System.ComponentModel.Win32Exception)
+            {
+                // 用户取消了管理员权限提示,或者其他错误
+                // 可以在此处处理错误情况
+            }
+
+            Application.Exit();
+        }
 
         /// <summary>
         /// 应用程序的主入口点。
@@ -68,17 +101,24 @@ namespace XdCxRhDW
                 //DevExpress23.2以上版本查看未本地化的资源
                 //DevExpress.Utils.Localization.XtraLocalizer.EnableTraceSource();
             }
+            if (IsRunningAsAdmin())
+            {
+                string screenTitle = ConfigurationManager.AppSettings["SystemName"];
+                string screenCompany = ConfigurationManager.AppSettings["Company"];
+                DxHelper.WaitHelper.SetSplashTips("Tips.txt");
+                ChsLocalizer.UseChs();
 
-            string screenTitle = ConfigurationManager.AppSettings["SystemName"];
-            string screenCompany = ConfigurationManager.AppSettings["Company"];
-            DxHelper.WaitHelper.SetSplashTips("Tips.txt");
-            ChsLocalizer.UseChs();
+                DxHelper.WaitHelper.ShowSplashScreen(screenTitle, screenCompany);
+                DxHelper.WaitHelper.UpdateSplashMessage("正在加载程序资源文件...");
+                MainForm mainForm = new MainForm() { Text = screenTitle };
+                DxHelper.WaitHelper.UpdateSplashMessage("正在初始化...");
+                System.Windows.Forms.Application.Run(mainForm);
+            }
+            else
+            {
+                RestartAsAdmin();
+            }
 
-            DxHelper.WaitHelper.ShowSplashScreen(screenTitle, screenCompany);
-            DxHelper.WaitHelper.UpdateSplashMessage("正在加载程序资源文件...");
-            MainForm mainForm = new MainForm() { Text = screenTitle };
-            DxHelper.WaitHelper.UpdateSplashMessage("正在初始化...");
-            System.Windows.Forms.Application.Run(mainForm);
         }
     }
 }

+ 5 - 3
XdCxRhDW.App/Properties/licenses.licx

@@ -1,4 +1,6 @@
-DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraMap.MapControl, DevExpress.XtraMap.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
 DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraMap.MapControl, DevExpress.XtraMap.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

+ 13 - 79
XdCxRhDW.App/UserControl/CtrlSysSettings.Designer.cs

@@ -33,13 +33,9 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
             this.txtMapService = new DevExpress.XtraEditors.TextEdit();
             this.btnSave = new DevExpress.XtraEditors.SimpleButton();
-            this.txtPort = new DevExpress.XtraEditors.TextEdit();
-            this.txtIp = new DevExpress.XtraEditors.ComboBoxEdit();
             this.txtHttpPort = new DevExpress.XtraEditors.TextEdit();
             this.txtXLDirectory = new DevExpress.XtraEditors.TextEdit();
-            this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
             this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
-            this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem();
@@ -49,13 +45,9 @@ namespace XdCxRhDW.App.UserControl
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
             this.layoutControl1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.txtMapService.Properties)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.txtPort.Properties)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.txtIp.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtHttpPort.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtXLDirectory.Properties)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).BeginInit();
@@ -74,7 +66,7 @@ namespace XdCxRhDW.App.UserControl
             this.tablePanel1.Name = "tablePanel1";
             this.tablePanel1.Rows.AddRange(new DevExpress.Utils.Layout.TablePanelRow[] {
             new DevExpress.Utils.Layout.TablePanelRow(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 1F),
-            new DevExpress.Utils.Layout.TablePanelRow(DevExpress.Utils.Layout.TablePanelEntityStyle.Absolute, 473.1992F),
+            new DevExpress.Utils.Layout.TablePanelRow(DevExpress.Utils.Layout.TablePanelEntityStyle.Absolute, 360F),
             new DevExpress.Utils.Layout.TablePanelRow(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 1F)});
             this.tablePanel1.Size = new System.Drawing.Size(716, 628);
             this.tablePanel1.TabIndex = 0;
@@ -85,24 +77,20 @@ namespace XdCxRhDW.App.UserControl
             this.tablePanel1.SetColumn(this.layoutControl1, 1);
             this.layoutControl1.Controls.Add(this.txtMapService);
             this.layoutControl1.Controls.Add(this.btnSave);
-            this.layoutControl1.Controls.Add(this.txtPort);
-            this.layoutControl1.Controls.Add(this.txtIp);
             this.layoutControl1.Controls.Add(this.txtHttpPort);
             this.layoutControl1.Controls.Add(this.txtXLDirectory);
             this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.layoutControl1.HiddenItems.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
-            this.layoutControlItem2});
-            this.layoutControl1.Location = new System.Drawing.Point(252, 79);
+            this.layoutControl1.Location = new System.Drawing.Point(252, 136);
             this.layoutControl1.Name = "layoutControl1";
             this.layoutControl1.Root = this.Root;
             this.tablePanel1.SetRow(this.layoutControl1, 1);
-            this.layoutControl1.Size = new System.Drawing.Size(213, 469);
+            this.layoutControl1.Size = new System.Drawing.Size(213, 356);
             this.layoutControl1.TabIndex = 0;
             this.layoutControl1.Text = "layoutControl1";
             // 
             // txtMapService
             // 
-            this.txtMapService.Location = new System.Drawing.Point(12, 270);
+            this.txtMapService.Location = new System.Drawing.Point(12, 190);
             this.txtMapService.Name = "txtMapService";
             this.txtMapService.Size = new System.Drawing.Size(189, 22);
             this.txtMapService.StyleController = this.layoutControl1;
@@ -110,7 +98,7 @@ namespace XdCxRhDW.App.UserControl
             // 
             // btnSave
             // 
-            this.btnSave.Location = new System.Drawing.Point(12, 332);
+            this.btnSave.Location = new System.Drawing.Point(12, 252);
             this.btnSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnSave.MaximumSize = new System.Drawing.Size(0, 22);
             this.btnSave.MinimumSize = new System.Drawing.Size(0, 22);
@@ -121,29 +109,10 @@ namespace XdCxRhDW.App.UserControl
             this.btnSave.Text = "保存";
             this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
             // 
-            // txtPort
-            // 
-            this.txtPort.EditValue = "16010";
-            this.txtPort.Location = new System.Drawing.Point(11, 133);
-            this.txtPort.Name = "txtPort";
-            this.txtPort.Size = new System.Drawing.Size(172, 22);
-            this.txtPort.StyleController = this.layoutControl1;
-            this.txtPort.TabIndex = 5;
-            // 
-            // txtIp
-            // 
-            this.txtIp.Location = new System.Drawing.Point(12, 30);
-            this.txtIp.Name = "txtIp";
-            this.txtIp.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
-            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
-            this.txtIp.Size = new System.Drawing.Size(189, 22);
-            this.txtIp.StyleController = this.layoutControl1;
-            this.txtIp.TabIndex = 4;
-            // 
             // txtHttpPort
             // 
             this.txtHttpPort.EditValue = "8091";
-            this.txtHttpPort.Location = new System.Drawing.Point(12, 110);
+            this.txtHttpPort.Location = new System.Drawing.Point(12, 30);
             this.txtHttpPort.Name = "txtHttpPort";
             this.txtHttpPort.Size = new System.Drawing.Size(189, 22);
             this.txtHttpPort.StyleController = this.layoutControl1;
@@ -151,60 +120,33 @@ namespace XdCxRhDW.App.UserControl
             // 
             // txtXLDirectory
             // 
-            this.txtXLDirectory.Location = new System.Drawing.Point(12, 190);
+            this.txtXLDirectory.Location = new System.Drawing.Point(12, 110);
             this.txtXLDirectory.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.txtXLDirectory.Name = "txtXLDirectory";
             this.txtXLDirectory.Size = new System.Drawing.Size(189, 22);
             this.txtXLDirectory.StyleController = this.layoutControl1;
             this.txtXLDirectory.TabIndex = 6;
             // 
-            // layoutControlItem2
-            // 
-            this.layoutControlItem2.Control = this.txtPort;
-            this.layoutControlItem2.Location = new System.Drawing.Point(0, 107);
-            this.layoutControlItem2.MinSize = new System.Drawing.Size(76, 61);
-            this.layoutControlItem2.Name = "layoutControlItem2";
-            this.layoutControlItem2.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 22, 2);
-            this.layoutControlItem2.Size = new System.Drawing.Size(201, 105);
-            this.layoutControlItem2.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
-            this.layoutControlItem2.Text = "TCP接口端口";
-            this.layoutControlItem2.TextLocation = DevExpress.Utils.Locations.Top;
-            this.layoutControlItem2.TextSize = new System.Drawing.Size(76, 14);
-            // 
             // Root
             // 
             this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
             this.Root.GroupBordersVisible = false;
             this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
-            this.layoutControlItem1,
             this.layoutControlItem3,
             this.layoutControlItem4,
             this.layoutControlItem5,
             this.layoutControlItem6});
             this.Root.Name = "Root";
-            this.Root.Size = new System.Drawing.Size(213, 469);
+            this.Root.Size = new System.Drawing.Size(213, 356);
             this.Root.TextVisible = false;
             // 
-            // layoutControlItem1
-            // 
-            this.layoutControlItem1.Control = this.txtIp;
-            this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
-            this.layoutControlItem1.MaxSize = new System.Drawing.Size(0, 80);
-            this.layoutControlItem1.MinSize = new System.Drawing.Size(89, 80);
-            this.layoutControlItem1.Name = "layoutControlItem1";
-            this.layoutControlItem1.Size = new System.Drawing.Size(193, 80);
-            this.layoutControlItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
-            this.layoutControlItem1.Text = "本机IP";
-            this.layoutControlItem1.TextLocation = DevExpress.Utils.Locations.Top;
-            this.layoutControlItem1.TextSize = new System.Drawing.Size(96, 14);
-            // 
             // layoutControlItem3
             // 
             this.layoutControlItem3.Control = this.btnSave;
-            this.layoutControlItem3.Location = new System.Drawing.Point(0, 320);
+            this.layoutControlItem3.Location = new System.Drawing.Point(0, 240);
             this.layoutControlItem3.MinSize = new System.Drawing.Size(36, 26);
             this.layoutControlItem3.Name = "layoutControlItem3";
-            this.layoutControlItem3.Size = new System.Drawing.Size(193, 129);
+            this.layoutControlItem3.Size = new System.Drawing.Size(193, 96);
             this.layoutControlItem3.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem3.TextVisible = false;
@@ -214,7 +156,7 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControlItem4.Control = this.txtHttpPort;
             this.layoutControlItem4.ControlAlignment = System.Drawing.ContentAlignment.TopLeft;
             this.layoutControlItem4.CustomizationFormText = "HTTP服务端口";
-            this.layoutControlItem4.Location = new System.Drawing.Point(0, 80);
+            this.layoutControlItem4.Location = new System.Drawing.Point(0, 0);
             this.layoutControlItem4.MaxSize = new System.Drawing.Size(0, 80);
             this.layoutControlItem4.MinSize = new System.Drawing.Size(89, 80);
             this.layoutControlItem4.Name = "layoutControlItem4";
@@ -228,7 +170,7 @@ namespace XdCxRhDW.App.UserControl
             // 
             this.layoutControlItem5.Control = this.txtXLDirectory;
             this.layoutControlItem5.CustomizationFormText = "星历自动导入目录";
-            this.layoutControlItem5.Location = new System.Drawing.Point(0, 160);
+            this.layoutControlItem5.Location = new System.Drawing.Point(0, 80);
             this.layoutControlItem5.MaxSize = new System.Drawing.Size(0, 80);
             this.layoutControlItem5.MinSize = new System.Drawing.Size(89, 80);
             this.layoutControlItem5.Name = "layoutControlItem5";
@@ -241,7 +183,7 @@ namespace XdCxRhDW.App.UserControl
             // layoutControlItem6
             // 
             this.layoutControlItem6.Control = this.txtMapService;
-            this.layoutControlItem6.Location = new System.Drawing.Point(0, 240);
+            this.layoutControlItem6.Location = new System.Drawing.Point(0, 160);
             this.layoutControlItem6.MaxSize = new System.Drawing.Size(0, 80);
             this.layoutControlItem6.MinSize = new System.Drawing.Size(73, 80);
             this.layoutControlItem6.Name = "layoutControlItem6";
@@ -264,13 +206,9 @@ namespace XdCxRhDW.App.UserControl
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
             this.layoutControl1.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.txtMapService.Properties)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.txtPort.Properties)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.txtIp.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtHttpPort.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtXLDirectory.Properties)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).EndInit();
@@ -284,11 +222,7 @@ namespace XdCxRhDW.App.UserControl
         private DevExpress.Utils.Layout.TablePanel tablePanel1;
         private DevExpress.XtraLayout.LayoutControl layoutControl1;
         private DevExpress.XtraLayout.LayoutControlGroup Root;
-        private DevExpress.XtraEditors.TextEdit txtPort;
-        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1;
-        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2;
         private DevExpress.XtraEditors.SimpleButton btnSave;
-        private DevExpress.XtraEditors.ComboBoxEdit txtIp;
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3;
         private DevExpress.XtraEditors.TextEdit txtHttpPort;
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4;

+ 0 - 22
XdCxRhDW.App/UserControl/CtrlSysSettings.cs

@@ -29,29 +29,11 @@ namespace XdCxRhDW.App.UserControl
         {
             try
             {
-                txtIp.Properties.Items.Add("127.0.0.1");
-                string name = Dns.GetHostName();
-                IPAddress[] ipadrlist = Dns.GetHostAddresses(name);
-                foreach (IPAddress ipa in ipadrlist)
-                {
-                    if (ipa.AddressFamily == AddressFamily.InterNetwork)
-                        txtIp.Properties.Items.Add(ipa.ToString());
-                }
-            }
-            catch (Exception ex)
-            {
-                Serilog.Log.Error(ex, "获取本机IPv4地址出错");
-            }
-            try
-            {
-                txtIp.SelectedIndex = 0;
                 using (RHDWContext db = new RHDWContext())
                 {
                     var res = await db.SysSetings.FirstOrDefaultAsync();
                     if (res != null)
                     {
-                        this.txtIp.Text = res.ServerIp;
-                        this.txtPort.Text = res.Port.ToString();
                         this.txtHttpPort.Text = res.HttpPort.ToString();
                         if (!string.IsNullOrEmpty(res.XLDirectory))
                             this.txtXLDirectory.Text = res.XLDirectory.ToString();
@@ -77,8 +59,6 @@ namespace XdCxRhDW.App.UserControl
                     {
                         res = new Model.SysSetings()
                         {
-                            ServerIp = txtIp.Text,
-                            Port = Convert.ToInt32(txtPort.Text),
                             HttpPort = Convert.ToInt32(txtHttpPort.Text),
                             XLDirectory = txtXLDirectory.Text,
                             MapService=txtMapService.Text,
@@ -87,8 +67,6 @@ namespace XdCxRhDW.App.UserControl
                     }
                     else
                     {
-                        res.ServerIp = txtIp.Text;
-                        res.Port = Convert.ToInt32(txtPort.Text);
                         res.HttpPort = Convert.ToInt32(txtHttpPort.Text);
                         res.XLDirectory = txtXLDirectory.Text;
                         res.MapService = txtMapService.Text;

+ 2 - 0
XdCxRhDW.App/XdCxRhDW.App.csproj

@@ -211,6 +211,7 @@
     <Compile Include="Basic\ColorHelper.cs" />
     <Compile Include="Basic\DebounceDispatcher.cs" />
     <Compile Include="Basic\IOverlayFormService.cs" />
+    <Compile Include="Basic\IpHelper.cs" />
     <Compile Include="Basic\PhysicsHelper.cs" />
     <Compile Include="CorTools\CafResult.cs" />
     <Compile Include="CorTools\DetectToolForm.cs">
@@ -297,6 +298,7 @@
     </Compile>
     <Compile Include="Model\BaseModel.cs" />
     <Compile Include="Model\CgRes.cs" />
+    <Compile Include="Model\StationRes.cs" />
     <Compile Include="Model\SysSetings.cs" />
     <Compile Include="Model\CxRes.cs" />
     <Compile Include="Model\ModelEnum.cs" />

+ 11 - 84
XdCxRhDW.Sender/Form1.cs

@@ -39,15 +39,14 @@ namespace XdCxRhDW.Sender
                     string ip = addrArr[0];
                     int port = Convert.ToInt32(addrArr[1]);
                     string tskType = txtTskType.SelectedItem.ToString();
-                    //S:
                     using (var client = new HttpClient())
                     {
                         try
                         {
                             var lines = File.ReadAllLines("Simulation_Data2023.dat");
-                             int idx = 1;
+                            int idx = 1;
                             string url = string.Format("http://{0}:{1}/Api/Pos/", ip, port);
-                            if (tskType== "X1D1CX")//一星一地测向定位
+                            if (tskType == "X1D1CX")//一星一地测向定位
                             {
                                 url += "PosX1D1Async";
                             }
@@ -59,6 +58,7 @@ namespace XdCxRhDW.Sender
                             {
                                 url += "PosRHAsync";
                             }
+
                             foreach (var line in lines)
                             {
                                 if (string.IsNullOrWhiteSpace(line)) continue;
@@ -76,6 +76,14 @@ namespace XdCxRhDW.Sender
                                     AdjaX = Convert.ToDouble(items[10]),
                                     AdjaY = Convert.ToDouble(items[11]),
                                     AdjaZ = Convert.ToDouble(items[12]),
+                                    SatTxLon = IniFiles.ReadValue<double>("Station_Data2023", "卫星接收天线", "Lon"),
+                                    SatTxLat = IniFiles.ReadValue<double>("Station_Data2023", "卫星接收天线", "Lat"),
+                                    CdbTxLon = IniFiles.ReadValue<double>("Station_Data2023", "超短波接收天线", "Lon"),
+                                    CdbTxLat = IniFiles.ReadValue<double>("Station_Data2023", "超短波接收天线", "Lat"),
+                                    CxLon = IniFiles.ReadValue<double>("Station_Data2023", "侧向站", "Lon"),
+                                    CxLat = IniFiles.ReadValue<double>("Station_Data2023", "侧向站", "Lat"),
+                                    RefLon = IniFiles.ReadValue<double>("Station_Data2023", "参考站", "Lon"),
+                                    RefLat = IniFiles.ReadValue<double>("Station_Data2023", "参考站", "Lat"),
                                 };
                                 var content = new StringContent(JsonConvert.SerializeObject(dto), System.Text.Encoding.UTF8, "application/json");
                                 var response = await client.PostAsync(url, content);
@@ -88,86 +96,6 @@ namespace XdCxRhDW.Sender
                         }
                     }
 
-                    //if (string.IsNullOrWhiteSpace(localPort1.Text))
-                    //    client1 = new TcpClient();
-                    //else
-                    //    client1 = new TcpClient(new IPEndPoint(IPAddress.Any, Convert.ToInt32(localPort1.Text)));
-                    //client1.NoDelay = true;
-                    //client1.SendTimeout = 5000;
-                    //client1.ReceiveTimeout = 5000;
-                    //while (!cts1.IsCancellationRequested)
-                    //{
-                    //    try
-                    //    {
-                    //        await client1.ConnectAsync(IPAddress.Parse(ip), port);
-                    //        break;
-                    //    }
-                    //    catch (Exception ex)
-                    //    {
-                    //        Log(ex);
-                    //        await Task.Delay(5000, cts1.Token);
-                    //    }
-                    //}
-                    //Log($"已成功连接到[{txtAddr1.Text}]");
-                    //var lines = File.ReadAllLines("Simulation_Data2023.dat");
-                    //while (!cts1.IsCancellationRequested)
-                    //{
-                    //    try
-                    //    {
-                    //        int idx = 1;
-                    //        foreach (var line in lines)
-                    //        {
-                    //            if (cts1.IsCancellationRequested) break;
-                    //            if (string.IsNullOrWhiteSpace(line)) continue;
-                    //            var items = line.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
-                    //            //SendDto dto = new SendDto()
-                    //            //{
-                    //            //    SxDto = Convert.ToDouble(items[0]),
-                    //            //    XdDto = Convert.ToDouble(items[1]),
-                    //            //    MainYbDto = Convert.ToDouble(items[2]),
-                    //            //    AdjaYbDto = Convert.ToDouble(items[3]),
-                    //            //    CxRes = Convert.ToDouble(items[4]),
-                    //            //    MainX = Convert.ToDouble(items[7]),
-                    //            //    MainY = Convert.ToDouble(items[8]),
-                    //            //    MainZ = Convert.ToDouble(items[9]),
-                    //            //    AdjaX = Convert.ToDouble(items[10]),
-                    //            //    AdjaY = Convert.ToDouble(items[11]),
-                    //            //    AdjaZ = Convert.ToDouble(items[12]),
-                    //            //};
-                    //            SendDto dto = new SendDto()
-                    //            {
-                    //                SxDto = Convert.ToDouble(items[0]),
-                    //                XdDto = Convert.ToDouble(items[1]),
-                    //                MainYbDto = Convert.ToDouble(items[2]),
-                    //                AdjaYbDto = Convert.ToDouble(items[3]),
-                    //                CxRes = Convert.ToDouble(items[4]),
-                    //                MainX = null,
-                    //                MainY = null,
-                    //                MainZ = null,
-                    //                AdjaX = null,
-                    //                AdjaY = null,
-                    //                AdjaZ = null,
-                    //            };
-                    //            var msg = Newtonsoft.Json.JsonConvert.SerializeObject(dto);
-                    //            var data = Encoding.UTF8.GetBytes(msg);
-                    //            var dataWithHeader = BitConverter.GetBytes(data.Length).Concat(data).ToArray();
-                    //            await client1.GetStream().WriteAsync(dataWithHeader, 0, dataWithHeader.Length);
-                    //            Log($"已向[{txtAddr1.Text}]发送第{idx++}条仿真结果");
-                    //            await Task.Delay(3000, cts1.Token);
-                    //        }
-
-                    //    }
-                    //    catch (InvalidOperationException)
-                    //    {
-                    //        goto S;
-                    //    }
-                    //    catch (Exception ex)
-                    //    {
-                    //        Log($"向[{txtAddr1.Text}]发送结果失败.{ex.Message}");
-                    //        await Task.Delay(5000, cts1.Token);
-                    //    }
-                    //}
-
                 }
                 catch (Exception ex)
                 {
@@ -183,7 +111,6 @@ namespace XdCxRhDW.Sender
             else
             {
                 cts1?.Cancel();
-               // client1?.Dispose();
             }
         }
 

+ 44 - 0
XdCxRhDW.Sender/IniFiles.cs

@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XdCxRhDW.Sender
+{
+    public static class IniFiles
+    {
+        [DllImport("kernel32")]
+        private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
+
+        /// <summary> 
+        /// 读取INI文件 
+        /// </summary> 
+        /// <param name="Section">项名称(如 [TypeName] )</param> 
+        /// <param name="Key">键</param> 
+        public static string ReadValue(string iniFile, string section, string Key, string defaultValue = "")
+        {
+            if (!iniFile.Contains(":"))
+                iniFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, iniFile);
+            StringBuilder temp = new StringBuilder(50);
+            GetPrivateProfileString(section, Key, defaultValue, temp, 500, iniFile);
+            return temp.ToString();
+        }
+
+        /// <summary> 
+        /// 读取INI文件 
+        /// </summary> 
+        /// <param name="Section">项名称(如 [TypeName] )</param> 
+        /// <param name="Key">键</param> 
+        public static T ReadValue<T>(string iniFile, string section, string Key, T defaultValue = default)
+        {
+            var strValue = ReadValue(iniFile,section,Key);
+            if (string.IsNullOrWhiteSpace(strValue))
+                return defaultValue;
+            var obj = Convert.ChangeType(strValue, typeof(T));
+            return (T)obj;
+        }
+    }
+}

+ 15 - 0
XdCxRhDW.Sender/Station_Data2023.ini

@@ -0,0 +1,15 @@
+[卫星接收天线]
+Lon=118.5
+Lat=32.1
+
+[超短波接收天线]
+Lon=122
+Lat=30
+
+[侧向站]
+Lon=122
+Lat=30
+
+[参考站]
+Lon=121
+Lat=30

+ 4 - 0
XdCxRhDW.Sender/XdCxRhDW.Sender.csproj

@@ -89,6 +89,7 @@
     <Compile Include="Form1.Designer.cs">
       <DependentUpon>Form1.cs</DependentUpon>
     </Compile>
+    <Compile Include="IniFiles.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="UserControl1.cs">
@@ -125,6 +126,9 @@
       <DependentUpon>Settings.settings</DependentUpon>
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
     </Compile>
+    <None Include="Station_Data2023.ini">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
     <None Include="Simulation_Data2023.dat">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>

+ 40 - 0
XdCxRhDw.Dto/SendDto.cs

@@ -42,5 +42,45 @@ namespace XdCxRhDW.Dto
         public double? AdjaX { get; set; }
         public double? AdjaY { get; set; }
         public double? AdjaZ { get; set; }
+
+        /// <summary>
+        /// 卫星接收天线经度
+        /// </summary>
+        public double SatTxLon { get; set; }
+
+        /// <summary>
+        /// 卫星接收天线纬度
+        /// </summary>
+        public double SatTxLat { get; set; }
+
+        /// <summary>
+        /// 超短波天线经度
+        /// </summary>
+        public double CdbTxLon { get; set; }
+
+        /// <summary>
+        /// 超短波接收天线纬度
+        /// </summary>
+        public double CdbTxLat { get; set; }
+
+        /// <summary>
+        /// 测向站经度
+        /// </summary>
+        public double CxLon { get; set; }
+
+        /// <summary>
+        /// 测向站纬度
+        /// </summary>
+        public double CxLat { get; set; }
+
+        /// <summary>
+        /// 参考站经度
+        /// </summary>
+        public double RefLon { get; set; }
+
+        /// <summary>
+        /// 参考站纬度
+        /// </summary>
+        public double RefLat { get; set; }
     }
 }