From aaea9587ee0f4898792ce332e5517417f522f5db Mon Sep 17 00:00:00 2001 From: "DESKTOP-GPE37UV\\THINKAPD" Date: Thu, 13 Apr 2023 18:38:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EReferencedAssemblyInfo?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E3=80=82=20RtApplication=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E6=97=B6=E8=8E=B7=E5=8F=96SicRT=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E7=9A=84Dll=EF=BC=8C=E5=B9=B6=E7=94=9F=E6=88=90=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E6=B8=85=E5=8D=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .../MECF.Framework.Common.csproj | 1 + .../CommonData/ReferencedAssemblyInfo.cs | 37 +++++++++++++++++++ .../Common/DataCenter/IQueryDataService.cs | 1 + .../Properties/AssemblyInfo.cs | 2 +- .../Applications/RtApplication.cs | 22 +++++++++-- .../Properties/AssemblyInfo.cs | 2 +- 7 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 MECF.Framework.Common/MECF/Framework/Common/CommonData/ReferencedAssemblyInfo.cs diff --git a/.gitignore b/.gitignore index 74fb49e..699d46b 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/MECF.Framework.Common/MECF.Framework.Common.csproj b/MECF.Framework.Common/MECF.Framework.Common.csproj index f415ca9..9becab0 100644 --- a/MECF.Framework.Common/MECF.Framework.Common.csproj +++ b/MECF.Framework.Common/MECF.Framework.Common.csproj @@ -566,6 +566,7 @@ + diff --git a/MECF.Framework.Common/MECF/Framework/Common/CommonData/ReferencedAssemblyInfo.cs b/MECF.Framework.Common/MECF/Framework/Common/CommonData/ReferencedAssemblyInfo.cs new file mode 100644 index 0000000..a5a9c9b --- /dev/null +++ b/MECF.Framework.Common/MECF/Framework/Common/CommonData/ReferencedAssemblyInfo.cs @@ -0,0 +1,37 @@ +// /************************************************************************ +// * @file ReferencedAssemblyInfo.cs +// * @author Su Liang +// * @date 2023/04/13 +// * +// * @copyright © 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)}"; + } +} \ No newline at end of file diff --git a/MECF.Framework.Common/MECF/Framework/Common/DataCenter/IQueryDataService.cs b/MECF.Framework.Common/MECF/Framework/Common/DataCenter/IQueryDataService.cs index ea015d2..e480c7a 100644 --- a/MECF.Framework.Common/MECF/Framework/Common/DataCenter/IQueryDataService.cs +++ b/MECF.Framework.Common/MECF/Framework/Common/DataCenter/IQueryDataService.cs @@ -123,6 +123,7 @@ namespace MECF.Framework.Common.DataCenter [ServiceKnownType(typeof(double[]))] [ServiceKnownType(typeof(double))] [ServiceKnownType(typeof(float))] + [ServiceKnownType(typeof(List))] [ServiceKnownType(typeof(Tuple))] [ServiceKnownType(typeof(Tuple[]))] [ServiceKnownType(typeof(ManualTransferTask))] diff --git a/MECF.Framework.Common/Properties/AssemblyInfo.cs b/MECF.Framework.Common/Properties/AssemblyInfo.cs index 1ccd257..ccc99e1 100644 --- a/MECF.Framework.Common/Properties/AssemblyInfo.cs +++ b/MECF.Framework.Common/Properties/AssemblyInfo.cs @@ -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")] diff --git a/MECF.Framework.RT.Core/Applications/RtApplication.cs b/MECF.Framework.RT.Core/Applications/RtApplication.cs index 66e006b..4bf589b 100644 --- a/MECF.Framework.RT.Core/Applications/RtApplication.cs +++ b/MECF.Framework.RT.Core/Applications/RtApplication.cs @@ -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 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) diff --git a/MECF.Framework.RT.Core/Properties/AssemblyInfo.cs b/MECF.Framework.RT.Core/Properties/AssemblyInfo.cs index c87e4d1..88aaff6 100644 --- a/MECF.Framework.RT.Core/Properties/AssemblyInfo.cs +++ b/MECF.Framework.RT.Core/Properties/AssemblyInfo.cs @@ -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")] \ No newline at end of file