Imports Microsoft.Win32
Imports ZwSoft.ZwCAD.Runtime
Public Class Commands
<CommandMethod("test")> _
Public Shared Sub test()
Dim key As RegistryKey = Registry.CurrentUser
Dim software As RegistryKey = key.OpenSubKey("Software\\ZWSOFT")
If software Is Nothing Then
Exit Sub
End If
Dim root As String = "Software\\ZWSOFT"
Dim curPro As String = getKeyValue(root, "CurProduct", key)
root = root + "\\" + curPro
Dim curVer As String = getKeyValue(root, "CurVer", key)
root = root + "\\" + curVer
Dim lanCurVer As String = getKeyValue(root, "CurVer", key)
root = root + "\\" + lanCurVer + "\\" + "Profiles"
Dim proFiles As RegistryKey = key.OpenSubKey(root)
Dim allProFiles() As String = proFiles.GetSubKeyNames
End Sub
Public Shared Function getKeyValue(root As String, keyName As String, key As RegistryKey)
Dim newRoot = key.OpenSubKey(root)
Dim keyValue As String = newRoot.GetValue(keyName).ToString
Return keyValue
End Function
End Class
Imports ZwSoft.ZwCAD.Runtime
Public Class Commands
<CommandMethod("test")> _
Public Shared Sub test()
Dim key As RegistryKey = Registry.CurrentUser
Dim software As RegistryKey = key.OpenSubKey("Software\\ZWSOFT")
If software Is Nothing Then
Exit Sub
End If
Dim root As String = "Software\\ZWSOFT"
Dim curPro As String = getKeyValue(root, "CurProduct", key)
root = root + "\\" + curPro
Dim curVer As String = getKeyValue(root, "CurVer", key)
root = root + "\\" + curVer
Dim lanCurVer As String = getKeyValue(root, "CurVer", key)
root = root + "\\" + lanCurVer + "\\" + "Profiles"
Dim proFiles As RegistryKey = key.OpenSubKey(root)
Dim allProFiles() As String = proFiles.GetSubKeyNames
End Sub
Public Shared Function getKeyValue(root As String, keyName As String, key As RegistryKey)
Dim newRoot = key.OpenSubKey(root)
Dim keyValue As String = newRoot.GetValue(keyName).ToString
Return keyValue
End Function
End Class