diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index 76eacdc..d0adaa4 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -272,6 +272,15 @@ Public Module ConstIni Public Const K_VEINMA_IMGWIDTH As String = "ImgWidth" Public Const K_VEINMA_IMGHEIGHT As String = "ImgHeight" - Public Const K_NOTEPATH As String = "NotesPath" + ' File con direttorio radice dei dati + Public Const DAT_FILE_NAME As String = "DataRoot.Ini" + Public Const S_DATA As String = "Data" + Public Const K_DATAROOT As String = "DataRoot" + + ' Sottodirettorio di configurazione + Public Const CONF_DIR As String = "Config" + + ' File Notes + Public Const MACH_NOTES As String = "MachNotes.ini" End Module diff --git a/MachiningDbWindow/MachiningTreeView.vb b/MachiningDbWindow/MachiningTreeView.vb index 49fbf96..aae98e6 100644 --- a/MachiningDbWindow/MachiningTreeView.vb +++ b/MachiningDbWindow/MachiningTreeView.vb @@ -4533,6 +4533,8 @@ Public Class MachiningTreeViewItem #Region "NOTE PROPERTY" Private m_sNoteFilePath As String = String.Empty + Private m_sDataRoot As String = String.Empty + Private m_sConfigDir As String = String.Empty Private m_NotesList As New ObservableCollection(Of NoteListBoxItem) Public Property NotesList As ObservableCollection(Of NoteListBoxItem) @@ -7158,7 +7160,12 @@ Public Class MachiningTreeViewItem Dim IndexNote As Integer = 0 ' Recupero percorso file Note.ini - IniFile.GetMainPrivateProfileString(S_GENERAL, K_NOTEPATH, "", m_sNoteFilePath) + m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory + If EgtUILib.GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then + m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory + End If + ' Impostazione direttorio di configurazione + m_sConfigDir = m_sDataRoot & "\" & CONF_DIR ' Divido UserNotes in un array di String Dim sUserNotes() As String = m_UserNotes.TrimEnd(";"c).Split(New Char() {";"c, "="c}) @@ -7167,7 +7174,7 @@ Public Class MachiningTreeViewItem Next ' Recupero le info dal file Notes.ini - While EgtUILib.GetPrivateProfileString(m_Type.ToString(), IndexNote.ToString(), String.Empty, sNoteDescription, m_sNoteFilePath) > 0 + While EgtUILib.GetPrivateProfileString(m_Type.ToString(), IndexNote.ToString(), String.Empty, sNoteDescription, m_sConfigDir & "\" & MACH_NOTES) > 0 Dim sNotes() As String = sNoteDescription.Split(","c) For Index As Integer = 0 To sNotes.Count - 1 sNotes(Index) = sNotes(Index).Trim() @@ -7203,7 +7210,12 @@ Public Class MachiningTreeViewItem Dim IndexN As Integer = 0 ' Recupero percorso file Note.ini - IniFile.GetMainPrivateProfileString(S_GENERAL, K_NOTEPATH, "", m_sNoteFilePath) + m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory + If EgtUILib.GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then + m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory + End If + ' Impostazione direttorio di configurazione + m_sConfigDir = m_sDataRoot & "\" & CONF_DIR ' Divido UserNotes in un array di String Dim sUserNotes() As String = m_UserNotes.TrimEnd(";"c).Split(New Char() {";"c, "="c}) @@ -7212,7 +7224,7 @@ Public Class MachiningTreeViewItem Next ' Recupero le info dal file Notes.ini - While EgtUILib.GetPrivateProfileString(m_Type.ToString(), IndexNote.ToString(), String.Empty, sNoteDescription, m_sNoteFilePath) > 0 + While EgtUILib.GetPrivateProfileString(m_Type.ToString(), IndexNote.ToString(), String.Empty, sNoteDescription, m_sConfigDir & "\" & MACH_NOTES) > 0 Dim sNotes() As String = sNoteDescription.Split(","c) For Index As Integer = 0 To sNotes.Count - 1 sNotes(Index) = sNotes(Index).Trim()