
import clr
import sys
import os
import System
from System import AppDomain

def list_types():
    dll_dir = os.path.join(os.getcwd(), "libs")
    sys.path.append(dll_dir)
    clr.AddReference("rapiplus")
    
    assembly = None
    for a in AppDomain.CurrentDomain.GetAssemblies():
        if "rapiplus" in a.FullName.lower():
            assembly = a
            break
            
    if not assembly: return
    
    results = []
    for t in assembly.GetTypes():
        if not t.IsPublic: continue
        kind = "Interface" if t.IsInterface else "Class"
        if t.IsAbstract and not t.IsInterface: kind = "Abstract Class"
        results.append(f"{t.FullName} ({kind})")
        
    with open("all_types.txt", "w") as f:
        f.write("\n".join(sorted(results)))
    print("Done. Results in all_types.txt")

if __name__ == "__main__":
    list_types()
