' =============================================================================
' NX Journal: NX 2506 API 反射探针 (一次性诊断, 结果写当前工作目录 probe.txt)
' 摸清: Dex/Stl/Update/Translator 相关类型与成员、CloseAll 签名、Save 签名
' =============================================================================
Option Strict Off
Imports System
Imports System.IO
Imports System.Text
Imports NXOpen
Imports NXOpen.UF

Module ProbeApi
    Sub Main()
        Dim out As New StringBuilder()
        Dim asm As System.Reflection.Assembly = GetType(Session).Assembly
        out.AppendLine("=== 类型 (Dex/Stl/Update/Translator/Step/Iges) ===")
        For Each t As System.Type In asm.GetTypes()
            Dim n As String = t.FullName
            If n.IndexOf("Dex", StringComparison.OrdinalIgnoreCase) >= 0 OrElse
               n.IndexOf("Stl", StringComparison.OrdinalIgnoreCase) >= 0 OrElse
               n.IndexOf("Update", StringComparison.OrdinalIgnoreCase) >= 0 OrElse
               n.IndexOf("Translator", StringComparison.OrdinalIgnoreCase) >= 0 Then
                out.AppendLine("T: " & n)
            End If
        Next
        out.AppendLine("=== Session 成员 (Dex/Update/Export/Create) ===")
        For Each mi As System.Reflection.MemberInfo In GetType(Session).GetMembers()
            If mi.Name.IndexOf("Dex", StringComparison.OrdinalIgnoreCase) >= 0 OrElse
               mi.Name.IndexOf("Update", StringComparison.OrdinalIgnoreCase) >= 0 OrElse
               mi.Name.IndexOf("Export", StringComparison.OrdinalIgnoreCase) >= 0 Then
                out.AppendLine("S: " & mi.MemberType & " " & mi.Name)
            End If
        Next
        out.AppendLine("=== Part 成员 (Dex/Stl/Export) ===")
        For Each mi As System.Reflection.MemberInfo In GetType(Part).GetMembers()
            If mi.Name.IndexOf("Dex", StringComparison.OrdinalIgnoreCase) >= 0 OrElse
               mi.Name.IndexOf("Stl", StringComparison.OrdinalIgnoreCase) >= 0 OrElse
               mi.Name.IndexOf("Export", StringComparison.OrdinalIgnoreCase) >= 0 Then
                out.AppendLine("P: " & mi.MemberType & " " & mi.Name)
            End If
        Next
        out.AppendLine("=== PartCollection.CloseAll 重载 ===")
        For Each mi As System.Reflection.MethodInfo In GetType(PartCollection).GetMethods()
            If mi.Name = "CloseAll" Then out.AppendLine("CA: " & mi.ToString())
        Next
        out.AppendLine("=== Part.Save 重载 ===")
        For Each mi As System.Reflection.MethodInfo In GetType(Part).GetMethods()
            If mi.Name = "Save" OrElse mi.Name = "SaveAs" Then out.AppendLine("SV: " & mi.ToString())
        Next
        File.WriteAllText(Path.Combine(Directory.GetCurrentDirectory(), "probe.txt"), out.ToString(), Encoding.UTF8)
    End Sub
End Module
