EgtCAM5 :
- aggiunta abilitazione utente e aggiornamento per le estensioni permesse dai codici chiave.
This commit is contained in:
+344
-21
@@ -528,6 +528,87 @@ Public Class OptionWindowVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property SpecialOn As Boolean
|
||||
Get
|
||||
Return OptionModule.m_bSpecialOn
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
OptionModule.m_bSpecialOn = value
|
||||
WritePrivateProfileString(S_SPECIAL, K_SPECIALENABLE, If( value, "1", "0"))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property BeamEnabled As Boolean
|
||||
Get
|
||||
Return (IniFile.m_nKeyOptions And KEY_OPT.BEAM) <> 0
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property BeamActive As Boolean
|
||||
Get
|
||||
Return IniFile.IsActiveBeam()
|
||||
End Get
|
||||
End Property
|
||||
Public Property BeamOn As Boolean
|
||||
Get
|
||||
Return BeamEnabled AndAlso OptionModule.m_bBeamOn
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
OptionModule.m_bBeamOn = value
|
||||
WritePrivateProfileString(S_BEAM, K_BEAMENABLE, If( value, "1", "0"))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property WallEnabled As Boolean
|
||||
Get
|
||||
Return (IniFile.m_nKeyOptions And KEY_OPT.WALL) <> 0
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property WallActive As Boolean
|
||||
Get
|
||||
Return IniFile.IsActiveWall()
|
||||
End Get
|
||||
End Property
|
||||
Public Property WallOn As Boolean
|
||||
Get
|
||||
Return WallEnabled AndAlso OptionModule.m_bWallOn
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
OptionModule.m_bWallOn = value
|
||||
WritePrivateProfileString(S_WALL, K_WALLENABLE, If( value, "1", "0"))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property DoorsEnabled As Boolean
|
||||
Get
|
||||
Return (IniFile.m_nKeyOptions And KEY_OPT.DOORS) <> 0
|
||||
End Get
|
||||
End Property
|
||||
Public Property DoorsOn As Boolean
|
||||
Get
|
||||
Return DoorsEnabled AndAlso OptionModule.m_bDoorsOn
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
OptionModule.m_bDoorsOn = value
|
||||
WritePrivateProfileString(S_DOORS, K_DDFENABLE, If( value, "1", "0"))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property GunstockEnabled As Boolean
|
||||
Get
|
||||
Return (IniFile.m_nKeyOptions And KEY_OPT.GUNSTOCK) <> 0
|
||||
End Get
|
||||
End Property
|
||||
Public Property GunstockOn As Boolean
|
||||
Get
|
||||
Return OptionModule.m_bGunstockOn
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
OptionModule.m_bGunstockOn = value
|
||||
WritePrivateProfileString(S_GUNSTOCK, K_GUNSTOCKENABLE, If( value, "1", "0"))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdCloseOptions As ICommand
|
||||
Private m_cmdTopSceneBackground As ICommand
|
||||
@@ -537,6 +618,8 @@ Public Class OptionWindowVM
|
||||
Private m_cmdDefMaterialColor As ICommand
|
||||
Private m_cmdAddMachineCmd As ICommand
|
||||
Private m_cmdExportMachineCmd As ICommand
|
||||
Private m_cmdUpdateBeamCmd As ICommand
|
||||
Private m_cmdUpdateWallCmd As ICommand
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
@@ -608,6 +691,46 @@ Public Class OptionWindowVM
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 12)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property DimensionMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 44) ' Quotatura
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ExtLineLenMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 37) ' Estensione linea
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ArrowLenMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 38) ' Dimensione freccia
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property TextDistMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 39) ' Distanza messaggio
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property LenIsMMMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 40) ' Unità di misura
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property DecDigitMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 41) ' Numero dicmali
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property FontMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 42) ' Caretteri
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property TextHeightMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 43) ' Dimensione testo
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property ImportMsg As String
|
||||
Get
|
||||
@@ -716,52 +839,45 @@ Public Class OptionWindowVM
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 27) ' Aggiungi macchina
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property ExportMachineMsg As String
|
||||
Get
|
||||
Return EgtMsg(6549) ' Esporta macchina
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property DimensionMsg As String
|
||||
Public ReadOnly Property ExtraMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 44) ' Quotatura
|
||||
Return "Extra"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property ExtLineLenMsg As String
|
||||
Public ReadOnly Property SpecialMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 37) ' Estensione linea
|
||||
Return "Special"
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ArrowLenMsg As String
|
||||
Public ReadOnly Property BeamMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 38) ' Dimensione freccia
|
||||
Return "Beam"
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property TextDistMsg As String
|
||||
Public ReadOnly Property WallMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 39) ' Distanza messaggio
|
||||
Return "Wall"
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property LenIsMMMsg As String
|
||||
Public ReadOnly Property DoorsMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 40) ' Unità di misura
|
||||
Return "Doors"
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property DecDigitMsg As String
|
||||
Public ReadOnly Property GunstockMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 41) ' Numero dicmali
|
||||
Return "Gunstock"
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property FontMsg As String
|
||||
Public ReadOnly Property UpdateMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 42) ' Caretteri
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property TextHeightMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPTIONPAGE + 43) ' Dimensione testo
|
||||
Return EgtMsg(6554) ' Aggiorna
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -1173,6 +1289,213 @@ Public Class OptionWindowVM
|
||||
|
||||
#End Region ' ExportMachine
|
||||
|
||||
#Region "UpdateBeam"
|
||||
Public ReadOnly Property UpdateBeam_Command() As ICommand
|
||||
Get
|
||||
If m_cmdUpdateBeamCmd Is Nothing Then
|
||||
m_cmdUpdateBeamCmd = New RelayCommand(AddressOf UpdateBeamCmd)
|
||||
End If
|
||||
Return m_cmdUpdateBeamCmd
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub UpdateBeamCmd()
|
||||
' Recupero la versione del programma in esecuzione
|
||||
Dim sExeVer As String = IniFile.GetProgramVersion()
|
||||
' Verifico presenza di una precedente installazione del Beam
|
||||
Dim sBeamVer As String = ""
|
||||
IniFile.GetSpecialLuaVersion( IniFile.m_sBeamDirPath, sBeamVer)
|
||||
If String.IsNullOrEmpty( sBeamVer) Then
|
||||
' Il modulo "{0}" non è stato trovato, impossibile aggiornare. - Avviso
|
||||
Dim sOut As String = String.Format(EgtMsg(6555), "Beam")
|
||||
MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
' Esco
|
||||
Return
|
||||
End If
|
||||
' Apro dialogo per richiesta file zip del Beam
|
||||
Dim BeamDlg As New Microsoft.Win32.OpenFileDialog() With {
|
||||
.DefaultExt = ".zip",
|
||||
.Filter = "Beam (.zip)|*.zip",
|
||||
.CheckFileExists = True,
|
||||
.ValidateNames = True
|
||||
}
|
||||
If BeamDlg.ShowDialog() <> True Then Return
|
||||
Dim sBeamZip As String = BeamDlg.FileName
|
||||
' Preparo direttorio temporaneo
|
||||
Dim sTempDir As String = Path.Combine(IniFile.m_sTempDir, "Beam")
|
||||
If My.Computer.FileSystem.DirectoryExists( sTempDir) Then
|
||||
My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
||||
End If
|
||||
My.Computer.FileSystem.CreateDirectory( sTempDir)
|
||||
' Unzip nel direttorio temporaneo
|
||||
Using zip As New Ionic.Zip.ZipFile(sBeamZip)
|
||||
zip.ExtractAll( sTempDir, Ionic.Zip.ExtractExistingFileAction.DoNotOverwrite)
|
||||
End Using
|
||||
' Recupero i dati del nuovo Beam
|
||||
Dim sNewName = ""
|
||||
Dim sNewVer = ""
|
||||
Dim sNewMinExe = ""
|
||||
IniFile.GetSpecialLuaData( sTempDir, sNewName, sNewVer, sNewMinExe)
|
||||
' Verifico che sia veramente il Beam
|
||||
If String.Compare(sNewName, "Beam") <> 0 Then
|
||||
' Il file zip non contiene il modulo "{0}". - Avviso
|
||||
Dim sOut As String = String.Format(EgtMsg(6556), "Beam")
|
||||
MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
' Rimuovo il direttorio temporaneo ed esco
|
||||
My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
||||
Return
|
||||
End If
|
||||
' Verifico la versione minima del programma
|
||||
If String.Compare(sExeVer, sNewMinExe) < 0 Then
|
||||
' Il nuovo modulo "{0}" richiede un programma con versione minima {1}. - Avviso
|
||||
Dim sOut As String = String.Format(EgtMsg(6557), "Beam", sNewMinExe)
|
||||
MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
' Rimuovo il direttorio temporaneo ed esco
|
||||
My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
||||
Return
|
||||
End If
|
||||
' Verifico la versione del Beam e se più vecchia chiedo cosa fare
|
||||
If String.Compare(sNewVer, sBeamVer) < 0 Then
|
||||
' La versione del nuovo modulo "{0}" è più vecchia dell'attuale. Vuoi sovrascrivere lo stesso ?
|
||||
Dim sOut As String = String.Format(EgtMsg(6558), "Beam")
|
||||
if MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.No Then
|
||||
' Rimuovo il direttorio temporaneo ed esco
|
||||
My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
' Faccio una copia di backup del Beam corrente
|
||||
Dim sBackupDir As String = IniFile.m_sBeamDirPath & ".old"
|
||||
If My.Computer.FileSystem.DirectoryExists( sBackupDir) Then
|
||||
My.Computer.FileSystem.DeleteDirectory( sBackupDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
||||
End If
|
||||
Try
|
||||
My.Computer.FileSystem.MoveDirectory( IniFile.m_sBeamDirPath, sBackupDir, True)
|
||||
Catch ex As Exception
|
||||
' Ripristino lo stato originale ed esco
|
||||
My.Computer.FileSystem.MoveDirectory( sBackupDir, IniFile.m_sBeamDirPath, True)
|
||||
' L'aggiornamento del modulo "{0}" non è riuscito. - Errore
|
||||
Dim sOut As String = String.Format(EgtMsg(6559), "Beam")
|
||||
EgtOutLog( sOut)
|
||||
MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
' Rimuovo il direttorio temporaneo ed esco
|
||||
My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
||||
Return
|
||||
End Try
|
||||
' Installo il Beam
|
||||
My.Computer.FileSystem.MoveDirectory( sTempDir, IniFile.m_sBeamDirPath, True)
|
||||
' Il modulo "{0}" è stata aggiornato con successo. - Info
|
||||
Dim sOk As String = String.Format(EgtMsg(6560), "Beam")
|
||||
EgtOutLog( sOk)
|
||||
MessageBox.Show(Application.Current.MainWindow, sOk, EgtMsg(15003), MessageBoxButton.OK)
|
||||
End Sub
|
||||
|
||||
#End Region ' UpdateBeam
|
||||
|
||||
|
||||
#Region "UpdateWall"
|
||||
Public ReadOnly Property UpdateWall_Command() As ICommand
|
||||
Get
|
||||
If m_cmdUpdateWallCmd Is Nothing Then
|
||||
m_cmdUpdateWallCmd = New RelayCommand(AddressOf UpdateWallCmd)
|
||||
End If
|
||||
Return m_cmdUpdateWallCmd
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub UpdateWallCmd()
|
||||
' Recupero la versione del programma in esecuzione
|
||||
Dim sExeVer As String = IniFile.GetProgramVersion()
|
||||
' Verifico presenza di una precedente installazione del Wall
|
||||
Dim sWallVer As String = ""
|
||||
IniFile.GetSpecialLuaVersion( IniFile.m_sWallDirPath, sWallVer)
|
||||
If String.IsNullOrEmpty( sWallVer) Then
|
||||
' Il modulo "{0}" non è stato trovato, impossibile aggiornare. - Avviso
|
||||
Dim sOut As String = String.Format(EgtMsg(6555), "Wall")
|
||||
MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
' Esco
|
||||
Return
|
||||
End If
|
||||
' Apro dialogo per richiesta file zip del Wall
|
||||
Dim WallDlg As New Microsoft.Win32.OpenFileDialog() With {
|
||||
.DefaultExt = ".zip",
|
||||
.Filter = "Wall (.zip)|*.zip",
|
||||
.CheckFileExists = True,
|
||||
.ValidateNames = True
|
||||
}
|
||||
If WallDlg.ShowDialog() <> True Then Return
|
||||
Dim sWallZip As String = WallDlg.FileName
|
||||
' Preparo direttorio temporaneo
|
||||
Dim sTempDir As String = Path.Combine(IniFile.m_sTempDir, "Wall")
|
||||
If My.Computer.FileSystem.DirectoryExists( sTempDir) Then
|
||||
My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
||||
End If
|
||||
My.Computer.FileSystem.CreateDirectory( sTempDir)
|
||||
' Unzip nel direttorio temporaneo
|
||||
Using zip As New Ionic.Zip.ZipFile(sWallZip)
|
||||
zip.ExtractAll( sTempDir, Ionic.Zip.ExtractExistingFileAction.DoNotOverwrite)
|
||||
End Using
|
||||
' Recupero i dati del nuovo Wall
|
||||
Dim sNewName = ""
|
||||
Dim sNewVer = ""
|
||||
Dim sNewMinExe = ""
|
||||
IniFile.GetSpecialLuaData( sTempDir, sNewName, sNewVer, sNewMinExe)
|
||||
' Verifico che sia veramente il Wall
|
||||
If String.Compare(sNewName, "Wall") <> 0 Then
|
||||
' Il file zip non contiene il modulo "{0}". - Avviso
|
||||
Dim sOut As String = String.Format(EgtMsg(6556), "Wall")
|
||||
MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
' Rimuovo il direttorio temporaneo ed esco
|
||||
My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
||||
Return
|
||||
End If
|
||||
' Verifico la versione minima del programma
|
||||
If String.Compare(sExeVer, sNewMinExe) < 0 Then
|
||||
' Il nuovo modulo "{0}" richiede un programma con versione minima {1}. - Avviso
|
||||
Dim sOut As String = String.Format(EgtMsg(6557), "Wall", sNewMinExe)
|
||||
MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
' Rimuovo il direttorio temporaneo ed esco
|
||||
My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
||||
Return
|
||||
End If
|
||||
' Verifico la versione del Wall e se più vecchia chiedo cosa fare
|
||||
If String.Compare(sNewVer, sWallVer) < 0 Then
|
||||
' La versione del nuovo modulo "{0}" è più vecchia dell'attuale. Vuoi sovrascrivere lo stesso ?
|
||||
Dim sOut As String = String.Format(EgtMsg(6558), "Wall")
|
||||
if MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.No Then
|
||||
' Rimuovo il direttorio temporaneo ed esco
|
||||
My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
' Faccio una copia di backup del Wall corrente
|
||||
Dim sBackupDir As String = IniFile.m_sWallDirPath & ".old"
|
||||
If My.Computer.FileSystem.DirectoryExists( sBackupDir) Then
|
||||
My.Computer.FileSystem.DeleteDirectory( sBackupDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
||||
End If
|
||||
Try
|
||||
My.Computer.FileSystem.MoveDirectory( IniFile.m_sWallDirPath, sBackupDir, True)
|
||||
Catch ex As Exception
|
||||
' Ripristino lo stato originale ed esco
|
||||
My.Computer.FileSystem.MoveDirectory( sBackupDir, IniFile.m_sWallDirPath, True)
|
||||
' L'aggiornamento del modulo "{0}" non è riuscito. - Errore
|
||||
Dim sOut As String = String.Format(EgtMsg(6559), "Wall")
|
||||
EgtOutLog( sOut)
|
||||
MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
' Rimuovo il direttorio temporaneo ed esco
|
||||
My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
|
||||
Return
|
||||
End Try
|
||||
' Installo il Wall
|
||||
My.Computer.FileSystem.MoveDirectory( sTempDir, IniFile.m_sWallDirPath, True)
|
||||
' Il modulo "{0}" è stata aggiornato con successo. - Info
|
||||
Dim sOk As String = String.Format(EgtMsg(6560), "Wall")
|
||||
EgtOutLog( sOk)
|
||||
MessageBox.Show(Application.Current.MainWindow, sOk, EgtMsg(15003), MessageBoxButton.OK)
|
||||
End Sub
|
||||
|
||||
#End Region ' UpdateWall
|
||||
|
||||
#Region "CloseOptionsCommand"
|
||||
|
||||
''' <summary>
|
||||
|
||||
Reference in New Issue
Block a user