^_^填坑备忘^_^C#自动化编程实现STK+Exata对卫星互联网星座进行网络仿真

  1. C#实际选择 STK11版本 or STK12版本的问题备注。

C#自动化客户端调用STK时,实际选择 STK11版本 or STK12版本 的调试运行备注】

以下代码“更新并重新打包备份为”testSTKQualNetInterface备份08.1_★避坑★【种子卫星:天线直接安装在卫星上,中间不能有Sensor传感器】.zip

源码文件: g:\teststkqualnetinterface\starlinksimulationclient.cs

        private void button_OpenSTK_Click(object sender, EventArgs e)

        {

            #region 打开STK引擎:首先尝试打开现有STK软件,没有现成打开的STK;则新建打开一个STK软件实例

            try

            {//尝试获取现在已经在运行的 STK实例

                m_uiApp = System.Runtime.InteropServices.Marshal.GetActiveObject("STK11.Application") as AgUiApplication;

                #region C#自动化客户端调用STK时,实际选择 STK11版本 or STK12版本 的调试运行备注 @2024-5-7 09:16:28

                // 貌似上面的 GetActiveObject("STK11.Application") 指定调用 STK11版本,

                // 其实不是,真正决定C#调用哪个版本的的STK,即【实际选择 STK11版本 or STK12版本】,

                // 是由【[testSTKQualNetInterface]】C#工程里引用的[AGI.STKObjects.Interop]系列【.Net互操作程序集】的STK版本决定的!

                // 比如,目前这个工程引用的[AGI.STKObjects.Interop.dll]是 12.0.0.0,那么运行时调用的就是 STK12版本

                // 所以,貌似 GetActiveObject("STK11.Application") 中的 "STK11.Application" 对 STK11版本 or STK12版本 都适用。

                #endregion C#自动化客户端调用STK时,实际选择 STK11版本 or STK12版本 的调试运行备注

  1. 将〔testSTKQualNetInterface备份08.1_★避坑★【种子卫星:天线直接安装在卫星上,中间不能有Sensor传感器】.zip〕中的《 Program.cs  StarlinkSimulationClient.cs  StarlinkSimulationClient.Designer.cs  XLsatNPF.cs 》源码文件重新替换到〔F:\WS_STK_use_Interop\test_Client 〕解决方案中的‘testSTKQualNetInterface’工程中,调试运行:
    1. 编译通过、运行正常,未报错;
    2. ‘一键自动化测试’,最后一步是调用[button_SaveToVDF_Click]加密保存场景为*.vdf,密码为 roottoor ;
    3. 调试运行时,C#调用STK11.6正常;保存的[D:\Temp\Starlink5x4_20SAT-SimScenario.vdf],既能用 STK11.6 也能用 STK12.2 打开(密码roottoor);

STK11.6逆向编译生成的Exata插件,测试运行正常 卫星节点位置可以正常调用STK进行更新】★STK+Exata联合仿真★

    1. 【STK11.6逆向编译生成的Exata插件,测试运行正常】用STK11.6重新打开加密保存的[D:\Temp\Starlink5x4_20SAT-SimScenario.vdf],调出‘软件逆向(反编译后重新编译)JSLS生成的’【QualNet Interface】场景管理器,对卫星Antenna天线建立网络连接并且建立星间链路,再在【QualNet Interface】场景管理器里单击‘go’,能够正常调用Exata进行网络仿真!
    2. STK11.6调用Exata插件进行网络仿真,生成的仿真*.config配置文件及目录,可以正常用Exata7.3打开(Exata6.2设置了调试断点会报错),卫星节点位置可以正常调用STK进行更新
  1. 因为【QualNet Interface Scenario Explorer】场景管理器,本质上在操作时,是调用‘作为组件服务的[AGI.StkQualnetUiControls]服务器’,所以跟踪调试的时候:

★客户端服务器CS模式 调试运行 QualNet Interface Scenario Explorer】场景管理器STK.Net组件插件

    1. 首先还是运行【[F:\WS_STK_use_Interop\test_Client]】解决方案里的“C#客户端”,单击‘一键自动化测试’,等待C#客户端操作STK服务器,创建仿真场景完毕;
    2. 然后打开【[F:\WS_STK_use_Interop\test_Server]】解决方案,:
    3. 第三,在打开的【[F:\WS_STK_use_Interop\test_Server]】解决方案中,附加到进程,附加到[AgUiApplication.exe]STK软件进程
    4. 在【[F:\WS_STK_use_Interop\test_Server]】解决方案的《NetworkInterfaceForm.cs》(位于[F:\WS_STK_use_Interop\test_Server\AGI.StkQualnetUiControls\]工程),找到构造函数,下断点以便跟踪调试;

              public NetworkInterfaceForm(NetworkInterface networkInterface, Entity parentEntity, AgStkObjectRoot stkRoot)

    1. 在【[test_Client]】客户端解决方案运行的C#程序打开的STK11.6软件中,手动操作调出【QualNet Interface Scenario Explorer】场景管理器,选定某颗卫星(比如XL11),右键‘Add’,目的是为该卫星添加网络接口Interface; è 马上可以发现【[test_Server]】里的NetworkInterfaceForm(NetworkInterface networkInterface, Entity parentEntity, AgStkObjectRoot stkRoot)断点被拦截命中,这时的调用堆栈是:

>         AGI.StkQualnetUiControls.dll!AGI.StkQualnetUiControls.NetworkInterfaceForm.NetworkInterfaceForm(AGI.StkQualnetObjectModel.NetworkInterface networkInterface, AGI.StkQualnetObjectModel.Entity parentEntity, AGI.STKObjects.AgStkObjectRoot stkRoot) 24            C#

           AGI.StkQualnetUiControls.dll!AGI.StkQualnetUiControls.StkQualnetScenarioExplorer.OnEntityAddNetworkInterfaceMenuItemClick(object sender, System.EventArgs e) 253   C#

           AGI.StkQualnetUiControls.dll!AGI.StkQualnetUiControls.StkQualnetScenarioExplorer.networkInterfacesContextMenuAdd_Click(object sender, System.EventArgs e) 266           C#

  1. 经跟踪调试,锁定【QualNet Interface Scenario Explorer】场景管理器‘针对Antenna天线添加Interface网络接口’的关键代码:

★调试找到关键代码★【场景管理器‘针对Antenna天线添加Interface网络接口’】

    1. F:\WS_STK_use_Interop\test_Server\AGI.StkQualnetUiControls\StkQualnetScenarioExplorer.cs】的[ OnEntityAddNetworkInterfaceMenuItemClick ],其中,两句最关键的是【 new NetworkInterfaceForm(null, entityTreeNode.Entity, this.StkRoot); 】和【 NetworkInterface networkInterface = networkInterfaceForm.GetNetworkInterface(); 】;
    2. F:\WS_STK_use_Interop\test_Server\AGI.StkQualnetUiControls\NetworkInterfaceForm.cs】的[ public NetworkInterface GetNetworkInterface() ];
    3. 最终结果:对[AGI.StkQualnetObjectModel.NetworkInterface]类型的【[networkInterface]类成员变量】进行赋值。

① 【《StkQualnetScenarioExplorer.cs》】的[ OnEntityAddNetworkInterfaceMenuItemClick ]:

源码如下:

                          private void OnEntityAddNetworkInterfaceMenuItemClick(object sender, EventArgs e)

                          {

                                EntityTreeNode entityTreeNode = this.EntityContextMenu.Tag as EntityTreeNode;

                                if (entityTreeNode != null && entityTreeNode.Entity != null)

                                {

                                      NetworkInterfaceForm networkInterfaceForm = new NetworkInterfaceForm(null, entityTreeNode.Entity, this.StkRoot);

                                      if (networkInterfaceForm.ShowDialog() == DialogResult.OK)

                                      {

                                           NetworkInterface networkInterface = networkInterfaceForm.GetNetworkInterface();

                                           entityTreeNode.Entity.NetworkInterfaces.Add(networkInterface);

                                           entityTreeNode.InterfacesNode.Nodes.Add(new NetworkInterfaceTreeNode(networkInterface));

                                      }

                                }

                   }

② 【《NetworkInterfaceForm.cs》】的[ public NetworkInterface GetNetworkInterface() ]

源码如下:

               public NetworkInterface GetNetworkInterface()

               {

                     if (this.m_networkInterface == null)

                     {

                          this.m_networkInterface = new NetworkInterface(this.InterfaceName);

                     }

                     else

                     {

                          this.m_networkInterface.Name = this.InterfaceName;

                     }

                     IAgStkObject agStkObject = null;

                     if (this.transmitterInstanceNameCombo.SelectedIndex < 0)

                     {

                          IAgStkObject agStkObject2 = this.m_stkRoot.GetObjectFromPath(this.m_parentEntity.StkObjectPath.PathString);

                          if (this.useTransmitterSensor.Checked)

                          {

                                if (this.transmitterSensorCombo.SelectedIndex < 0)

                                {

                                      try

                                      {

                                           agStkObject = (agStkObject2 = agStkObject2.Children.New(AgESTKObjectType.eSensor, this.transmitterSensorCombo.Text));

                                           goto IL_B5;

                                      }

                                      catch

                                      {

                                           agStkObject2 = null;

                                           goto IL_B5;

                                      }

                                }

                                agStkObject2 = (this.transmitterSensorCombo.SelectedItem as ComboBoxItem).Item as IAgStkObject;

                          }

                          IL_B5:

                          try

                          {

                                if (agStkObject2 != null)

                                {

                                      IAgStkObject agStkObject3 = agStkObject2.Children.New(AgESTKObjectType.eAntenna, this.transmitterInstanceNameCombo.Text);

                                      this.m_networkInterface.TransmitAntennaStkPath = agStkObject3.Path;

                                }

                                goto IL_11E;

                          }

                          catch

                          {

                                goto IL_11E;

                          }

                     }

                     IAgStkObject agStkObject4 = (this.transmitterInstanceNameCombo.SelectedItem as ComboBoxItem).Item as IAgStkObject;

                     this.m_networkInterface.TransmitAntennaStkPath = agStkObject4.Path;

                     IL_11E:

                     if (this.useTransmitAntennaForReceiveCheckBox.Checked)

                     {

                          this.m_networkInterface.ReceiveAntennaStkPath = this.m_networkInterface.TransmitAntennaStkPath.PathString;

                     }

                     else

                     {

                          if (this.receiverInstanceNameCombo.SelectedIndex < 0)

                          {

                                IAgStkObject agStkObject5 = this.m_stkRoot.GetObjectFromPath(this.m_parentEntity.StkObjectPath.PathString);

                                if (this.useReceiverSensor.Checked)

                                {

                                      if (this.receiverSensorCombo.SelectedIndex < 0)

                                      {

                                           try

                                           {

                                                 if (agStkObject != null && this.receiverSensorCombo.Text.Equals(this.transmitterSensorCombo.Text))

                                                 {

                                                      agStkObject5 = agStkObject;

                                                 }

                                                 else

                                                 {

                                                      agStkObject5 = agStkObject5.Children.New(AgESTKObjectType.eSensor, this.receiverSensorCombo.Text);

                                                 }

                                                 goto IL_200;

                                           }

                                           catch

                                           {

                                                 agStkObject5 = null;

                                                 goto IL_200;

                                           }

                                      }

                                      agStkObject5 = (this.receiverSensorCombo.SelectedItem as ComboBoxItem).Item as IAgStkObject;

                                }

                                IL_200:

                                try

                                {

                                      if (agStkObject5 != null)

                                      {

                                           IAgStkObject agStkObject6 = agStkObject5.Children.New(AgESTKObjectType.eAntenna, this.receiverInstanceNameCombo.Text);

                                           this.m_networkInterface.ReceiveAntennaStkPath = agStkObject6.Path;

                                      }

                                      goto IL_26F;

                                }

                                catch

                                {

                                      goto IL_26F;

                                }

                          }

                          IAgStkObject agStkObject7 = (this.receiverInstanceNameCombo.SelectedItem as ComboBoxItem).Item as IAgStkObject;

                          this.m_networkInterface.ReceiveAntennaStkPath = agStkObject7.Path;

                     }

                     IL_26F:

                     return this.m_networkInterface;

               }

③[AGI.StkQualnetObjectModel.NetworkInterface]类型的【[networkInterface]类成员变量】调试时,内部变量赋值情况

-                  networkInterface   {interface0}           AGI.StkQualnetObjectModel.NetworkInterface

                   AGI.StkQualnetObjectModel.ISTKQualNetMappingWriterInterface.RainOutagePercent    0.1          double

                   ChannelIndex        -1           int

+           IPv4Address  {169.0.0.0}    AGI.StkQualnetObjectModel.IPv4Address

+           IPv4SubnetMask       {255.255.255.0}       AGI.StkQualnetObjectModel.IPv4SubnetMask

                   IPv6Address         null        AGI.StkQualnetObjectModel.IPv6Address

                   IPv6SubnetMask   null        AGI.StkQualnetObjectModel.IPv6SubnetMask

+                 Id           {444ff6ea-ac23-472a-be0b-0e28797a73c8}      System.Guid

                   InterfaceId             -1           int

                   IsNodeExpanded   false        bool

                   IsSatelliteInterface  false        bool

                   Link       null        AGI.StkQualnetObjectModel.IConnection

                   Name      "interface0"           string

                   NameWithParent   "interface0"           string

                   NetworkProtocol  eIPv4      AGI.StkQualnetObjectModel.NetworkProtocolType

                   Parent     null        AGI.StkQualnetObjectModel.NetworkInterfaceList

                   PropertyChanged  null        System.ComponentModel.PropertyChangedEventHandler

                   QualNetInterfaceId               "-1"        string

+                 RainOutagePercent               {AGI.StkQualnetObjectModel.VariableDouble}   AGI.StkQualnetObjectModel.VariableDouble

+           ReceiveAntennaStkPath        {/Satellite/XL11/Antenna/antennaU1}       AGI.StkQualnetObjectModel.StkObjectPath

             STKReceiveAntennaPath       "/Application/STK/Scenario/StarlinkSimScenario/Satellite/XL11/Antenna/antennaU1" string

             STKTransmitAntennaPath     "/Application/STK/Scenario/StarlinkSimScenario/Satellite/XL11/Antenna/antennaU1" string

+                 Subcategory          {AGI.StkQualnetObjectModel.NetworkInterfaceSubcategory}           AGI.StkQualnetObjectModel.NetworkInterfaceSubcategory

+           TransmitAntennaStkPath      {/Satellite/XL11/Antenna/antennaU1}       AGI.StkQualnetObjectModel.StkObjectPath

+                 m_id       {AGI.StkQualnetObjectModel.VariableGuid}       AGI.StkQualnetObjectModel.VariableGuid

+                 m_idVariable         {AGI.StkQualnetObjectModel.VariableInterfaceId}             AGI.StkQualnetObjectModel.VariableInterfaceId

                   m_link    null        AGI.StkQualnetObjectModel.IConnection

                   m_name  "interface0"           string

                   m_parent              null        AGI.StkQualnetObjectModel.NetworkInterfaceList

+                 m_receiveAntennaPath         {AGI.StkQualnetObjectModel.VariableStkObjectPath}        AGI.StkQualnetObjectModel.VariableStkObjectPath

+                 m_transmitAntennaPath       {AGI.StkQualnetObjectModel.VariableStkObjectPath}        AGI.StkQualnetObjectModel.VariableStkObjectPath

+                 Static members                   

            AGI.StkQualnetUiControls.dll!AGI.StkQualnetUiControls.StkQualnetScenarioExplorer.OnEntityAddNetworkInterfaceMenuItemClick(object sender, System.EventArgs e) 253   C#

  1. 修改【反编译后重新编译报错的[AGI.StkQualnetObjectModel]】,并添加到[test_Client]解决方案,调整工程项目依赖顺序,编译成功:

[AGI.StkQualnetObjectModel]逆向后编译成功★ →修改【反编译后重新编译报错的[AGI.StkQualnetObjectModel]】,并添加到[test_Client]解决方案,调整工程项目依赖顺序,编译成功

★【反编译导出为 VS2019 项目】使用dnSpy v6.1.8 选择导出为 VS2019 项目

★【VS2022打开反编译导出的项目】打开反编译的[AGI.StkQualnetObjectModel] VS2019 项目,修改编译报错的地方,其实大概就是几类报错问题(之前还是心理惧怕,以为很多错误^_^);

★【VS2022修改[AGI.StkQualnetObjectModel]反编译后报错地方,编译成功】编译成功的代码打包备份在[ F:\WS_STK_use_Interop\AGI.StkQualnetObjectModelSTK11.6Exata插件,dnSpy逆向后重新编译成功^_^.zip ]〕  →  后来发现其实也可以用VS2015打开!!!

★【将修改报错完毕的[AGI.StkQualnetObjectModel]添加到[test_Client]解决方案,调整工程项目依赖顺序,编译成功】编译成功的代码打包备份在[ F:\WS_STK_use_Interop\test_Client【成功编译^_^添加[AGI.StkQualnetObjectModel]逆向工程之后】.zip]〕。

★★★★★【VS2022修改[AGI.StkQualnetObjectModel]反编译后报错地方,编译成功】

①(string)element.Attribute("min"); 未赋值报错问题;

源码文件: F:\WS_STK_use_Interop\AGI.StkQualnetObjectModel\AGI.StkQualnetObjectModel\QualnetXmlHelper.cs

                                               else if (text3.Equals("TEXT"))  // JSLS备注:  IPv6 地址格式

                                               {

                                                             // JSLS备注: 下面的 dnSpy 反编译源码  重新编译 报错

                                                             //(string)element.Attribute("min");

                                                             //(string)element.Attribute("max");

                                                             string strJSLS_min = (string)element.Attribute("min");

                                                             string strJSLS_max = (string)element.Attribute("max");

                                                             if (text.ToUpper().Contains("V6-ADDRESS"))  // JSLS备注:  IPv6 地址格式

                                                             {

                                                                           if (text5.Length == 0)

                                                                           {

                                                                                         text5 = "2000::";   // JSLS备注:  IPv6 地址格式

                                                                           }

                                                                           result = new VariableIPv6Address(text2, text, text7, flag2, text6, text9, text8, optional, text5);

                                                             }

                                                             else

                                                             {

                                                                           result = new VariableString(text2, text, text7, flag2, text6, text9, text8, optional, text5);

                                                             }

                                               }

② using(){ while() } 改为 foreach() 迭代问题;

源码文件:F:\WS_STK_use_Interop\AGI.StkQualnetObjectModel\AGI.StkQualnetObjectModel\Scenario.cs

                   // Token: 0x060003D1 RID: 977 RVA: 0x00010A18 File Offset: 0x0000EC18

                   public static void ImportFromStkScenario(AgScenario stkScenario, Scenario newScenario)

                   {

                                 newScenario.StkRoot = (stkScenario.Root as AgStkObjectRoot);

                                 foreach (object obj in stkScenario.Children)

                                 {

                                               IAgStkObject agStkObject = (IAgStkObject)obj;

                                               Entity entity;

                                               if (agStkObject.ClassType == AgESTKObjectType.eMissileSystem)

                                               {

                    // JSLS备注: 下面的 dnSpy 反编译原始代码,报错!

                    // 【错误  CS1674  “IEnumerator”: using 语句中使用的类型必须可隐式转换为“System.IDisposable”     AGI.StkQualnetObjectModel        D:\Intel\11111\AGI.StkQualnetObjectModel\Scenario.cs】

                    //using (IEnumerator enumerator2 = agStkObject.Children.GetEnumerator())

                    // JSLS分析:查看阅读 STK 编程帮助文档, STK编程中, foreach() 迭代方式用得多一些!

                    //                  using (IEnumerator enumerator2 = agStkObject.Children.GetEnumerator()) 

                    //   加上           while (enumerator2.MoveNext())

                    // 实际上应该就是【 foreach(IAgStkObject obj2 in iagObjectItems) 】迭代方式?

                    IAgStkObjectCollection iagObjectItems = agStkObject.Children;

                    foreach(IAgStkObject obj2 in iagObjectItems)

                                                             {

                                                                           //while (enumerator2.MoveNext())

                                                                           //{

                                                                                         //object obj2 = enumerator2.Current;

                                                                                         IAgStkObject stkObject = (IAgStkObject)obj2;

                                                                                         entity = Scenario.CreateEntityFromStkObject(newScenario, stkObject);

                                                                                         if (entity != null && entity != null)

                                                                                         {

                                                                                                       newScenario.Hierarchy.Entities.Add(entity);

                                                                                         }

                                                                           //}

                                                                           //continue;

                                                             }

                                               }

                                               entity = Scenario.CreateEntityFromStkObject(newScenario, agStkObject);

                                               if (entity != null && entity != null)

                                               {

                                                             newScenario.Hierarchy.Entities.Add(entity);

                                               }

                                 }

                   }

③ yield return 问题;

源码文件: F:\WS_STK_use_Interop\AGI.StkQualnetObjectModel\AGI.StkQualnetObjectModel\Node.cs

                   // Token: 0x060002EC RID: 748 RVA: 0x00009D26 File Offset: 0x00007F26

                   public IEnumerator<Element> GetDepthFirstEnumerator()

                   {

                                 yield return this.mData;

                                 foreach (Node<Element> node in this.mChildren)

                                 {

                                               IEnumerator<Element> kidenumerator = node.GetDepthFirstEnumerator();

                                               while (kidenumerator.MoveNext())

                                               {

                                                             // 下面 dnSpy 反编译的代码 重新编译报错

                                                             //!0! = kidenumerator.Current;

                                                             //yield return !;

                                                             // JSLS备注:不知道这个逻辑对不对?

                                                             this.mData = kidenumerator.Current;

                                                             yield return this.mData;

                                               }

                                               kidenumerator = null;

                                 }

                                 IEnumerator<Node<Element>> enumerator = null;

                                 yield break;

                                 yield break;

                   }

④ < PrivateImplementationDetails >.ComputeStringHash(type) 密封类问题;

源码文件: F:\WS_STK_use_Interop\AGI.StkQualnetObjectModel\AGI.StkQualnetObjectModel\QualNetAppConfigWriter.cs

                   // JSLS备注: 【 < PrivateImplementationDetails > 】应该是个密封类, 修改名字为【 [JSLS_XiaoYuHao__PrivateImplementationDetails__JSLS_DaYuHao] 】

                   internal sealed class JSLS_XiaoYuHao__PrivateImplementationDetails__JSLS_DaYuHao

                   {

                   // Token: 0x06000759 RID: 1881 RVA: 0x0001D0CC File Offset: 0x0001B2CC

                                 internal static uint ComputeStringHash(string s)

                                 {

                                               uint num = 0U;

                                               if (s != null)

                                               {

                                                             num = 2166136261U;

                                                             for (int i = 0; i < s.Length; i++)

                                                             {

                                                                           num = ((uint)s[i] ^ num) * 16777619U;

                                                             }

                                               }

                                               return num;

                                 }

                   }

     // Token: 0x0600030A RID: 778 RVA: 0x0000A01C File Offset: 0x0000821C

     public bool Write()

                   {

                                 if (this.m_scenario.Connections.Applications.Count > 0 && !File.Exists(this.FilePath))

                                 {

                                               try

                                               {

                                                             this.m_writer = File.CreateText(this.FilePath);

                                                             this.m_writer.AutoFlush = true;

                                                             foreach (NetworkApplication networkApplication in this.m_scenario.Connections.Applications)

                                                             {

                                                                           this.WriteFormattedString("{0} {1} {2} ", new object[]

                                                                           {

                                                                                         networkApplication.Type,

                                                                                         networkApplication.Source.NodeId,

                                                                                         networkApplication.Destination.NodeId

                                                                           });

                                                                           string type = networkApplication.Type;

                                                                           // JSLS备注: 【 < PrivateImplementationDetails > 】应该是个密封类, 修改名字为【 [JSLS_XiaoYuHao__PrivateImplementationDetails__JSLS_DaYuHao] 】

                                                                           //uint num = < PrivateImplementationDetails >.ComputeStringHash(type);

                                                                           uint num = JSLS_XiaoYuHao__PrivateImplementationDetails__JSLS_DaYuHao.ComputeStringHash(type);

                                                                           if (num <= 2037514399U)

                                                                           {

                                                                                         if (num <= 893884390U)

                                                                                         {

                                                                                                       if (num != 563683786U)

                                                                                                       {

                                                                                                                     if (num != 570659453U)

                                                                                                                     {

                                                                                                                                   if (num == 893884390U)

                                                                                                                                   {

                                                                                                                                                 if (type == "CBR")

                                                                                                                                                 {

                                                                                                                                                               this.WriteCBR(networkApplication);

                                                                                                                                                 }

                                                                                                                                   }

                                                                                                                     }

                                                                                                                     else if (type == "TELNET")

⑤ ★★ Func<T, TResult>() 委托类型函数声明问题;

源码文件: F:\WS_STK_use_Interop\AGI.StkQualnetObjectModel\AGI.StkQualnetObjectModel\QualnetConfigFileMapping\ConfigFileInfo.cs

                        #region JSLS备注: 【 Func<NodeInfo, bool> 委托名称 】,表示输入为[NodeInfo]类型、输出为[bool]类型,名字叫[委托名称]的委托!

                        /*

                        以下示例所演示的那样将 lambda 表达式分配给 Func<T, TResult>委托。

                        using System;

                        public class LambdaExpression

                        {

                           public static void Main()

                           {

                              Func<string, string> convert = s => s.ToUpper();

                              string name = "Dakota";

                              Console.WriteLine(convert(name));  

                           }

                        }

                        */

                        #endregion JSLS备注: 【 Func<NodeInfo, bool> 委托名称 】,表示输入为[NodeInfo]类型、输出为[bool]类型,名字叫[委托名称]的委托!

                        //Func<NodeInfo, bool> <>9__1;

                        // JSLS备注: 声明一个 目前为空的【委托】

                        //             参考:VS2010帮助《Func<TResult> 委托》

                        #region 参考 VS2010帮助《Func<TResult> 委托》  中  的最后一个例子

                        /*

using System;

static class Func1

{

   public static void Main()

   {

      // Note that each lambda expression has no parameters.

      LazyValue<int> lazyOne = new LazyValue<int>(() => ExpensiveOne());

      LazyValue<long> lazyTwo = new LazyValue<long>(() => ExpensiveTwo("apple"));

      Console.WriteLine("LazyValue objects have been created.");

      // Get the values of the LazyValue objects.

      Console.WriteLine(lazyOne.Value);

      Console.WriteLine(lazyTwo.Value);

   }

   static int ExpensiveOne()

   {

      Console.WriteLine("\nExpensiveOne() is executing.");

      return 1;

   }

   static long ExpensiveTwo(string input)

   {

      Console.WriteLine("\nExpensiveTwo() is executing.");

      return (long)input.Length;

   }

}

class LazyValue<T> where T : struct

{

   private Nullable<T> val;

   private Func<T> getValue;

   // Constructor.

   public LazyValue(Func<T> func)

   {

      val = null;

      getValue = func;

   }

   public T Value

   {

      get

      {

         if (val == null)

            // Execute the delegate.

            val = getValue();

         return (T)val;

      }

   }

}

                        */

                        #endregion 参考 VS2010帮助《Func<TResult> 委托》  中  的最后一个例子

                        Func<NodeInfo, bool> JSLSdebug__DaYuXiaoYu9__1 = new Func<NodeInfo, bool>( (nodeInfo) => (false) );

                        // 【空委托】的写法: 右箭头的 左边 [nodeInfo] 表示输入类型为[NodeInfo]的形参,右箭头的 右边[false] 表示 委托函数实现时返回 bool 类型的 值 false 。

                        //Func<NodeInfo, bool> <>9__3;

                        Func<NodeInfo, bool> JSLSdebug__DaYuXiaoYu9__3 = new Func<NodeInfo, bool>( (nodeInfo) => (false) );

                        // 【空委托】的写法: 右箭头的 左边 [nodeInfo] 表示输入类型为[NodeInfo]的形参,右箭头的 右边[false] 表示 委托函数实现时返回 bool 类型的 值 false 。

                                                                                    foreach (string text2 in match.Value.Substring(num2 + 1, num3 - num2 - 1).Split(new char[]

                                                                                    {

                                                                                                  ','

                                                                                    }))

                                                                                    {

                                                                                                  List<string> list3 = new List<string>();

                                                                                                  if (text2.ToUpper().Contains("THRU"))

                                                                                                  {

                                                                                                                string text3 = text2.ToUpper();

                                                                                                                int num4 = text3.IndexOf('T');

                                                                                                                int num5 = text3.IndexOf('U');

                                                                                                                string s = text3.Substring(0, num4 - 1).Trim();

                                                                                                                string s2 = text3.Substring(num5 + 1).Trim();

                                                                                                                int num6;

                                                                                                                int.TryParse(s, out num6);

                                                                                                                int num7;

                                                                                                                int.TryParse(s2, out num7);

                                                                                                                for (int j = num6; j <= num7; j++)

                                                                                                                {

                                                                                                                              list3.Add(j.ToString());

                                                                                                                }

                                                                                                  }

                                                                                                  else

                                                                                                  {

                                                                                                                list3.Add(text2);

                                                                                                  }

                                                                                                  foreach (string text4 in list3)

                                                                                                  {

                                                                                                                bool flag = false;

                                                                                                                string trimmedCurId = text4.Trim();

                                                                                                                long num8 = long.Parse(trimmedCurId);

                                                                                                                string pattern4 = string.Format(ConfigFileInfo.s_satelliteNodeSearchPattern, trimmedCurId);

                                                                                                                if (Regex.Match(configText, pattern4).Success)

                                                                                                                {

                                                                                                                              IEnumerable<NodeInfo> nodeInfo = this.m_nodeInfo;

                                                                                                                              Func<NodeInfo, bool> predicate;

                                    // 假如 predicate 委托函数  为空的话

                                    if ((predicate = /*<>9__1*/ JSLSdebug__DaYuXiaoYu9__1) == null)

                                                                                                                              {

                                                                                                                                            predicate = (/*<>9__1*/ JSLSdebug__DaYuXiaoYu9__1 = ((NodeInfo n) => n.Subnet.Equals(subnet) && n.IsSatellite));

// JSLS备注: 【 Func<NodeInfo, bool> 委托名称 】,表示输入为[NodeInfo]类型、输出为[bool]类型,名字叫[委托名称]的委托!

/*

以下示例所演示的那样将 lambda 表达式分配给 Func<T, TResult>委托。

using System;

public class LambdaExpression

{

    public static void Main()

    {

        Func<string, string> convert = s => s.ToUpper();

        string name = "Dakota";

        Console.WriteLine(convert(name));  

    }

}

*/

                                    }

                                    if (new List<NodeInfo>(nodeInfo.Where(predicate)).Count == 0)

                                                                                                                              {

                                                                                                                                            flag = true;

                                                                                                                              }

                                                                                                                }

★★★★★【将修改报错完毕的[AGI.StkQualnetObjectModel]添加到[test_Client]解决方案,调整工程项目依赖顺序,编译成功】

重点需要注意:

①被依赖项目编译后 *.dll 输出目录设置问题:具体在【某个工程项目】右键 属性 生成 输出 将【输出路径】设置为 STK11.6 Exata .Net DLL组件插件目录位置,即【[ C:\Program Files\AGI\STK 11\STK-QualNet Interface\ ]

②项目依赖设置问题:特别注意,不仅要右键‘解决方案’选择[项目依赖项][项目生成顺序]进行设置;而且,还要记得,对‘每个具体的工程项目’再右键选择[生成依赖项][项目依赖项][项目生成顺序]进行设置。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/605471.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

电机控制系列模块解析(19)—— 反电势观测器

随着现代工业自动化技术的飞速发展&#xff0c;交流电机作为关键的动力装置&#xff0c;其控制精度与效率日益受到重视。其中&#xff0c;无位置传感器控制技术由于其成本低、可靠性高、系统简洁等优点&#xff0c;逐渐成为研究热点。本文将对交流电机反电势观测器这一关键技术…

三维空间刚体运动

三维空间刚体运动是指刚体在三维空间中的运动&#xff0c;这种运动由平移和旋转构成。平移是指物体在空间中沿某一方向移动一定的距离&#xff0c;而旋转则是指物体绕某一轴旋转一定的角度。这两种运动都不会改变物体的形状和大小&#xff0c;因此被称为刚体运动。 在描述三维…

Qt跨平台开发demo(适用萌新)

最近需要参与一款Qt跨平台的软件开发&#xff0c;在此之前&#xff0c;特把基础信息做学习和梳理&#xff0c;仅供参考。 所使用的技术和版本情况如下&#xff1a; 虚拟机&#xff1a;VMware 16.2.5操作系统&#xff1a;ubuntu-20.04.6-desktop-amd64&#xff1a;Mysql数据库…

大模型入坑记:搭建本地大模型微调环境

为了让大模型发挥更大用途&#xff0c;决定在本地搭建大模型微调环境&#xff0c;在原有的PC上加装Tesla V100&#xff0c;前前后后耗时一个多月&#xff0c;遇到若干技术问题&#xff0c;好在目前已基本得到解决&#xff0c;也打破了很多网上店家包括身边专家对GPU搭建上的一些…

正版软件 | Total Uninstall - Windows 全功能卸载程序 新手入门教程

『软件简介』 Total Uninstall 是一款先进的系统监控与卸载工具&#xff0c;它通过创建安装前后的系统快照&#xff0c;为用户提供了一种全新的程序管理方式。这款软件具备两个主要功能&#xff1a;一是能够独立于系统自带的卸载程序&#xff0c;彻底移除已安装的应用程序&…

FPGA -手写异步FIFO

一&#xff0c;FIFO原理 FIFO&#xff08;First In First Out&#xff09;是一种先进先出的数据缓存器&#xff0c;没有外部读写地址线&#xff0c;使用起来非常简单&#xff0c;只能顺序写入数据&#xff0c;顺序的读出数据&#xff0c;其数据地址由内部读写指针自动加1完成&a…

开源数据可视化大屏对接表单数据实践!

如果你需要一个表单系统&#xff0c;进行数据收集&#xff1b;可以使用tduck填鸭进行私有化部署&#xff0c;进行表单制作&#xff0c;完成数据收集。 在实际业务中&#xff0c;往往需要将收集的数据进行展示或分析&#xff1b;此时就可以使用表单数据推送到TReport中&#xf…

AMBA总线介绍

AMBA&#xff08;Advanced Microcontroller Bus Architecture&#xff09;是由ARM&#xff08;Advanced RISC Machines&#xff09;公司设计的一种高性能、高带宽的总线架构。AMBA总线广泛应用于各种嵌入式系统中&#xff0c;包括数字信号处理器、图形处理器、嵌入式处理器以及…

收银系统源码--什么是千呼智慧新零售系统?

千呼智慧新零售系统是一套针对零售行业线上线下一体化收银系统。给门店提供线下称重收银、o2o线上商城、erp进销存、精细化会员管理、丰富营销插件等一体化解决方案。多端数据打通&#xff0c;实现线上线下一体化&#xff0c;提升门店工作效率&#xff0c;实现数字化升级&#…

vue3 依赖-组件tablepage-vue3版本1.0.3更新内容

github求⭐ 可通过github 地址和npm 地址查看全部内容 vue3 依赖-组件tablepage-vue3说明文档&#xff0c;列表页快速开发&#xff0c;使用思路及范例-汇总 vue3 依赖-组件tablepage-vue3说明文档&#xff0c;列表页快速开发&#xff0c;使用思路及范例&#xff08;Ⅰ&#…

【第38天】SQL进阶-SQL设计优化-范式设计(SQL 小虚竹)

回城传送–》《100天精通MYSQL从入门到就业》 文章目录 零、前言一、练习题目二、SQL思路初始化数据什么是范式设计第一范式&#xff08;1NF&#xff09;第二范式&#xff08;2NF&#xff09;第三范式&#xff08;3NF&#xff09; 三、总结四、参考 零、前言 今天是学习 SQL …

期权和期货有什么区别?

今天期权懂带你了解期权和期货有什么区别&#xff1f;期权和期货是两种常见的衍生金融工具&#xff0c;它们在结构和盈利方式上存在一些关键的区别&#xff1a; 期权 期权是一种给予持有者在未来某个时间以特定价格买入或卖出基础资产的权利&#xff0c;但不是义务。期权的主要…

ORACLE 19C RAC DIAG进程消耗大量内存的分析

近期一个ORACLE 19C的RAC环境&#xff0c;多次出现数据库实例的后台进程DIAG消耗很多内存&#xff08;达到20G&#xff09;&#xff0c;节点1、节点2都出现过次问题。 问题分析&#xff1a;通过对DIAG进程TRACE分析&#xff0c;结合在ORACLE官方后台进行问题、BUG查询匹配&…

uniapp怎么使用jsx

安装vitejs/plugin-vue-jsx npm install vitejs/plugin-vue-jsx -Dvite.config.js配置 import { defineConfig } from "vite"; import uni from "dcloudio/vite-plugin-uni"; import vueJsx from vitejs/plugin-vue-jsxexport default defineConfig({plu…

初始Java篇(JavaSE基础语法)(7)抽象类和接口(下)

找往期文章包括但不限于本期文章中不懂的知识点&#xff1a; 个人主页&#xff1a;我要学编程(ಥ_ಥ)-CSDN博客 所属专栏&#xff1a;JavaSE 接上文&#xff1a;初始Java篇&#xff08;JavaSE基础语法&#xff09;&#xff08;7&#xff09;抽象类和接口&#xff08;上&#xf…

Netty HTTP2 示例-响应式编程-013

🤗 ApiHug {Postman|Swagger|Api...} = 快↑ 准√ 省↓ GitHub - apihug/apihug.com: All abou the Apihug apihug.com: 有爱,有温度,有质量,有信任ApiHug - API design Copilot - IntelliJ IDEs Plugin | Marketplace The Next Generation API Development Platform …

上海亚商投顾:沪指缩量调整 合成生物概念股持续爆发

上海亚商投顾前言&#xff1a;无惧大盘涨跌&#xff0c;解密龙虎榜资金&#xff0c;跟踪一线游资和机构资金动向&#xff0c;识别短期热点和强势个股。 一.市场情绪 沪指昨日缩量震荡调整&#xff0c;深成指、创业板指均跌超1%。细胞免疫治疗概念股大涨&#xff0c;冠昊生物、…

运营一个在线课堂有哪些基础费用?

我是酷瓜云课堂的作者&#xff0c;对这个问题还是很有心得的。我们的系统是基于腾讯云服务的&#xff0c;下面简单罗列一些基础费用&#xff0c;价格和腾讯云官方有些许出入&#xff0c;仅供参考。 &#xff08;1&#xff09;域名 域名注册通常 60 - 80元 / 年&#xff0c;续…

【JavaEE网络】HTTP响应详解:状态码、报头与正文的全面解析

目录 HTTP响应&#xff08;Response&#xff09;认识 "状态码" (status code)认识响应 “报头”&#xff08;header&#xff09;认识响应 “正文”&#xff08;body&#xff09; HTTP响应&#xff08;Response&#xff09; 响应&#xff1a; 首行响应头空行正文 认…

AI大模型探索之路-训练篇18:大语言模型预训练-微调技术之Prompt Tuning

系列篇章&#x1f4a5; AI大模型探索之路-训练篇1&#xff1a;大语言模型微调基础认知 AI大模型探索之路-训练篇2&#xff1a;大语言模型预训练基础认知 AI大模型探索之路-训练篇3&#xff1a;大语言模型全景解读 AI大模型探索之路-训练篇4&#xff1a;大语言模型训练数据集概…