From f691ca210907d5fc7e531d0fa550c0da07884b1b Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 18 Mar 2019 06:57:41 +0000 Subject: [PATCH] EgtCAM5 2.1c3 : - corretta gestione MRU con nomi file non ASCII - migliorata gestione salvataggio appena prima di generazione. --- Internals/MruList.vb | 10 +++---- My Project/AssemblyInfo.vb | 4 +-- .../SimulationExpanderViewModel.vb | 27 ++++++++++++------- Utility/IniFile.vb | 8 ++++++ 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/Internals/MruList.vb b/Internals/MruList.vb index e20cc46..e351f4c 100644 --- a/Internals/MruList.vb +++ b/Internals/MruList.vb @@ -1,13 +1,13 @@ '---------------------------------------------------------------------------- -' EgalTech 2015-2015 +' EgalTech 2015-2019 '---------------------------------------------------------------------------- -' File : MruList.vb Data : 27.02.15 Versione : 1.6b7 +' File : MruList.vb Data : 17.03.19 Versione : 2.c3 ' Contenuto : Classe MruList (gestione elenco file appena usati). ' ' ' ' Modifiche : 27.02.15 DS Creazione modulo. -' +' 17.03.19 DS Scrittura e lettura path file da Ini come Utf8. ' '---------------------------------------------------------------------------- @@ -40,7 +40,7 @@ Public Class MruList Dim sFileName As String = String.Empty For i As Integer = 1 To m_nMaxEntries Dim sKey As String = K_FILE + i.ToString() - If GetPrivateProfileString(m_sSection, sKey, "", sFileName) > 0 Then + If GetPrivateProfileStringUtf8(m_sSection, sKey, "", sFileName) Then m_FileNames.Add(sFileName) End If Next @@ -51,7 +51,7 @@ Public Class MruList For i As Integer = 1 To m_nMaxEntries Dim sKey As String = K_FILE + i.ToString() If i <= m_FileNames.Count Then - WritePrivateProfileString(m_sSection, sKey, m_FileNames(i - 1).ToString) + WritePrivateProfileStringUtf8(m_sSection, sKey, m_FileNames(i - 1).ToString) Else WritePrivateProfileString(m_sSection, sKey, "") End If diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 5603e39..ba1b859 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -70,5 +70,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb index 27eccc1..3bbdda2 100644 --- a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb +++ b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb @@ -568,6 +568,8 @@ Public Class SimulationExpanderVM Application.Msn.NotifyColleagues(Application.SAVEPROJECT) ' Se non salvato, abbandono If EgtGetModified() Then Return + ' Aggiorno path + EgtGetCurrFilePath(sCurrFilePath) End If End If Dim sCncFile As String = "" @@ -908,9 +910,10 @@ Public Class SimulationExpanderVM Else ' Lancio salvataggio Application.Msn.NotifyColleagues(Application.SAVEPROJECT) - EgtGetCurrFilePath(sCurrFilePath) ' Se non salvato, abbandono If EgtGetModified() Then bOk = False + ' Aggiorno path + EgtGetCurrFilePath(sCurrFilePath) End If End If Else @@ -922,23 +925,27 @@ Public Class SimulationExpanderVM End If ' Creo la path del file di stima e relativo info (con nome gruppo se gestiti) If Not String.IsNullOrEmpty(sCurrFilePath) Then - sEstFile = Path.ChangeExtension(sCurrFilePath, Nothing) sInfo = "EgtCAM5 - " & sCurrFilePath - If IniFile.m_bMachiningGroup Then - Dim sMGrpName As String = String.Empty - If EgtGetMachGroupName(EgtGetCurrMachGroup(), sMGrpName) Then - sEstFile &= "_" & sMGrpName & ".html" - sInfo &= "-" & sMGrpName + If EgtGetInfo( EgtGetCurrMachGroup(), KEY_MCHGRP_NCNAME, sEstFile) AndAlso Not String.IsNullOrWhiteSpace( sEstFile) then + sEstFile = Path.ChangeExtension(Path.GetDirectoryName (sCurrFilePath) & "\" & sEstFile, ".html") + else + sEstFile = Path.ChangeExtension(sCurrFilePath, Nothing) + If IniFile.m_bMachiningGroup Then + Dim sMGrpName As String = String.Empty + If EgtGetMachGroupName(EgtGetCurrMachGroup(), sMGrpName) Then + sEstFile &= "_" & sMGrpName & ".html" + sInfo &= "-" & sMGrpName + End If + Else + sEstFile &= ".html" End If - Else - sEstFile &= ".html" End If End If Return bOk End Function Private Function CalcEstimation() As Boolean - ' Recupero la fase corrente + ' Recupero la fase corrente Dim nPhase As Integer = EgtGetCurrPhase() ' Aggiorno le lavorazioni If Not UpdateAllMachinings() Then diff --git a/Utility/IniFile.vb b/Utility/IniFile.vb index 40e304e..4aa089c 100644 --- a/Utility/IniFile.vb +++ b/Utility/IniFile.vb @@ -119,6 +119,10 @@ Public Module IniFile Return EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, IpDefault, IpString, m_sIniFile) End Function + Public Function GetPrivateProfileStringUtf8(IpAppName As String, IpKeyName As String, IpDefault As String, ByRef IpString As String) As Boolean + Return EgtGetStringUtf8FromIni( IpAppName,IpKeyName, IpDefault, IpString, m_sIniFile) + End Function + Public Function GetPrivateProfileColor(IpAppName As String, IpKeyName As String, ByRef Col As EgtUILib.EgtInterface.Color3d) As Boolean Return EgtUILib.GetPrivateProfileColor(IpAppName, IpKeyName, Col, m_sIniFile) End Function @@ -217,6 +221,10 @@ Public Module IniFile Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, IpString, m_sIniFile) End Function + Public Function WritePrivateProfileStringUtf8(IpAppName As String, IpKeyName As String, ByRef IpString As String) As Boolean + Return EgtWriteStringUtf8ToIni(IpAppName, IpKeyName, IpString, m_sIniFile) + End Function + Public Function WritePrivateProfileWinPos(IpAppName As String, IpKeyName As String, ByRef nFlag As Integer, ByRef nLeft As Integer, ByRef nTop As Integer, ByRef nWidth As Integer, ByRef nHeight As Integer) As Boolean Return EgtUILib.WritePrivateProfileWinPos(IpAppName, IpKeyName, nFlag, nLeft, nTop, nWidth, nHeight, m_sIniFile) End Function