Log LIAM assembly identities and cap traverse depth
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
using System;
|
||||
using System.Activities;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using Matrix42.Contracts.Platform.Data;
|
||||
using Matrix42.ServiceRepository.Contracts.Components;
|
||||
@@ -120,6 +122,9 @@ namespace LiamWorkflowActivities
|
||||
var CM = MethodBase.GetCurrentMethod();
|
||||
LogMethodBegin(CM);
|
||||
cLogManager.DefaultLogger.LogAssemblyInfo(Ass);
|
||||
LogAssemblyIdentity("WorkflowActivities", Ass);
|
||||
LogAssemblyIdentity("LiamNtfs", typeof(cLiamProviderNtfs).Assembly);
|
||||
LogAssemblyIdentity("LiamBaseClasses", typeof(cLiamProviderBase).Assembly);
|
||||
IsInitialized = true;
|
||||
LogMethodEnd(CM);
|
||||
}
|
||||
@@ -127,6 +132,39 @@ namespace LiamWorkflowActivities
|
||||
catch { };
|
||||
}
|
||||
|
||||
private static void LogAssemblyIdentity(string label, Assembly assembly)
|
||||
{
|
||||
if (assembly == null)
|
||||
return;
|
||||
|
||||
var fileVersion = string.IsNullOrWhiteSpace(assembly.Location)
|
||||
? null
|
||||
: FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
var informationalVersion = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? string.Empty;
|
||||
LogEntry(
|
||||
$"LIAM assembly identity: Label='{label}', Name='{assembly.GetName().Name}', AssemblyVersion='{assembly.GetName().Version}', InformationalVersion='{informationalVersion}', FileVersion='{fileVersion?.FileVersion}', ProductVersion='{fileVersion?.ProductVersion}', Sha256='{GetAssemblySha256(assembly)}', Location='{assembly.Location}'",
|
||||
LogLevels.Info);
|
||||
}
|
||||
|
||||
private static string GetAssemblySha256(Assembly assembly)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (assembly == null || string.IsNullOrWhiteSpace(assembly.Location) || !File.Exists(assembly.Location))
|
||||
return string.Empty;
|
||||
|
||||
using (var stream = File.OpenRead(assembly.Location))
|
||||
using (var sha256 = SHA256.Create())
|
||||
{
|
||||
return BitConverter.ToString(sha256.ComputeHash(stream)).Replace("-", string.Empty);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public bool LoadLicensingInformation(bool force = false)
|
||||
{
|
||||
if (cC4ITLicenseM42ESM.Instance == null || force)
|
||||
|
||||
Reference in New Issue
Block a user