1 Commits

Author SHA1 Message Date
Emmanuele Sassi 37986b0bcb - eliminato controllo chiave
- aggiunto try su cancellazione file
2024-08-05 16:22:17 +02:00
3 changed files with 30 additions and 21 deletions
Binary file not shown.
+1
View File
@@ -19,6 +19,7 @@ Public Module ConstIni
' File con dati di licenza ' File con dati di licenza
Public Const LIC_FILE_NAME As String = "WebDoorCreator.CamSrv.lic" Public Const LIC_FILE_NAME As String = "WebDoorCreator.CamSrv.lic"
Public Const S_LICENCE As String = "Licence" Public Const S_LICENCE As String = "Licence"
Public Const K_LOCKID As String = "LockId"
Public Const K_KEY As String = "Key" Public Const K_KEY As String = "Key"
' File di log generale ' File di log generale
+29 -21
View File
@@ -937,7 +937,10 @@ Public Class ProcMan
' elimino vecchi ' elimino vecchi
If Not IsNothing(fileList) Then If Not IsNothing(fileList) Then
For Each sFile In fileList For Each sFile In fileList
File.Delete(sFile) Try
File.Delete(sFile)
Catch ex As Exception
End Try
Next Next
End If End If
@@ -1297,22 +1300,27 @@ Public Class ProcMan
Private Sub ProcMan_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub ProcMan_Load(sender As Object, e As EventArgs) Handles MyBase.Load
m_IniFilePath = AppDomain.CurrentDomain.BaseDirectory & INI_FILE_NAME m_IniFilePath = AppDomain.CurrentDomain.BaseDirectory & INI_FILE_NAME
ManageInstance() ManageInstance()
' Imposto tipo di chiave '' Imposto tipo di chiave
EgtSetLockType(KEY_TYPE.HW) 'EgtSetLockType(KEY_TYPE.HW)
' Leggo e imposto chiave di protezione '' Leggo e imposto chiave di protezione
Dim sLicFileName As String = String.Empty 'Dim sLicFileName As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName, m_IniFilePath) 'GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName, m_IniFilePath)
Dim sLicFile As String = AppDomain.CurrentDomain.BaseDirectory & sLicFileName 'Dim sLicFile As String = AppDomain.CurrentDomain.BaseDirectory & sLicFileName
Dim sKey As String = String.Empty 'Dim sKey As String = String.Empty
EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile) 'EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
EgtSetKey(sKey) 'EgtSetKey(sKey)
Dim bNetHwKey As Boolean = (GetPrivateProfileInt(S_GENERAL, K_NETKEY, 0, m_IniFilePath) = 1) 'Dim bNetHwKey As Boolean = (GetPrivateProfileInt(S_GENERAL, K_NETKEY, 0, m_IniFilePath) = 1)
EgtSetNetHwKey(bNetHwKey) 'EgtSetNetHwKey(bNetHwKey)
' Recupero livello e opzioni della chiave 'Dim sLockId As String = ""
Dim nKeyLevel As Integer = 0 'EgtUILib.GetPrivateProfileString(S_LICENCE, K_LOCKID, "", sLockId, sLicFile)
Dim nKeyOptions As Integer = 0 'If Not String.IsNullOrEmpty(sLockId) Then
Dim bKey As Boolean = EgtGetKeyLevel(9935, 2505, 1, nKeyLevel) And ' Dim x = EgtSetLockId(sLockId)
EgtGetKeyOptions(9935, 2505, 1, nKeyOptions) 'End If
'' Recupero livello e opzioni della chiave
'Dim nKeyLevel As Integer = 0
'Dim nKeyOptions As Integer = 0
'Dim bKey As Boolean = EgtGetKeyLevel(9935, 2505, 1, nKeyLevel) And
' EgtGetKeyOptions(9935, 2505, 1, nKeyOptions)
' Inizializzazione generale di EgtInterface ' Inizializzazione generale di EgtInterface
m_sLogFile = AppDomain.CurrentDomain.BaseDirectory & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString()) m_sLogFile = AppDomain.CurrentDomain.BaseDirectory & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " (" & m_nInstance.ToString() & ")" & vbLf & Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " (" & m_nInstance.ToString() & ")" & vbLf &
@@ -1322,10 +1330,10 @@ Public Class ProcMan
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() & (ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
My.Application.Info.Version.Revision.ToString() My.Application.Info.Version.Revision.ToString()
EgtInit(0, m_sLogFile, sLogMsg) EgtInit(0, m_sLogFile, sLogMsg)
If Not bKey Then 'If Not bKey Then
MessageBox.Show("No licences available!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) ' MessageBox.Show("No licences available!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End ' End
End If 'End If
' leggo sorgente richieste rest da ini ' leggo sorgente richieste rest da ini
GetPrivateProfileString(S_GENERAL, K_BASEIP, "", baseIp, m_IniFilePath) GetPrivateProfileString(S_GENERAL, K_BASEIP, "", baseIp, m_IniFilePath)