新增ReferencedAssemblyInfo对象。

RtApplication初始化时获取SicRT依赖的Dll,并生成依赖清单。
This commit is contained in:
DESKTOP-GPE37UV\THINKAPD 2023-04-13 18:38:08 +08:00
parent 66ce272e47
commit aaea9587ee
7 changed files with 61 additions and 5 deletions

1
.gitignore vendored
View File

@ -35,6 +35,7 @@ bld/
# Visual Studio 2015/2017 cache/options directory
.vs/
.idea/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

View File

@ -566,6 +566,7 @@
<Compile Include="MECF\Framework\Common\CommonData\DeviceData\AITChillerData1.cs" />
<Compile Include="MECF\Framework\Common\CommonData\FdcDataItem.cs" />
<Compile Include="MECF\Framework\Common\CommonData\NotifiableItem.cs" />
<Compile Include="MECF\Framework\Common\CommonData\ReferencedAssemblyInfo.cs" />
<Compile Include="MECF\Framework\Common\CommonData\RobotAction.cs" />
<Compile Include="MECF\Framework\Common\CommonData\RobotArm.cs" />
<Compile Include="MECF\Framework\Common\CommonData\RobotMoveInfo.cs" />

View File

@ -0,0 +1,37 @@
// /************************************************************************
// * @file ReferencedAssemblyInfo.cs
// * @author Su Liang
// * @date 2023/04/13
// *
// * @copyright &copy Sicentury Inc.
// *
// * @brief
// *
// * @details
// *
// *
// * *****************************************************************************/
using System;
using System.Runtime.Serialization;
namespace MECF.Framework.Common.CommonData;
[Serializable]
[DataContract]
public class ReferencedAssemblyInfo
{
[DataMember]
public string Name { get; set; }
[DataMember]
public Version Version { get; set; }
[DataMember]
public byte[] PublicKeyToken { get; set; }
public override string ToString()
{
return $"Name={Name}, Version={Version}, PublicKeyToken={BitConverter.ToString(PublicKeyToken)}";
}
}

View File

@ -123,6 +123,7 @@ namespace MECF.Framework.Common.DataCenter
[ServiceKnownType(typeof(double[]))]
[ServiceKnownType(typeof(double))]
[ServiceKnownType(typeof(float))]
[ServiceKnownType(typeof(List<ReferencedAssemblyInfo>))]
[ServiceKnownType(typeof(Tuple<int, string>))]
[ServiceKnownType(typeof(Tuple<int, string>[]))]
[ServiceKnownType(typeof(ManualTransferTask))]

View File

@ -17,4 +17,4 @@ using log4net.Config;
[assembly: ComVisible(false)]
[assembly: Guid("6E6A3BE1-681F-49BE-982E-29C4C1D08D49")]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyVersion("2.0.1.1")]

View File

@ -1,14 +1,15 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.ServiceModel;
using System.Threading;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Threading;
using Aitex.Core.RT.Log;
using Aitex.Core.Util;
using MECF.Framework.Common.CommonData;
using MECF.Framework.Common.NotifyTrayIcons;
using MECF.Framework.RT.Core.Backend;
using MenuItem = System.Windows.Controls.MenuItem;
@ -28,6 +29,8 @@ namespace MECF.Framework.RT.Core.Applications
public static BackendMainView MainView { get; set; }
public static List<ReferencedAssemblyInfo> ReferencedAssemblies { get; private set; }
private PassWordView _loginWindow = new PassWordView();
private static Mutex _mutex;
@ -41,7 +44,7 @@ namespace MECF.Framework.RT.Core.Applications
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
//Because this is a static event, you must detach your event handlers when your application is disposed, or memory leaks will result.
System.Windows.Forms.Application.ThreadException += ThreadHandler;
System.Windows.Forms.Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
@ -127,6 +130,19 @@ namespace MECF.Framework.RT.Core.Applications
{
MainView.Show();
}
// 获取RT依赖的Dll列表
var assem = AppDomain.CurrentDomain.GetAssemblies();
ReferencedAssemblies =
assem.Where(x => (x.GetName().Name.StartsWith("sic", true, CultureInfo.CurrentCulture)
|| x.GetName().Name.StartsWith("mecf", true, CultureInfo.CurrentCulture)))
.Select(x => new ReferencedAssemblyInfo()
{
Name = x.GetName().Name,
Version = x.GetName().Version,
PublicKeyToken = x.GetName().GetPublicKeyToken()
}).ToList();
}
protected void OnUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)

View File

@ -45,5 +45,5 @@ using System.Windows;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyVersion("2.0.1.1")]
//[assembly: AssemblyFileVersion("1.0.0.0")]