You've already forked ssms-addin
mirror of
https://github.com/alex-bochkov/ssms-addin.git
synced 2025-11-23 22:04:53 +02:00
96 lines
2.0 KiB
VB.net
96 lines
2.0 KiB
VB.net
Imports System
|
|
Imports System.IO
|
|
Imports Microsoft.Win32
|
|
|
|
Namespace SettingManager
|
|
|
|
Module SettingManagerModule
|
|
|
|
Private Function GetRoot() As RegistryKey
|
|
|
|
Dim SettingKeyRoot As RegistryKey = Registry.CurrentUser.CreateSubKey("DBA-Helper.SSMS2018")
|
|
Dim testSettings As RegistryKey = SettingKeyRoot.CreateSubKey("Settings")
|
|
|
|
Return testSettings
|
|
|
|
End Function
|
|
|
|
|
|
Function GetTemplatesFolder() As String
|
|
|
|
Dim Folder As String = ""
|
|
|
|
Try
|
|
|
|
Dim RootKey = GetRoot()
|
|
|
|
Folder = RootKey.GetValue("ScriptTemplatesFolder").ToString
|
|
|
|
Catch ex As Exception
|
|
End Try
|
|
|
|
If String.IsNullOrEmpty(Folder) Then
|
|
|
|
Folder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "dba-helper-scripts")
|
|
|
|
End If
|
|
|
|
|
|
Return Folder
|
|
|
|
End Function
|
|
|
|
Function SaveTemplatesFolder(Folder As String) As Boolean
|
|
|
|
Try
|
|
|
|
Dim RootKey = GetRoot()
|
|
|
|
RootKey.SetValue("ScriptTemplatesFolder", Folder)
|
|
RootKey.Close()
|
|
|
|
Catch ex As Exception
|
|
Return False
|
|
End Try
|
|
|
|
Return True
|
|
|
|
End Function
|
|
|
|
'Function GetExcelExportFolder() As String
|
|
|
|
' Dim Folder As String = ""
|
|
|
|
' Try
|
|
|
|
' Dim RootKey = GetRoot()
|
|
|
|
' Folder = RootKey.GetValue("ExcelExportFolder").ToString
|
|
|
|
' Catch ex As Exception
|
|
' End Try
|
|
|
|
' Return Folder
|
|
|
|
'End Function
|
|
|
|
'Function SaveExcelExportFolder(Folder As String) As Boolean
|
|
|
|
' Try
|
|
|
|
' Dim RootKey = GetRoot()
|
|
|
|
' RootKey.SetValue("ExcelExportFolder", Folder)
|
|
' RootKey.Close()
|
|
|
|
' Catch ex As Exception
|
|
' Return False
|
|
' End Try
|
|
|
|
' Return True
|
|
|
|
'End Function
|
|
|
|
End Module
|
|
|
|
End Namespace |