using System.Diagnostics; using System.Reflection; using System.Text.Json; using Opc.Ua; using Opc.Ua.Server; using ZB.MOM.WW.OtOpcUa.OpcUaServer; var types = new[] { typeof(Session), typeof(CertificateValidator), typeof(CertificateStoreIdentifier), typeof(Opc.Ua.Configuration.ApplicationInstance), typeof(OtOpcUaSdkServer), typeof(OpcUaApplicationHost), typeof(OtOpcUaNodeManager) }; Console.WriteLine(JsonSerializer.Serialize(new { sdk = typeof(NodeId).Assembly.GetCustomAttribute()?.InformationalVersion, sdkFile = FileVersionInfo.GetVersionInfo(typeof(NodeId).Assembly.Location).FileVersion, modules = types.Select(t => new { type = t.FullName, assembly = t.Assembly.GetName().Name, mvid = t.Module.ModuleVersionId, interfaces = t.GetInterfaces().Select(x => x.FullName), fields = t.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly) .Select(f => new { name = f.Name, type = f.FieldType.FullName }), lifecycle = t.GetMethods(BindingFlags.Public | BindingFlags.Instance).Where(m => m.Name.Contains("Dispose") || m.Name.Contains("Close") || m.Name.Contains("Stop")) .Select(m => m.ToString()) }) }, new JsonSerializerOptions { WriteIndented = true }));